Models a single voxel. Methods of this class can be used to manipulate individual voxels; to manipulate multiple voxels, you'll want to use the voxel controller.
Access attributes with .get('name')
and .set('name', value)
.
Number/String
The color of the voxel; can be anything accepted by the constructor to THREE.Color:
a hexadecimal number, a CSS-style string (e.g. "rgb(250, 0,0)"
,
"rgb(100%,0%,0%)"
, "#ff0000"
, "#f00"
, or even "red"
)
Array
The position of the voxel on the lattice. Should be a 3-element array specifying the [x, y, z] position, where 0 <= x < lattice.width 0 <= y < lattice.height 0 <= z < lattice.depth
Call methods with.name()
,.name(arguments)
or just .name arguments
.
[options]
)
-> undefined
# Backbone.Model Removes all attributes from the model, including the id attribute. Fires a
"change" event unless silent
is passed as an option.
Object
(Optional)Backbone.Model
# Backbone.Model Returns a copy of the model.
Backbone.Model
copy of the model
attribute
)
-> Mixed
# Backbone.Model Get the current value of an attribute from the model. For example: note.get("title")
String
Attribute to get
Mixed
value of the attribute
attribute
)
-> Boolean
# Backbone.Model Returns true if the attribute is set to a non-null or non-undefined value.
if (note.has("title")) {
...
}
String
Boolean
true
if the attribute is non-null or non-undefined, else false
dx
, dy
, dz
)
-> C3D.models.Voxel
#Moves this voxel by the specified amount
Number
Number
Number
C3D.models.Voxel
this
x
, y
, z
)
-> C3D.models.Voxel
#Moves this voxel to the specified position
Number
Number
Number
C3D.models.Voxel
this
attribute
, [options]
)
-> undefined
# Backbone.Model Set a hash of attributes (one or many) on the model. If any of the attributes
change the model's state, a change
event will be triggered on the model.
Change events for specific attributes are also triggered, and you can bind to
those as well, for example: change:title
, and change:content
. You may also
pass individual keys and values.
note.set({title: "March 20", content: "In his eyes she eclipses..."});
book.set("title", "A Scandal in Bohemia");
String/Object
(s)
Object
(Optional)attribute
, [options]
)
-> undefined
# Backbone.Model Remove an attribute by deleting it from the internal attributes hash. Fires a
"change" event unless silent
is passed as an option.
String
Object
(Optional)