GeometryPrimitive

An primitive represents the topology of the geometry to render. There are several types of primitives that can be added to geometry: ParticlePrimitive, which is drawn as points; LinPrimitive, which is drawn as lines; MeshPrimitive, which s drawn as a triangle mesh. There are also Quadric primitives, which are used to instance basic shapes using only a single vertex at its center, such as SpherePrimitive, TorusPrimitive, CylinderPrimitive, and DiscPrimitive.

Constructor

new L3D.GeometryPrimitive()

Properties

materialIndex number

The index of the mateiral to use when the object has multiple materials.

Methods

getBoundingBox(geom, box)

Compute and return the bounding box of the primitive.

Parameters
geom Geometry
box BoundingBox

getPoint(geom, index, out)

Return a point of the primitive.

Parameters
geom Geometry
index number
out Vector3

rayIntersect(geom, ray, rayHit) → bool

Test for a ray intersection with this geometry.

Parameters
geom Geometry

The geometry that owns the primitive

ray Ray

The ray to test against

rayHit RayHitInfo

Storage for the results of the intersection

Returns
bool

Whether or not there was an intersection found.

setPoint(geom, index, p)

Set a point of the primitive.

Parameters
geom Geometry
index number
p Vector3

transformBy(geom, t)

If the primitive requires any additional transformation beyond just transforming the points, the transformation can be applied here.

Parameters
geom Geometry
t Matrix4