Skip to content

Commit c63a548

Browse files
committed
Add Draco glTF loading tests
1 parent 8f29f48 commit c63a548

1 file changed

Lines changed: 60 additions & 2 deletions

File tree

jme3-examples/src/main/java/jme3test/model/TestGltfLoading.java

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.jme3.scene.control.Control;
4646
import com.jme3.scene.debug.custom.ArmatureDebugAppState;
4747
import com.jme3.scene.plugins.gltf.GltfModelKey;
48+
4849
import jme3test.model.anim.EraseTimer;
4950

5051
import java.util.*;
@@ -134,8 +135,65 @@ public void simpleInitApp() {
134135
//loadModel("Models/gltf/crab/scene.gltf", Vector3f.ZERO, 1);
135136
//loadModel("Models/gltf/manta/scene.gltf", Vector3f.ZERO, 0.2f);
136137
//loadModel("Models/gltf/bone/scene.gltf", Vector3f.ZERO, 0.1f);
137-
// loadModel("Models/gltf/box/box.gltf", Vector3f.ZERO, 1);
138-
loadModel("Models/gltf/duck/Duck.gltf", new Vector3f(0, 1, 0), 1);
138+
//loadModel("Models/gltf/box/box.gltf", Vector3f.ZERO, 1);
139+
//loadModel("Models/gltf/duck/Duck.gltf", new Vector3f(0, 1, 0), 1);
140+
141+
142+
// ===================================================================
143+
// TODO_DRACO Draco test start
144+
// The following test assumes that the "Models" directory from
145+
// https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models
146+
// is copied into the
147+
// jme3-testdata\src\main\resources\Models\gltf\
148+
// directory (or at least the following list of models)
149+
150+
// Comment in/out the model to test
151+
String dracoTestModel = null;
152+
//dracoTestModel = "Avocado";
153+
//dracoTestModel = "BarramundiFish";
154+
dracoTestModel = "BoomBox";
155+
//dracoTestModel = "BrainStem";
156+
//dracoTestModel = "CesiumMan";
157+
//dracoTestModel = "CesiumMilkTruck";
158+
//dracoTestModel = "Corset";
159+
//dracoTestModel = "Lantern";
160+
//dracoTestModel = "MorphPrimitivesTest";
161+
//dracoTestModel = "RiggedFigure";
162+
//dracoTestModel = "RiggedSimple";
163+
//dracoTestModel = "SunglassesKhronos";
164+
//dracoTestModel = "VirtualCity";
165+
//dracoTestModel = "WaterBottle";
166+
167+
boolean testDraco = true;
168+
// Uncomment this to not load the Draco-compressed
169+
// version, but the glTF-Binary version of the model
170+
//testDraco = false;
171+
String dracoTestFlavor = null;
172+
String dracoTestExtension = null;
173+
if (testDraco)
174+
{
175+
dracoTestFlavor = "glTF-Draco";
176+
dracoTestExtension = "gltf";
177+
}
178+
else
179+
{
180+
dracoTestFlavor = "glTF-Binary";
181+
dracoTestExtension = "glb";
182+
}
183+
// Assemble a path like
184+
// "Models/gltf/Models/BoomBox/glTF-Draco/BoomBox.gltf"
185+
String dracoTestPath = "Models/gltf/Models/" + dracoTestModel + "/" + dracoTestFlavor + "/" + dracoTestModel + "." + dracoTestExtension;
186+
187+
System.out.println("Running Draco test with "+dracoTestPath);
188+
loadModel(dracoTestPath, new Vector3f(0, 0, 0), 20.0f);
189+
190+
// TODO_DRACO Draco test end
191+
// ===================================================================
192+
193+
194+
//loadModel("Models/gltf/BoomBox/glTF-Draco/BoomBox.gltf", new Vector3f(0, 0, 0), 20);
195+
//loadModel("Models/gltf/BoomBox/glTF-Binary/BoomBox.glb", new Vector3f(0, 0, 0), 1);
196+
139197
// loadModel("Models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf", Vector3f.ZERO, 1);
140198
// loadModel("Models/gltf/hornet/scene.gltf", new Vector3f(0, -0.5f, 0), 0.4f);
141199
//// loadModel("Models/gltf/adamHead/adamHead.gltf", Vector3f.ZERO, 0.6f);

0 commit comments

Comments
 (0)