Graphicsclass
Used to render to the screen using your Graphics Card, or whatever you kids are using in your crazy future computers. Whatever it is I'm sure it isn't fungible and everyone has free money and no-one has to ever work.
Methods40
Showing 40 methods
public static void Blit(Sandbox.Material material, Sandbox.RenderAttributes attributes = null)
Draw a screen space quad using the passed material. Your material should be using a screenspace shader so it will actually render to the screen and not in worldspace at 0,0,0
| Parameter | Type | Description |
|---|---|---|
| material | Material | — |
| attributes = null | RenderAttributes | — |
void—public static Sandbox.Rect DrawIcon(Sandbox.Rect rect, string iconName, Color color, float fontSize = 20, Sandbox.TextFlag alignment = 132)
Calls DrawText with "Material Icons" font. You can get a list of icons here https://fonts.google.com/icons?selected=Material+Icons
| Parameter | Type | Description |
|---|---|---|
| rect | Rect | — |
| iconName | string | — |
| color | Color | — |
| fontSize = 20 | float | — |
| alignment = 132 | TextFlag | — |
public static void DrawModel(Sandbox.Model model, Transform transform, Sandbox.RenderAttributes attributes = null)
Draws a single model at the given Transform immediately.
| Parameter | Type | Description |
|---|---|---|
| model | Model | The model to draw |
| transform | Transform | Transform to draw the model at |
| attributes = null | RenderAttributes | Optional attributes to apply only for this draw call |
void—public static void DrawQuad(Sandbox.Rect rect, Sandbox.Material material, Color color, Sandbox.RenderAttributes attributes = null)
Draw a quad in screenspace
| Parameter | Type | Description |
|---|---|---|
| rect | Rect | — |
| material | Material | — |
| color | Color | — |
| attributes = null | RenderAttributes | — |
void—public static void DrawRoundedRectangle(Sandbox.Rect rect, Color color, Vector4 cornerRadius = null, Vector4 borderWidth = null, Color borderColor = null)
Draw a rounded rectangle, with optional border, in Material.UI.Box
| Parameter | Type | Description |
|---|---|---|
| rect | Rect | — |
| color | Color | — |
| cornerRadius = null | Vector4 | — |
| borderWidth = null | Vector4 | — |
| borderColor = null | Color | — |
void—public static void FlushGPU()
Forces the GPU to flush all pending commands and wait for completion. Useful when you need to ensure GPU work is finished before proceeding. Can be called outside of a render block.
void—public static void GenerateMipMaps(Sandbox.Texture texture, Sandbox.Graphics.DownsampleMethod downsampleMethod = 0, int initialMip = 0, int numMips = -1)
Generate the mip maps for this texture. Obviously the texture needs to support mip maps.
| Parameter | Type | Description |
|---|---|---|
| texture | Texture | — |
| downsampleMethod = 0 | DownsampleMethod | — |
| initialMip = 0 | int | — |
| numMips = -1 | int | — |
void—public static Sandbox.RenderTarget GrabDepthTexture(string targetName = DepthTexture, Sandbox.RenderAttributes renderAttributes = null)
Grabs the current depth texture and stores it in targetName on renderAttributes.
| Parameter | Type | Description |
|---|---|---|
| targetName = DepthTexture | string | — |
| renderAttributes = null | RenderAttributes | — |
public static void Render(Sandbox.SceneObject obj, System.Nullable`1<Transform> transform = null, System.Nullable`1<Color> color = null, Sandbox.Material material = null)
| Parameter | Type | Description |
|---|---|---|
| obj | SceneObject | — |
| transform = null | Nullable<Transform> | — |
| color = null | Nullable<Color> | — |
| material = null | Material | — |
void—public static bool RenderToTexture(Sandbox.SceneCamera camera, Sandbox.Texture target)
Render this camera to the specified texture target
Obsolete: Use CameraComponent.RenderToTexture
| Parameter | Type | Description |
|---|---|---|
| camera | SceneCamera | — |
| target | Texture | — |
bool—public static void SetupLighting(Sandbox.SceneObject obj, Sandbox.RenderAttributes targetAttributes = null)
Setup the lighting attributes for this current object. Place them in the targetAttributes
| Parameter | Type | Description |
|---|---|---|
| obj | SceneObject | — |
| targetAttributes = null | RenderAttributes | — |
void—No results match this filter.
Properties12
Showing 12 properties
public static Sandbox.RenderAttributes Sandbox.Graphics.Attributes { get; set; }
Access to the current render context's attributes. These will be used to set attributes in materials/shaders. This is cleared at the end of the render block.
public static Vector3 Sandbox.Graphics.CameraPosition { get; set; }
The camera position of the currently rendering view
public static Rotation Sandbox.Graphics.CameraRotation { get; set; }
The camera rotation of the currently rendering view
public static Transform Sandbox.Graphics.CameraTransform { get; set; }
The camera transform of the currently rendering view
public static float Sandbox.Graphics.FieldOfView { get; set; }
The field of view of the currently rendering camera view, in degrees.
float—public static Sandbox.Frustum Sandbox.Graphics.Frustum { get; set; }
The frustum of the currently rendering camera view.
public static bool Sandbox.Graphics.IsActive { get; set; }
If true then we're currently rendering and you are safe to use the contents of this class
bool—public static Sandbox.SceneLayerType Sandbox.Graphics.LayerType { get; set; }
The current layer type. This is useful to tell whether you're meant to be drawing opaque, transparent or shadow. You mainly don't need to think about this, but when you do, it's here.
public static Sandbox.RenderTarget Sandbox.Graphics.RenderTarget { get; set; }
Get or set the current render target. Setting this will bind the render target and change the viewport to match it.
public static ulong Sandbox.Graphics.VideoMemoryBudget { get; set; }
GPU video memory budget in bytes, as reported by the OS (WDDM).
ulong—public static ulong Sandbox.Graphics.VideoMemoryUsed { get; set; }
GPU video memory currently used by the engine's render system in bytes. This includes textures, buffers, and all other GPU allocations tracked by the engine.
ulong—No results match this filter.