Graphics
Sandbox.Engine
Is static
Derives from object

Summary

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.

Properties

static RenderAttributes Attributes { get; }

Access to the current render context's attributes. These will be used to set attributes in materials/shaders.

static bool IsActive { get; }

If true then we're currently rendering and you are safe to use the contents of this class

static SceneLayerType LayerType { get; }

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.

static RenderTarget RenderTarget { get; set; }

Get or set the current render target. Setting this will bind the render target and change the viewport to match it.

static Rect Viewport { get; set; }

In pixel size, where are we rendering to?

Methods

static void Blit( Material material, 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

static void Clear( Color color, bool clearColor = true, bool clearDepth = true, )
static void Clear( bool clearColor = true, bool clearDepth = true, )
static void Draw( Span<Vertex> vertices, int vertCount, Material material, RenderAttributes attributes = null, PrimitiveType primitiveType = 5, )

Draw a bunch of vertices

static void Draw( Span<Vertex> vertices, int vertCount, Span<UInt16> indices, int indexCount, Material material, RenderAttributes attributes = null, PrimitiveType primitiveType = 5, )

Draw a bunch of vertices

static Rect DrawIcon( Rect rect, string iconName, Color color, float fontSize = 20, TextFlag alignment = 132, )

Calls DrawText with "Material Icons" font. You can get a list of icons herehttps://fonts.google.com/icons?selected=Material+Icons

static void DrawQuad( in Rect rect, in Material material, in Color color, RenderAttributes attributes = null, )

Draw a quad in screenspace

static void DrawRoundedRectangle( in Rect rect, in Color color, in Vector4 cornerRadius = null, in Vector4 borderWidth = null, in Color borderColor = null, )

Draw a rounded rectangle, with optional border, in Material.UI.Box

static Rect DrawText( in Rect position, string text, Color color, string fontFamily = Roboto, float fontSize = 20, float fontWeight = 450, TextFlag flags = 132, )

Draws a text quad in screenspace using the Material.UI.Text material.

static Rect DrawText( in Vector2 position, string text, Color color, string fontFamily = Roboto, float fontSize = 20, float fontWeight = 450, )

Draws a text quad in screenspace using the Material.UI.Text material.

static void GenerateMipMaps( Texture texture, )

Generate the mip maps for this texture. Obviously the texture needs to support mip maps.

static void GrabDepthTexture( string targetName = DepthTexture, RenderAttributes renderAttributes = null, )

Grabs the current depth texture and stores it in 'targetName' on ''renderAttributes'

static void GrabFrameTexture( string targetName = FrameTexture, RenderAttributes renderAttributes = null, )

Grabs the current viewport's color texture and stores it in 'targetName' on ''renderAttributes'

static Rect MeasureText( in Rect position, string text, string fontFamily = Roboto, float fontSize = 20, float fontWeight = 450, TextFlag flags = 132, )

Measure how big some text will be, without having to render it

static void Render( SceneObject obj, Transform? transform = null, Color? color = null, Material material = null, )

Render a SceneObject

static bool RenderToTexture( SceneCamera camera, Texture target, )

Render this camera to the specified texture target

static void SetupLighting( SceneObject obj, RenderAttributes targetAttributes = null, )

Setup the lighting attributes for this current object. Place them in the targetAttributes

Nested Types