Class GameObjectBoundsInstantiator
Generates a GameObject hierarchy from a glTF scene and provides its bounding box
Implements
Inherited Members
Namespace: Unity.Cloud.Gltfast
Assembly: Unity.Cloud.Gltfast.dll
Syntax
[MovedFrom(true, "GLTFast", "glTFast", null)]
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 for reporting messages. Defaults to the shared Instance (writes to Unity's Console) when |
| InstantiationSettings | settings | Instantiation settings |
Methods
AddMesh(uint, string, MeshResult, IReadOnlyList<uint>, uint?, IReadOnlyList<float>, int)
Adds a Mesh/MeshResult to a Node for rendering purpose.
Declaration
public override void AddMesh(uint nodeIndex, string meshName, MeshResult meshResult, IReadOnlyList<uint> joints = null, uint? rootJoint = null, IReadOnlyList<float> morphTargetWeights = null, int meshNumeration = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | nodeIndex | Index of the node |
| string | meshName | Mesh's name |
| MeshResult | meshResult | The converted Mesh |
| IReadOnlyList<uint> | joints | If a skin was attached, the joint indices. Null otherwise |
| uint? | rootJoint | Root joint node index, if present |
| IReadOnlyList<float> | morphTargetWeights | Morph target weights, if present |
| int | meshNumeration | Per glTF mesh MeshResult numeration. A glTF mesh is converted into one or more MeshResults which are numbered consecutively. AddMesh(uint, string, MeshResult, IReadOnlyList<uint>, uint?, IReadOnlyList<float>, int) is called once for each of those MeshResults. |
Overrides
BeginScene(string, IReadOnlyList<uint>)
Starts creating a scene instance. Has to be called at first and concluded by calling EndScene(IReadOnlyList<uint>).
Declaration
public override void BeginScene(string name, IReadOnlyList<uint> rootNodeIndices)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the scene |
| IReadOnlyList<uint> | rootNodeIndices | Indices of root level nodes in scene |
Overrides
CalculateBounds()
Attempts to calculate the instance's bounds
Declaration
public Bounds? CalculateBounds()
Returns
| Type | Description |
|---|---|
| Bounds? | Instance's bounds, if calculation succeeded |