Class MeshPrimitive
Geometry to be rendered with the given material.
Inherited Members
Namespace: Unity.Cloud.Gltfast.Objects
Assembly: Unity.Cloud.Gltfast.dll
Syntax
[MovedFrom(true, "GLTFast.Schema", "glTFast", null)]
public class MeshPrimitive : ICloneable, IMaterialsVariantsSlot
Properties
AdditionalProperties
Additional properties on glTF JSON objects. Those properties may have been added by a new, unsupported version of the glTF specification. For extending glTF, please use extensions or extras instead.
Declaration
[JsonIgnore]
public ReadOnlyProperties AdditionalProperties { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlyProperties |
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
[JsonPropertyName("attributes")]
public Attributes Attributes { get; set; }
Property Value
| Type | Description |
|---|---|
| Attributes |
Extensions
Mesh primitive extensions
Declaration
[JsonPropertyName("extensions")]
public MeshPrimitiveExtensions Extensions { get; set; }
Property Value
| Type | Description |
|---|---|
| MeshPrimitiveExtensions |
Extras
Application-specific data.
Declaration
[JsonPropertyName("extras")]
[JsonConverter(typeof(ExtrasConverter))]
public ExtrasContainer Extras { get; set; }
Property Value
| Type | Description |
|---|---|
| ExtrasContainer |
See Also
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
[JsonPropertyName("indices")]
public int? Indices { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
IsDracoCompressed
Declaration
[JsonIgnore]
public bool IsDracoCompressed { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Material
The index of the material to apply to this primitive when rendering.
Declaration
[JsonPropertyName("material")]
public int? Material { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Mode
The type of primitives to render. All valid values correspond to WebGL enums.
Declaration
[JsonIgnore]
public PrimitiveMode Mode { get; set; }
Property Value
| Type | Description |
|---|---|
| PrimitiveMode |
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
[JsonPropertyName("targets")]
public List<MorphTarget> Targets { get; set; }
Property Value
| Type | Description |
|---|---|
| List<MorphTarget> |
Methods
Clone()
Clones the object
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| object | Member-wise clone |
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, or null when no material is assigned. |