MeshPrimitive

Stores mesh topology for a Geometry.

Constructor

new L3D.MeshPrimitive()

Extends

Properties

Overrides:
materialIndex number

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

numAttributes number

The number of vertex attributes.

Methods

_intersectTriangle(p0, p1, p2, ray, rayHit, hitDistance) → bool

Test a ray against an individual triangle.

Parameters
p0 Vector3
p1 Vector3
p2 Vector3
ray Ray
rayHit RayHitInfo
hitDistance number
Returns
bool

_intersectTriangleFan()

Ray intersection test with a triangle_fan mesh

_intersectTriangles()

Ray intersection test with a triangle mesh

_intersectTriangleStrip()

Ray intersection test with a triangle_strip mesh

addFloatAttribute(name)

Add a new double vertex attribute with the given name and default value.

Parameters
name String

addIntAttribute(name)

Add a new integer vertex attribute with the given name and default value.

Parameters
name String

addVec2Attribute(name)

Add a new vector2 vertex attribute with the given name and default value.

Parameters
name String

addVec3Attribute(name)

Add a new vector3 vertex attribute with the given name and default value.

Parameters
name String

addVec4Attribute(name)

Add a new vector4 vertex attribute with the given name and default value.

Parameters
name String

attribute(index)

Get a vertex attribute.

Parameters
index number

colorAttribute(addAttr)

Return the color attribute (Cd). If addAttr is true and the attribute doesn't exist, it will be created.

Parameters
addAttr bool

copyAttribute(other, newName)

Add a new vertex attribute that is a copy of [other], possibly setting a [newName] for it.

Parameters
other *
newName *

findAttribute(name)

Find a vertex attribute with the given name.

Parameters
name String

getAllAttributeNames(geom)

Get the union of vertex and point attribute names. The returned Map will use the attribute name as the key, and the value will be 0 if it's a point attribute and 1 if it's a vertex attribute.

Parameters
geom Geometry

getBoundingBox(geom, box)

Overrides:

Compute and return the bounding box of the primitive.

Parameters
geom Geometry
box BoundingBox

getPoint(geom, index, out)

Overrides:

Return a point of the primitive.

Parameters
geom Geometry
index number
out Vector3

getPolyVertices(fi, verts, vertIndexes)

Returns the vertices for a given face [fi].

Parameters
fi number
verts Array
vertIndexes Array

interpolateAttribute()

Return the interpolated attribute value given the point of a ray intersection on the mesh.

normalAttribute(addAttr)

Return the normal attribute (N). If addAttr is true and the attribute doesn't exist, it will be created.

Parameters
addAttr bool

rayIntersect(geom, ray, rayHit, triangle) → bool

Overrides:

Test for a ray intersection with this mesh.

Parameters
geom Geometry

The geometry that owns this mesh.

ray Ray

The ray to test

rayHit RayHitInfo

Storage for the results of the intersection.

triangle int

Optionally intersect a specific triangle

Returns
bool

Whether or not there was an intersection.

removeAttribute(name)

Remove a vertex attribute.

Parameters
name String

renameAttribute(from, to)

Rename a vertex attribute

Parameters
from String
to String

setPoint(geom, index, p)

Overrides:

Set a point of the primitive.

Parameters
geom Geometry
index number
p Vector3

textureAttribute(addAttr)

Return the texture attribute (uv). If addAttr is true and the attribute doesn't exist, it will be created.

Parameters
addAttr bool

transformBy(geom, t)

Overrides:

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

Parameters
geom Geometry
t Matrix4

weightAttribute(addAttr)

Return the weight attribute (w). If addAttr is true and the attribute doesn't exist, it will be created.

Parameters
addAttr bool