Description
Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts
A handle to in-memory mesh part data in a GraphicsModel.Create using the Graphics API, GraphicsModel.cloneModel, GraphicsMesh.cloneMesh, or GraphicsMeshPart.cloneMeshPart.
Properties
| Name | Type | Summary |
|---|---|---|
| valid | boolean |
|
| partIndex | number |
The index of the part within the whole mesh (i.e., parent and mesh parts). Read-only. |
| firstVertexIndex | number |
The index of the first vertex. |
| baseVertexIndex | number |
The index of the base vertex. |
| lastVertexIndex | number |
The index of the last vertex. |
| topology | Graphics.MeshTopology |
The element interpretation. Currently only triangles is supported. |
| numIndices | number |
The number of vertex indices in the mesh part. |
| numVertices | number |
The number of vertices in the whole mesh (i.e., parent and mesh parts). Read-only. |
| numVerticesPerFace | number |
The number of vertices per face, per the
|
| numFaces | number |
The number of faces represented by the mesh part. Read-only. |
| numAttributes | number |
The number of vertex attributes in the whole mesh (i.e., parent and mesh parts). Read-only. |
| attributeNames | Array.<Graphics.BufferTypeName> |
The names of the vertex attributes in the whole mesh (i.e., parent and mesh parts). Read-only. |
| extents | Graphics.MeshExtents |
The mesh part extents, in model coordinates. Read-only. |
| bufferFormats | Object.<Graphics.BufferTypeName, Graphics.BufferFormat> |
Details of the buffers used for the whole mesh (i.e., parent and mesh parts). Read-only. |
Methods
| Name | Return Value | Summary |
|---|---|---|
addAttribute
|
number |
Adds an attribute for all vertices. |
cloneMeshPart
|
GraphicsMeshPart |
Makes a copy of the mesh part. |
dedupeVertices
|
boolean |
Deduplicates vertices. |
fillAttribute
|
number |
Sets the value of an attribute for all vertices in the whole mesh (i.e., parent and mesh parts). |
findNearbyPartVertexIndices
|
Array.<number> |
Gets the indices of nearby vertices in the mesh part. |
getFace
|
Array.<number> |
Gets the vertex indices that make up a face. |
getIndices
|
Array.<number> |
Gets the vertex indices. |
getParentMesh
|
GraphicsMesh |
Gets the parent mesh. |
getVertexProperty
|
Graphics.BufferType |
Gets the value of a vertex's attribute. |
getVertextAttributes
|
Object.<Graphics.BufferTypeName, Graphics.BufferType> |
Gets the attributes and attribute values of a vertex. |
isValidIndex
|
boolean |
Checks if an index is valid and, optionally, that vertex has a particular attribute. |
replaceMeshPartData
|
boolean |
Replaces a mesh part with a copy of another mesh part. |
rotate
|
Graphics.MeshExtents |
Rotates the mesh part, using a quaternion. |
rotateDegrees
|
Graphics.MeshExtents |
Rotates the mesh part, using Euler angles. |
scale
|
Graphics.MeshExtents |
Scales the mesh part. |
scaleToFit
|
Graphics.MeshExtents |
Scales the mesh to so that it's maximum model coordinate dimension is a specified length. |
setIndices
|
boolean |
Sets the vertex indices. |
setVertexProperty
|
boolean |
Sets the value of a vertex's attribute. |
setVertextAttributes
|
boolean |
Updates attribute values of a vertex. |
toOBJ
|
string |
Exports the mesh part to OBJ format. |
transform
|
Graphics.MeshExtents |
Scales, rotates, and translates the mesh. |
translate
|
Graphics.MeshExtents |
Translates the mesh part. |
updateVertexAttributes
|
number |
Updates vertex attributes by calling a function for each vertex in the whole mesh (i.e., the parent and mesh parts). The function can return modified attributes to update the vertex with. |
Method Details
|
(static)
addAttribute( name,
defaultValueopt
) →
{number}
Returns: The number of vertices the attribute was added to, 0 if the
name was
invalid or all vertices already had the
attribute.
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Adds an attribute for all vertices. Parameters
|
|
(static)
cloneMeshPart(
) → {GraphicsMeshPart}
Returns: A copy of the mesh part. |
|---|
|
Makes a copy of the mesh part. |
|
(static)
dedupeVertices( epsilonopt
) →
{boolean}
Returns: true if the deduplication
succeeded, false if it
didn't.
|
||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
Deduplicates vertices. Parameters
|
|
(static)
fillAttribute( name, value
) →
{number}
Returns: 1 if the attribute name was
valid and the attribute values were
set, 0
otherwise.
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|
|
Sets the value of an attribute for all vertices in the whole mesh (i.e., parent and mesh parts). Parameters
|
|
(static)
findNearbyPartVertexIndices( origin,
epsilonopt
) →
{Array.<number>}
Returns: The indices of nearby vertices. |
|||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Gets the indices of nearby vertices in the mesh part. Parameters
|
|
(static)
getFace(
index ) →
{Array.<number>}
Returns: The vertex indices that make up the face, of number per the mesh topology.
|
||||||
|---|---|---|---|---|---|---|
|
Gets the vertex indices that make up a face. Parameters
|
|
(static)
getIndices(
)
→
{Array.<number>}
Returns: The vertex indices. |
|---|
|
Gets the vertex indices. |
|
(static)
getParentMesh(
) → {GraphicsMesh}
Returns: The parent mesh. |
|---|
|
Gets the parent mesh. |
|
(static)
getVertexProperty( index, name
) → {Graphics.BufferType}
Returns: The value of the vertex attribute. |
|||||||||
|---|---|---|---|---|---|---|---|---|---|
|
Gets the value of a vertex's attribute. Throws
Throws an error if the
index is invalid or
name is
invalid or isn't used in the
mesh.
Parameters
|
|
(static)
getVertextAttributes( index
) →
{Object.<Graphics.BufferTypeName,
Graphics.BufferType>}
Returns: The attribute names and values for the vertex. |
||||||
|---|---|---|---|---|---|---|
|
Gets the attributes and attribute values of a vertex. Throws
Throws an error if the
index is invalid.
Parameters
|
|
(static)
isValidIndex( index,
attributeopt
) →
{boolean}
Returns: true if the index is valid
and that vertex has the attribute if
specified.
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Checks if an index is valid and, optionally, that vertex has a particular attribute. Throws
Throws an error if the
index if invalid or
name is
invalid or isn't used in the
mesh.
Parameters
|
|
(static)
replaceMeshPartData( source,
attributesopt
) →
{boolean}
Returns: true if the mesh part was
successfully replaced,
false
if it wasn't.
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Replaces a mesh part with a copy of another mesh part. Throws
Throws an error if the mesh part of
source mesh part aren't valid.
Parameters
|
|
(static)
rotate(
rotation, originopt
) → {Graphics.MeshExtents}
Returns: The resulting mesh extents, in model coordinates. |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Rotates the mesh part, using a quaternion. Parameters
|
|
(static)
rotateDegrees( eulerAngles,
originopt
) → {Graphics.MeshExtents}
Returns: The resulting mesh extents, in model coordinates. |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Rotates the mesh part, using Euler angles. Parameters
|
|
(static)
scale(
scale, originopt
) → {Graphics.MeshExtents}
Returns: The resulting mesh extents, in model coordinates. |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Scales the mesh part. Parameters
|
|
(static)
scaleToFit( scale
) → {Graphics.MeshExtents}
Returns: The resulting mesh extents, in model coordinates. |
||||||
|---|---|---|---|---|---|---|
|
Scales the mesh to so that it's maximum model coordinate dimension is a specified length. Parameters
|
|
(static)
setIndices( indices
) →
{boolean}
Returns: true if successful,
false if not.
|
||||||
|---|---|---|---|---|---|---|
|
Sets the vertex indices. Throws
Throws an error if the number of indices
isn't the same, or an index is invalid.
Parameters
|
|
(static)
setVertexProperty( index, name,
value
) →
{boolean}
Returns: true if the vertex
attribute value was set,
false if
it wasn't.
|
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Sets the value of a vertex's attribute. Throws
Throws an error if the
index is invalid or
name is
invalid or isn't used in the
mesh.
Parameters
|
|
(static)
setVertextAttributes( index,
values ) →
{boolean}
Returns: true if the index and the
attribute names and values were valid
and
the vertex was
updated, false otherwise.
|
|||||||||
|---|---|---|---|---|---|---|---|---|---|
|
Updates attribute values of a vertex. Throws
Throws an error if the
index is invalid or one of
the attribute
names is invalid or isn't used
in the mesh.
Parameters
|
|
(static)
toOBJ(
) →
{string}
Returns: The OBJ format representation of the mesh part. |
|---|
|
Exports the mesh part to OBJ format. |
|
(static)
transform( transform
) → {Graphics.MeshExtents}
Returns: The resulting mesh extents, in model coordinates. |
||||||
|---|---|---|---|---|---|---|
|
Scales, rotates, and translates the mesh. Parameters
|
|
(static)
translate( translation
) → {Graphics.MeshExtents}
Returns: The rseulting mesh extents, in model coordinates. |
||||||
|---|---|---|---|---|---|---|
|
Translates the mesh part. Parameters
|
|
(static)
updateVertexAttributes( callback
) →
{number}
Returns: The number of vertices the callback was called for. |
||||||
|---|---|---|---|---|---|---|
|
Updates vertex attributes by calling a function for each vertex in the whole mesh (i.e., the parent and mesh parts). The function can return modified attributes to update the vertex with. Parameters
|
