Attribute<T> class
class Attribute<T> {
String type;
List<T> value;
Float32List array;
Buffer buffer;
int size;
String boundTo = null;
bool needsUpdate = false;
bool __webglInitialized = false;
bool createUniqueBuffers = false;
Attribute<T> __original;
Attribute(this.type, this.value) {
size = 1;
if( type == "v2" ) { size = 2; }
else if( type == "v3" ) { size = 3; }
else if( type == "v4" ) { size = 4; }
else if( type == "c" ) { size = 3; }
if (value == null) {
value = [];
}
}
Attribute clone() {
var a = new Attribute(type, value);
return a;
}
factory Attribute.color([List<num> hex]) => new Attribute<Color>("c", (hex != null) ? hex.map((h) => new Color(h)) : null);
factory Attribute.float([List<double> v]) => new Attribute<double>("f", v);
factory Attribute.int([List<int> v]) => new Attribute<int>("i", v);
factory Attribute.vector2([List<Vector2> v]) => new Attribute<Vector2>("v2", v);
factory Attribute.vector3([List<Vector3> v]) => new Attribute<Vector3>("v3", v);
factory Attribute.vector4([List<Vector4> v]) => new Attribute<Vector4>("v4", v);
}
Constructors
new Attribute(String type, List<T> value) #
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
Attribute(this.type, this.value) {
size = 1;
if( type == "v2" ) { size = 2; }
else if( type == "v3" ) { size = 3; }
else if( type == "v4" ) { size = 4; }
else if( type == "c" ) { size = 3; }
if (value == null) {
value = [];
}
}
factory Attribute.color([List<num> hex]) #
factory Attribute.color([List<num> hex]) => new Attribute<Color>("c", (hex != null) ? hex.map((h) => new Color(h)) : null);
factory Attribute.float([List<double> v]) #
factory Attribute.float([List<double> v]) => new Attribute<double>("f", v);
factory Attribute.int([List<int> v]) #
factory Attribute.int([List<int> v]) => new Attribute<int>("i", v);
factory Attribute.vector2([List<Vector2> v]) #
factory Attribute.vector2([List<Vector2> v]) => new Attribute<Vector2>("v2", v);
Properties
Float32List array #
Float32List array