Textures can be loaded from file, created dynamically from data; they are passed into materials and mapped onto 2D and 3D surfaces.
Base texture class, do not instantiate directly.
Texture()
Default constructor for Texture.
int colorSpace(int colorSpace)
Set the colorspace of the texture data. Default COLOR_SPACE_LINEAR.
int colorSpace()
Get the colorspace of the texture data. Default COLOR_SPACE_LINEAR.
void filter(int min, int mag)
Set texture sampler min and mag filter modes Texture.FILTER_NEAREST or Texture.FILTER_LINEAR.
int filterMag()
Set texture sampler magnification filter. Default FILTER_LINEAR.
int filterMin()
Set texture sampler minification filter. Default FILTER_LINEAR.
void wrap(int s, int t)
Set texture wrap modes along s and t dimensions.
int wrapS()
Set texture wrap modes along s dimensions.
int wrapT()
Set texture wrap modes along t dimensions.
int COLOR_SPACE_LINEAR
Specifices the texture data to be in linear colorspace.Textures used for lighting parameters (like specular or normal maps) are typically in this linear spacePass into Texture.colorSpace()
int COLOR_SPACE_SRGB
Specifices the colorspace of the texture data to be in gamma-corrected sRGB colorspace.Textures used for color data (like diffuse maps) are typically in this colorspacePass into Texture.colorSpace()
int FILTER_LINEAR
When passed into Texture.filter(), sets texture sampler to use bilinear filtering.
int FILTER_NEAREST
When passed into Texture.filter(), sets texture sampler to use nearest-neighbor filtering.
int WRAP_CLAMP
When passed into Texture.wrap(), sets the texture to clamp to the border pixel color for UVs outside of [0,1].
int WRAP_MIRRORED
When passed into Texture.wrap(), sets the texture to repeat and mirror for UVs outside of [0,1].
int WRAP_REPEAT
When passed into Texture.wrap(), sets the texture to repeat for UVs outside of [0,1].
[ top ]
Class for loading textures from external files.
FileTexture()
Default constructor for FileTexture.
string path(string path)
Loads texture data from path.
string path()
Get the filepath for the currently-loaded texture.
[ top ]
Class for dynamically creating textures from chuck arrays.
DataTexture()
Default constructor for DataTexture.
void data(float[] data, int width, int height)
Set the data for this texture. Data is expected to be a float array of length width*height*4, where each pixel is represented by 4 floats for r,g,b,a.Currently only supports unsigned bytes, so each float must be in range [0,255].
[ top ]
Class for loading cubemap textures from external files or chuck arrays.
CubeTexture()
Default constructor for CubeTexture.
void paths(string right, string left, string top, string bottom, string front, string back)
Pass in paths to the 6 faces of the cubemap in the order: right, left, top, bottom, front, back.
[ top ]