class Prism::TextureOffset
- Prism::TextureOffset
- Crash::Component
- Reference
- Object
Overview
This indicates an offset to a texture.
The actual offset is determined by using a TextureAtlas
specific to the texture that will be drawn on the object.
The offset information is meant to be used in the shader to re-calculate the texture coordinates.
Example
// inside your vertex shader file
vec2 updatedTextureCoords = (textureCoords / numRows) + offset;
If you want to re-calculate your texture coordinates before sending them to the shader
You should use the TextureAtlas
directly.
Defined in:
prism/stdlib/texture_offset.crConstructors
-
.new(num_rows : UInt32, index : UInt32)
Creates a new texture offset.
-
.new(atlas : TextureAtlas, index : UInt32)
Creates a new offset component using the atlas, and index into the atlas.
Instance Method Summary
-
#num_rows : Float32
Returns the number of rows in the atlas.
-
#offset : Vector2f
Returns the texture offset.
Constructor Detail
Creates a new texture offset.
Internally this will create a TextureAtlas
to calculate the offset coordinates.
index should be a value between 0
and num_rows^2 - 1
inclusive.
Creates a new offset component using the atlas, and index into the atlas.
index should be a value between 0
and atlas.size^2 - 1
inclusive.