Dart DocumentationthreeTexture

Texture class

class Texture {
 int id;
 var image;
 var mapping; //UVMapping appears to be missing..
 int wrapS, wrapT, magFilter, minFilter, format, type, anisotropy;
 Vector2 offset, repeat;
 bool generateMipmaps;
 bool premultiplyAlpha;

 bool needsUpdate;
 var onUpdate;

 bool flipY;

 int unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)

 List mipmaps = [];

 //TODO: resolve dynamic vars, find out what UVMapping is!
 Texture( [  this.image,
             this.mapping = null,
             this.wrapS = ClampToEdgeWrapping,
             this.wrapT = ClampToEdgeWrapping,
             this.magFilter = LinearFilter,
             this.minFilter = LinearMipMapLinearFilter,
             this.format = RGBAFormat,
             this.type = UnsignedByteType,
             this.anisotropy = 1] )
 {
   id = TextureCount ++;

   this.mapping = mapping != null ? mapping : new UVMapping();

   offset = new Vector2.zero();
   repeat = new Vector2( 1.0, 1.0 );

   generateMipmaps = true;
   premultiplyAlpha = false;
   flipY = true;

   needsUpdate = false;
   onUpdate = null;
 }

 Texture clone() {
   Texture clonedTexture = new Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );

   clonedTexture.mipmaps = new List.from( mipmaps );
   clonedTexture.offset.setFrom( offset );
   clonedTexture.repeat.setFrom( repeat );

   return clonedTexture;
 }

 // Quick hack to allow setting new properties (used by the renderer)
 Map __data;

 get _data {
   if (__data == null) {
     __data = {};
   }
   return __data;
 }

 operator [] (String key) => _data[key];
 operator []= (String key, value) => _data[key] = value;
}

Subclasses

CompressedTexture, DataTexture, WebGLRenderTarget

Constructors

new Texture([image, mapping = null, int wrapS = ClampToEdgeWrapping, int wrapT = ClampToEdgeWrapping, int magFilter = LinearFilter, int minFilter = LinearMipMapLinearFilter, int format = RGBAFormat, int type = UnsignedByteType, int anisotropy = 1]) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
Texture( [  this.image,
           this.mapping = null,
           this.wrapS = ClampToEdgeWrapping,
           this.wrapT = ClampToEdgeWrapping,
           this.magFilter = LinearFilter,
           this.minFilter = LinearMipMapLinearFilter,
           this.format = RGBAFormat,
           this.type = UnsignedByteType,
           this.anisotropy = 1] )
{
 id = TextureCount ++;

 this.mapping = mapping != null ? mapping : new UVMapping();

 offset = new Vector2.zero();
 repeat = new Vector2( 1.0, 1.0 );

 generateMipmaps = true;
 premultiplyAlpha = false;
 flipY = true;

 needsUpdate = false;
 onUpdate = null;
}

Properties

int anisotropy #

int wrapS, wrapT, magFilter, minFilter, format, type, anisotropy

bool flipY #

bool flipY

int format #

int wrapS, wrapT, magFilter, minFilter, format

bool generateMipmaps #

bool generateMipmaps

int id #

int id

var image #

var image

int magFilter #

int wrapS, wrapT, magFilter

var mapping #

var mapping

int minFilter #

int wrapS, wrapT, magFilter, minFilter

List mipmaps #

List mipmaps = []

bool needsUpdate #

bool needsUpdate

Vector2 offset #

Vector2 offset

var onUpdate #

var onUpdate

bool premultiplyAlpha #

bool premultiplyAlpha

Vector2 repeat #

Vector2 offset, repeat

int type #

int wrapS, wrapT, magFilter, minFilter, format, type

int unpackAlignment #

int unpackAlignment = 4

int wrapS #

int wrapS

int wrapT #

int wrapS, wrapT

Operators

dynamic operator [](String key) #

operator [] (String key) => _data[key];

dynamic operator []=(String key, value) #

operator []= (String key, value) => _data[key] = value;

Methods

Texture clone() #

Texture clone() {
 Texture clonedTexture = new Texture( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );

 clonedTexture.mipmaps = new List.from( mipmaps );
 clonedTexture.offset.setFrom( offset );
 clonedTexture.repeat.setFrom( repeat );

 return clonedTexture;
}