Class MeshPrimitiveBase
Geometry to be rendered with the given material.
Inherited Members
Namespace: GLTFast.Schema
Assembly: glTFast.dll
Syntax
[Serializable]
public abstract class MeshPrimitiveBase : ICloneable, IMaterialsVariantsSlot
Fields
attributes
A dictionary object, where each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data.
Declaration
public Attributes attributes
Field Value
Type | Description |
---|---|
Attributes |
indices
The index of the accessor that contains mesh indices.
When this is not defined, the primitives should be rendered without indices
using drawArrays()
. When defined, the accessor must contain indices:
the bufferView
referenced by the accessor must have a target
equal
to 34963 (ELEMENT_ARRAY_BUFFER); a byteStride
that is tightly packed,
i.e., 0 or the byte size of componentType
in bytes;
componentType
must be 5121 (UNSIGNED_BYTE), 5123 (UNSIGNED_SHORT)
or 5125 (UNSIGNED_INT), the latter is only allowed
when OES_element_index_uint
extension is used; type
must be \"SCALAR\"
.
Declaration
public int indices
Field Value
Type | Description |
---|---|
int |
material
The index of the material to apply to this primitive when rendering.
Declaration
public int material
Field Value
Type | Description |
---|---|
int |
mode
The type of primitives to render. All valid values correspond to WebGL enums.
Declaration
public DrawMode mode
Field Value
Type | Description |
---|---|
DrawMode |
targets
An array of Morph Targets, each Morph Target is a dictionary mapping attributes to their deviations in the Morph Target (index of the accessor containing the attribute displacements' data).
Declaration
public MorphTarget[] targets
Field Value
Type | Description |
---|---|
MorphTarget[] |
Properties
Extensions
Mesh primitive extensions
Declaration
public abstract MeshPrimitiveExtensions Extensions { get; }
Property Value
Type | Description |
---|---|
MeshPrimitiveExtensions |
IsDracoCompressed
Declaration
public bool IsDracoCompressed { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
Clone()
Clones the object
Declaration
public object Clone()
Returns
Type | Description |
---|---|
object | Member-wise clone |
Equals(object)
Primitives are considered equal if their attributes and morph targets (if existing) are equal. This is practical when clustering primitives of a mesh together, that end up in a single Unity Mesh.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | Object to compare against |
Returns
Type | Description |
---|---|
bool | True if attributes and morph targets are equal, false otherwise |
Overrides
GetHashCode()
Default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
GetMaterialIndex(int)
Provides the glTF material index, given a materials variant index. If variantIndex is invalid (e.g. negative) or the slot does not have a material override for the given variantIndex, it returns the default material index.
Declaration
public int GetMaterialIndex(int variantIndex)
Parameters
Type | Name | Description |
---|---|---|
int | variantIndex | Materials variant index. |
Returns
Type | Description |
---|---|
int | Corresponding glTF material index. |