A Geometry is a mesh usually referenced from a GeometryInstance that is attached to a SceneNode.
Geometry objects are usually created via Scene.load() but can be created procedurally.
Required scripts
The Geometry object requires:
/*{{ javascript("jslib/geometry.js") }}*/
/*{{ javascript("jslib/utilities.js") }}*/
Summary
Creates and returns a Geometry object.
Syntax
var geometry = Geometry.create();
Summary
The VertexBuffer the geometry vertex data is stored in. The first used index is stored in baseIndex.
Syntax
var vertexBuffer = geometry.vertexBuffer;
Summary
The baseIndex is the first index in the vertexBuffer property of the geometry’s vertex data.
Syntax
var baseIndex = geometry.baseIndex;
Summary
The semantics of the vertex data stored in the vertexBuffer property.
Syntax
var semantics = geometry.semantics;
Summary
The surfaces is a dictionary of named surfaces.
Syntax
var surfaces = geometry.surfaces;
for (var surface in surfaces)
{
if (surfaces.hasOwnProperty(surface))
{
// ...
}
}
Summary
The type is one of the geometryTypes. It is used in the Effects to find the relevant Technique for the vertex type.
Syntax
if ("rigid" === geometry.type)
{
// ...
}
Summary
An array of 3 numbers for defining the center of the object’s bounding box.
Syntax
var center = geometry.center;
Summary
An array of 3 numbers for the half-extents of the object from the center.
Syntax
var minX = geometry.center[0] - geometry.halfExtents[0];
Summary
Free the resources attached to the object.
This is usually called automatically when a GeometryInstance is destroyed.
Syntax
geometry.destroy();