Summary

A texture is an image used in rendering. Can be a static texture loaded from disk, or a dynamic texture rendered to by code. Can also be 2D, 3D (multiple slices), or a cube texture (6 slices).

Properties

Depth Depth of a 3D texture in pixels, or slice count for 2D texture arrays, or 6 for slices of cubemap.
GenerationData Data used by the generator to create the texture
HasAnimatedSequences
Height Height of the texture in pixels.
ImageFormat Image format of this texture.
Index Texture index. Bit raw dog and needs a higher level abstraction.
IsError Whether this texture is an error or invalid or not.
IsLoaded Whether this texture has finished loading or not.
LastUsed Returns how many frames ago this texture was last used by the renderer
Mips Number of mip maps this texture has.
SequenceCount The count of sequences in this texture, if any. The rest of the sequence data is encoded into the texture itself.
SequenceData If this texture is a sprite sheet, will return information about the sheet, which is generally used in the shader. You don't really need to think about the contents.
Size Returns a Vector2 representing the size of the texture (width, height)
Width Width of the texture in pixels.

Methods

Clear Clear this texture with a solid color
CreateGenerator If this is a generated texture we'll create and return a generator for it.
Dispose Will release the handle for this texture. If the texture isn't referenced by anything else it'll be released properly. This will happen anyway because it's called in the destructor. By calling it manually you're just telling the engine you're done with this texture right now instead of waiting for the garbage collector.
GetBitmap
GetPixel Reads a single pixel color.
GetPixel3D Reads a single pixel color from a volume or array texture.
GetPixels Reads pixel colors from the texture at the specified mip level
GetPixels3D
GetSequenceFrameCount Get the frame count for this sequence
MarkUsed Tells texture streaming this texture is being used. This is usually automatic, but useful for bindless pipelines.
Update
Update3D

Static Properties

Invalid 1x1 solid magenta colored texture.
Transparent 1x1 fully transparent texture.
White 1x1 solid white opaque texture.

Static Methods

Create Begins creation of a custom texture. Finish by calling Sandbox.Texture2DBuilder.Finish.
CreateArray Begins creation of a custom texture array. Finish by calling Sandbox.TextureArrayBuilder.Finish.
CreateCube Begins creation of a custom cube texture. (A texture with 6 sides) Finish by calling Sandbox.TextureCubeBuilder.Finish.
CreateCustom Begins creation of a custom texture. Finish by calling Sandbox.TextureBuilder.Create(System.String,System.Boolean,System.ReadOnlySpan{System.Byte},System.Int32).
CreateFromSvgSource
CreateRenderTarget Begins creation of a render target. Finish by calling Sandbox.TextureBuilder.Create(System.String,System.Boolean,System.ReadOnlySpan{System.Byte},System.Int32).
CreateVolume Begins creation of a custom 3D texture. Finish by calling Sandbox.Texture3DBuilder.Finish.
Find Try to get an already loaded texture.
Load Try to load a texture from given filesystem, by filename.
LoadAsync Load a texture asynchronously. Will return when the texture is loaded and valid. This is useful when loading textures from the web.
LoadAvatar Load avatar image of a Steam user.
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.