forked from atteneder/glTFast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIInstatiator.cs
More file actions
83 lines (75 loc) · 3.25 KB
/
IInstatiator.cs
File metadata and controls
83 lines (75 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright 2020 Andreas Atteneder
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using UnityEngine;
namespace GLTFast {
public interface IInstantiator {
/// <summary>
/// Used to initialize Instantiators. Always called first.
/// </summary>
/// <param name="nodeCount">Quantity of nodes in the glTF file</param>
void Init(int nodeCount);
/// <summary>
/// Called for every Node in the glTF file
/// </summary>
/// <param name="nodeIndex">Index of node. Serves as identifier.</param>
/// <param name="position">Node's local position in hierarchy</param>
/// <param name="rotation">Node's local rotation in hierarchy</param>
/// <param name="scale">Node's local scale in hierarchy</param>
void CreateNode(
uint nodeIndex,
Vector3 position,
Quaternion rotation,
Vector3 scale
);
/// <summary>
/// Is called to set up hierarchical parent-child relations between nodes.
/// Always called after both nodes have been created via CreateNode before.
/// </summary>
/// <param name="nodeIndex">Index of child node.</param>
/// <param name="parentIndex">Index of parent node.</param>
void SetParent(uint nodeIndex, uint parentIndex);
/// <summary>
/// Sets the name of a node.
/// If a node has no name it falls back to the first valid mesh name.
/// Null otherwise.
/// </summary>
/// <param name="nodeIndex">Index of the node to be named.</param>
/// <param name="name">Valid name or null</param>
void SetNodeName(uint nodeIndex, string name);
/// <summary>
/// Called for adding a Primitive/Mesh to a Node.
/// </summary>
/// <param name="nodeIndex">Index of the node</param>
/// <param name="meshName">Mesh's name</param>
/// <param name="mesh">The actual Mesh</param>
/// <param name="materials">The materials</param>
/// <param name="joints">If a skin was attached, the joint indices. Null otherwise</param>
/// <param name="first">A bool indicating if this is the first Primitive added to this Node</param>
void AddPrimitive(
uint nodeIndex,
string meshName,
UnityEngine.Mesh mesh,
UnityEngine.Material[] materials,
int[] joints = null,
bool first = true
);
/// <summary>
/// Called for adding a glTF scene.
/// </summary>
/// <param name="name">Name of the scene</param>
/// <param name="nodeIndices">Indices of root level nodes in scene</param>
void AddScene(string name, uint[] nodeIndices);
}
}