|
@@ -1,12 +1,12 @@
|
|
|
-# glTF2 Sharp
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
#### Development
|
|
#### Development
|
|
|
|
|
|
|
|
The bulk of the code is generated from the schema using the SharpGLTF.CodeGen tools.
|
|
The bulk of the code is generated from the schema using the SharpGLTF.CodeGen tools.
|
|
|
|
|
|
|
|
All generated classes are declared by default as non public, and its fields private.
|
|
All generated classes are declared by default as non public, and its fields private.
|
|
|
-The public API functionality is provided with hand coded partial classes. Since this
|
|
|
|
|
-is a work in progress, not all the features might be publicly available yet.
|
|
|
|
|
|
|
+The public API functionality is provided with hand coded partial classes.
|
|
|
|
|
+
|
|
|
|
|
+Since this is a work in progress, not all the features might be publicly available yet.
|
|
|
|
|
|
|
|
Internally, the ModelRoot object store almost all the model elements in plain lists,
|
|
Internally, the ModelRoot object store almost all the model elements in plain lists,
|
|
|
and cross referencing is done by integer indices. The public API implentation tries
|
|
and cross referencing is done by integer indices. The public API implentation tries
|
|
@@ -25,6 +25,15 @@ var model = Schema2.ModelRoot.Load("model.gltf");
|
|
|
Loading a gltf and saving it as glb:
|
|
Loading a gltf and saving it as glb:
|
|
|
```c#
|
|
```c#
|
|
|
var model = Schema2.ModelRoot.Load("model.gltf");
|
|
var model = Schema2.ModelRoot.Load("model.gltf");
|
|
|
-model.MergeBuffers(); // this is required since glb only supports a single binary buffer.
|
|
|
|
|
|
|
+model.MergeBuffers(); // ensure there's only one buffer, which is required by GLB
|
|
|
model.SaveGLB("model.glb");
|
|
model.SaveGLB("model.glb");
|
|
|
```
|
|
```
|
|
|
|
|
+
|
|
|
|
|
+Creating a new gltf model:
|
|
|
|
|
+```c#
|
|
|
|
|
+var model = ModelRoot.CreateModel();
|
|
|
|
|
+var scene = model.UseScene("Default Scene");
|
|
|
|
|
+var node = scene.AddVisualNode("Node1");
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+
|