s&
newspaper
About
info
About s&box
newspaper
Latest News
published_with_changes
Changes
map
Roadmap
monitoring
Metrics
games
Games
sports_esports
Browse Games
rocket
Discover Games
business_center
Workshop
sports_esports
Games
landscape
Maps
chair
Models
texture
Materials
apparel
Clothing
construction
More..
forum
Forum
docs
Docs
docs
Documentation
dashboard
Api Reference
school
Tutorials
input
Log in with Steam
chevron_left
Change Language
简体中文
English
Русский
Español
Português-Brasil
Deutsch
日本語
Français
Polski
Türkçe
한국어
Pirate
Italiano
ไทย
繁體中文
Українська
Čeština
Nederlands
Magyar
Dansk
Suomi
Svenska
Norsk
Ελληνικά
Română
Български
Tiếng Việt
Bahasa Indonesia
Español-Latinoamérica
العربية
Api
Graphics
Texture
chevron_left
Graphics
class
Texture
search
Properties
data_object
Depth
data_object
Flags
data_object
HasAnimatedSequences
data_object
Height
data_object
ImageFormat
data_object
Index
data_object
IsError
data_object
IsLoaded
data_object
IsValid
data_object
LastUsed
data_object
Mips
data_object
SequenceCount
data_object
SequenceData
data_object
Size
data_object
UAVAccess
data_object
Width
Methods
functions
Clear
functions
Dispose
lock
Finalize
functions
GetBitmap
functions
GetBitmapAsync
functions
GetPixel
functions
GetPixel3D
functions
GetPixels
functions
GetPixels3D
functions
GetPixelsAsync
functions
GetPixelsAsync3D
functions
GetSequenceFrameCount
functions
MarkUsed
functions
SaveToVtex
functions
SaveToVtexAsync
functions
Update
functions
Update3D
Static Properties
data_object
Black
data_object
Invalid
data_object
Transparent
data_object
White
Static Methods
functions
Create
functions
CreateArray
functions
CreateCube
functions
CreateCustom
functions
CreateFromSvgSource
functions
CreateRenderTarget
functions
CreateVolume
functions
Find
remove_circle
Load
remove_circle
LoadAsync
functions
LoadAvatar
functions
LoadFromFileSystem
functions
LoadFromFileSystemAsync
Texture
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).
class
Sandbox
.
account_tree
extends
Resource
Sandbox.Engine
data_object
Properties
16
Depth
int
Depth of a 3D texture in pixels, or slice count for 2D texture arrays, or 6 for slices of cubemap.
Flags
TextureFlags
Flags providing hints about this texture
HasAnimatedSequences
bool
Height
int
Height of the texture in pixels.
ImageFormat
ImageFormat
Image format of this texture.
Index
int
Texture index. Bit raw dog and needs a higher level abstraction.
IsError
bool
Whether this texture is an error or invalid or not.
IsLoaded
bool
Whether this texture has finished loading or not.
IsValid
bool
LastUsed
int
Returns how many frames ago this texture was last used by the renderer
Mips
int
Number of mip maps this texture has.
SequenceCount
int
The count of sequences in this texture, if any. The rest of the sequence data is encoded into the texture itself.
SequenceData
Vector4
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
Vector2
Returns a Vector2 representing the size of the texture (width, height)
UAVAccess
bool
Gets if the texture has UAV access
Width
int
Width of the texture in pixels.
functions
Methods
17
Clear
(
color
)
Clear this texture with a solid color
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.
Finalize
(
)
GetBitmap
(
mip
)
Bitmap
GetBitmapAsync
(
callback
,
mip
)
GetPixel
(
x
,
y
,
mip
)
Color32
Reads a single pixel color.
GetPixel3D
(
x
,
y
,
z
,
mip
)
Color32
Reads a single pixel color from a volume or array texture.
GetPixels
(
mip
)
Color32[]
Reads pixel colors from the texture at the specified mip level
GetPixels3D
(
srcBox
,
mip
,
dstData
,
dstFormat
,
dstSize
)
GetPixelsAsync
(
callback
,
mip
)
GetPixelsAsync3D
(
callback
,
dstFormat
,
srcBox
,
mip
)
GetSequenceFrameCount
(
sequenceId
)
int
Get the frame count for this sequence
MarkUsed
(
requiredMipSize
)
Tells texture streaming this texture is being used. This is usually automatic, but useful for bindless pipelines.
SaveToVtex
(
formatOverride
)
Byte[]
SaveToVtexAsync
(
format
)
Task`1
Update
(
data
,
x
,
y
,
width
,
height
)
Update3D
(
data
,
x
,
y
,
z
,
width
,
height
,
depth
)
data_object
Static Properties
4
Black
Texture
1x1 solid black opaque texture.
Invalid
Texture
1x1 solid magenta colored texture.
Transparent
Texture
1x1 fully transparent texture.
White
Texture
1x1 solid white opaque texture.
functions
Static Methods
13
Create
(
width
,
height
,
format
)
Texture2DBuilder
Begins creation of a custom texture. Finish by calling Sandbox.Texture2DBuilder.Finish.
CreateArray
(
width
,
height
,
count
,
format
)
TextureArrayBuilder
Begins creation of a custom texture array. Finish by calling Sandbox.TextureArrayBuilder.Finish.
CreateCube
(
width
,
height
,
format
)
TextureCubeBuilder
Begins creation of a custom cube texture. (A texture with 6 sides) Finish by calling Sandbox.TextureCubeBuilder.Finish.
CreateCustom
(
)
TextureBuilder
Begins creation of a custom texture. Finish by calling Sandbox.TextureBuilder.Create(System.String,System.Boolean,System.ReadOnlySpan{System.Byte},System.Int32).
CreateFromSvgSource
(
svgContents
,
width
,
height
,
color
)
Texture
CreateRenderTarget
(
)
TextureBuilder
Begins creation of a render target. Finish by calling Sandbox.TextureBuilder.Create(System.String,System.Boolean,System.ReadOnlySpan{System.Byte},System.Int32).
CreateVolume
(
width
,
height
,
depth
,
format
)
Texture3DBuilder
Begins creation of a custom 3D texture. Finish by calling Sandbox.Texture3DBuilder.Finish.
Find
(
filepath
)
Texture
Try to get an already loaded texture.
Load
(
filesystem
,
filepath
,
warnOnMissing
)
obsolete
Texture
Try to load a texture from given filesystem, by filename.
LoadAsync
(
filesystem
,
filepath
,
warnOnMissing
)
obsolete
Task`1
Load a texture asynchronously. Will return when the texture is loaded and valid. This is useful when loading textures from the web.
LoadAvatar
(
steamid
,
size
)
Texture
Load avatar image of a Steam user (with a certain size if supplied).
LoadFromFileSystem
(
filepath
,
filesystem
,
warnOnMissing
)
Texture
Try to load a texture from given filesystem, by filename.
LoadFromFileSystemAsync
(
filepath
,
filesystem
,
warnOnMissing
)
Task`1
Load a texture asynchronously. Will return when the texture is loaded and valid. This is useful when loading textures from the web, or without any big loading hitches.
Inheritance
Resource
Texture
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.