Create a new instance of a geometry
Name | Type | Description |
---|---|---|
options |
GeometryDescriptor |
The options for the geometry. |
Example
const geometry = new Geometry({
attributes: {
aPosition: [ // add some positions
0, 0,
0, 100,
100, 100,
100, 0,
],
aUv: [ // add some uvs
0, 0,
0, 1,
1, 1,
1, 0,
]
}
});
Members
attributes Record<string, Attribute> readonly
A record of the attributes of the geometry.
bounds Bounds
Returns the bounds of the geometry.
buffers Buffer[] readonly
The buffers that the attributes use
indexBuffer Buffer readonly
The index buffer of the geometry
the instance count of the geometry to draw
- Default Value:
- 1
topology Topology
The topology of the geometry.
The unique id of the geometry.
Methods
destroys the geometry.
Name | Type | Default | Description |
---|---|---|---|
destroyBuffers |
boolean | false |
destroy the buffers associated with this geometry |
Returns the requested attribute.
Name | Type | Description |
---|---|---|
id |
string |
The name of the attribute required |
Returns:
Type | Description |
---|---|
Attribute |
|
Returns the requested buffer.
Name | Type | Description |
---|---|---|
id |
string |
The name of the buffer required. |
Returns:
Type | Description |
---|---|
Buffer |
|
Returns the index buffer
Returns:
Type | Description |
---|---|
Buffer |
|
Used to figure out how many vertices there are in this geometry
Returns:
Type | Description |
---|---|
number | the number of vertices in the geometry |