Geometry

Geometry represents all types of geometry, from meshes to particle systems. Using a consistent data format for all types of geometry allows geometry nodes to process all types of geometry.

Constructor

new L3D.Geometry()

Properties

attributes AttributeList

The list of attributes for this geometry.

meshes Array

The list of meshes that belong to this geometry.

numAttributes number

The number of attributes for this geometry.

numMeshes number

The number of mesh primitives for this geometry.

numPointGroups number

The number of point groups.

numPoints number

The number of points in the geometry.

numPrimitiveGroups number

The number of primitive groups.

numPrimitives number

The number of primitives.

points Vec3Attribute

The points of the geometry

primitiveList PrimitiveList

The list of primitives for this geometry.

Methods

accelAttribute(addAttr)

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

Parameters
addAttr bool

addFloatAttribute(name)

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

Parameters
name String

addIntAttribute(name)

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

Parameters
name String

addPointGroup(name)PointGroup

Add a new point group.

Parameters
name String
Returns
PointGroup

addPoints(count)

Add a number of points to the Geometry.

Parameters
count number

addPrimitive(primitive)

Add a Primitive.

Parameters
primitive GeometryPrimitive

addPrimitiveGroup(name)

Add a new primitive group.

Parameters
name String

addVec2Attribute(name)

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

Parameters
name String

addVec3Attribute(name)

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

Parameters
name String

addVec4Attribute(name)

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

Parameters
name String

append(other)

Append the contents of another Geometry to this.

Parameters
other Geometry

clear()

Reset the geometry, clearing out all data.

colorAttribute(addAttr)

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

Parameters
addAttr bool

copy(other, pointsOnly)

Copy geometry from [other] into this geometry.

Parameters
other Geometry
pointsOnly bool

copyAttribute(other, newName)

Add a copy of the given attribute to this geometry.

Parameters
other GeometryAttribute

The attribute to make a copy of

newName String

Optional new name for the attribute. Otherwise the other attribute's name will be used. This does not check for conflicts with attributes that already have that name.

findAttribute(name) → nullable GeometryAttribute

Return the attribute with the given name.

Parameters
name String
Returns
GeometryAttribute

Returns null if the attribute couldn't be found.

findPointGroup(name) → nullable PointGroup

Find a point group with the given name.

Parameters
name String
Returns
PointGroup

findPrimitiveById(id) → nullable GeometryPrimitive

Find a primitive with the given id.

Parameters
id number

The primitive id to find.

Returns
GeometryPrimitive

The primitive with the given id, null if none was found.

findPrimitiveGroup(name) → nullable PrimitiveGroup

Find a primitive group with the given name.

Parameters
name String
Returns
PrimitiveGroup

generateNormals()

Compute surface normals for the geometry.

generateTangents()

Compute surface tangents for the geometry.

getAttribute(index)

Returns the attribute at the given index.

Parameters
index number

getBoundingBox()

Return the bounding box encapsulating the geometry. The value is cached and will only be recomputed if the geometry points are modified.

getMesh(index) → nullable Mesh

Get a mesh primitive.

Parameters
index number
Returns
Mesh

getPoint(index, out)Vector3

Get a points position

Parameters
index number
out Vector3
Returns
Vector3

getPointGroup(index)PointGroup

Get a point group.

Parameters
index number
Returns
PointGroup

getPrimitive(index) → nullable GeometryPrimitive

Get a primitive.

Parameters
index number
Returns
GeometryPrimitive

getPrimitiveGroup(index) → nullable PrimitiveGroup

Get a primitive group.

Parameters
index number
Returns
PrimitiveGroup

lifeAttribute(addAttr)

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

Parameters
addAttr bool

normalAttribute(addAttr)

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

Parameters
addAttr bool

pstateAttribute(addAttr)

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

Parameters
addAttr bool

rayIntersect(ray, rayHit) → bool

Test for a ray intersection with this geometry.

Parameters
ray Ray
rayHit RayHitInfo
Returns
bool

removeAttribute(name)

Remove a point attribute.

Parameters
name String

removePointRange(index, count)

Remove a range of points from the geometry.

Parameters
index number
count number

removePoints(toRemove)

Remove a list of points.

Parameters
toRemove *

renameAttribute(from, to)

Rename an attribute.

Parameters
from String
to String

resetBoundingBox()

Reset the bounding box to force it to be recomputed next time it's requested.

resetRayAccel()

Reset the ray accel structures, if any.

setPoint(index, p_x, y, z)

Set a point's position

Parameters
index number
p_x *
y number
z number

tangentAttribute(addAttr)

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

Parameters
addAttr bool

texture2Attribute(addAttr)

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

Parameters
addAttr bool

textureAttribute(addAttr)

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

Parameters
addAttr bool

translatePoint(index, delta)

Add to a points position

Parameters
index number
delta Vector3

updateBoundingBox()

Compute the bounding box of the geometry.

updateRayAccel()

Generate ray accel structures for the geometry and mesh primitives

velocityAttribute(addAttr)

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

Parameters
addAttr bool

weightAttribute(addAttr)

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

Parameters
addAttr bool