Class GameObjectBoundsInstantiator
Generates a GameObject hierarchy from a glTF scene and provides its bounding box
Inherited Members
Namespace: GLTFast
Syntax
public class GameObjectBoundsInstantiator : GameObjectInstantiator, IInstantiator
Constructors
GameObjectBoundsInstantiator(IGltfReadable, Transform, ICodeLogger, InstantiationSettings)
Constructs a GameObjectInstantiator
Declaration
public GameObjectBoundsInstantiator(IGltfReadable gltf, Transform parent, ICodeLogger logger = null, InstantiationSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
IGltfReadable | gltf | glTF to instantiate from |
Transform | parent | Generated GameObjects will get parented to this Transform |
ICodeLogger | logger | Custom logger |
InstantiationSettings | settings | Instantiation settings |
Methods
AddPrimitive(UInt32, String, Mesh, Int32[], UInt32[], Nullable<UInt32>, Single[], Int32)
Called for adding a Primitive/Mesh to a Node.
Declaration
public override void AddPrimitive(uint nodeIndex, string meshName, Mesh mesh, int[] materialIndices, uint[] joints = null, uint? rootJoint = null, float[] morphTargetWeights = null, int primitiveNumeration = 0)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | nodeIndex | Index of the node |
String | meshName | Mesh's name |
Mesh | mesh | The actual Mesh |
Int32[] | materialIndices | Material indices. Should be used to query the material |
UInt32[] | joints | If a skin was attached, the joint indices. Null otherwise |
Nullable<UInt32> | rootJoint | Root joint node index, if present |
Single[] | morphTargetWeights | Morph target weights, if present |
Int32 | primitiveNumeration | Primitives are numerated per Node, starting with 0 |
Overrides
BeginScene(String, UInt32[])
Starts creating a scene instance. Has to be called at first and concluded by calling EndScene(UInt32[]).
Declaration
public override void BeginScene(string name, uint[] rootNodeIndices)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the scene |
UInt32[] | rootNodeIndices | Indices of root level nodes in scene |
Overrides
CalculateBounds()
Attempts to calculate the instance's bounds
Declaration
public Bounds? CalculateBounds()
Returns
Type | Description |
---|---|
Nullable<Bounds> | Instance's bounds, if calculation succeeded |