-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Depreciation of Ogre Loader #2713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,7 @@ public static void main(String[] args) { | |
|
|
||
| @Override | ||
| public void simpleInitApp() { | ||
| Node tank = (Node) assetManager.loadModel("Models/HoverTank/Tank2.mesh.xml"); | ||
| Node tank = (Node) assetManager.loadModel("Models/HoverTank/Tank2.gltf"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switching to the glTF format for the tank model will cause a References
|
||
|
|
||
| flyCam.setEnabled(false); | ||
| ChaseCamera chaseCam = new ChaseCamera(cam, tank, inputManager); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,8 +68,8 @@ public void simpleInitApp() { | |
| floor.setMaterial(mat); | ||
| rootNode.attachChild(floor); | ||
|
|
||
| Node teapotNode = (Node) assetManager.loadModel("Models/Teapot/Teapot.mesh.xml"); | ||
| Geometry teapot = (Geometry) teapotNode.getChild(0); | ||
| Node teapotNode = (Node) assetManager.loadModel("Models/Teapot/Teapot.gltf"); | ||
| Geometry teapot = findFirstGeometry(teapotNode); | ||
| teapot.setMaterial(mat); | ||
| // Sphere sph = new Sphere(16, 16, 4); | ||
| // Geometry teapot = new Geometry("teapot", sph); | ||
|
|
@@ -113,4 +113,24 @@ public void simpleInitApp() { | |
| @Override | ||
| public void simpleUpdate(float tpf) { | ||
| } | ||
|
|
||
| /** | ||
| * Recursively finds the first Geometry in a spatial hierarchy. | ||
| * Handles both simple flat structures and complex nested node trees. | ||
| */ | ||
| private Geometry findFirstGeometry(com.jme3.scene.Spatial spatial) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if (spatial instanceof Geometry) { | ||
| return (Geometry) spatial; | ||
| } | ||
| if (spatial instanceof Node) { | ||
| Node node = (Node) spatial; | ||
| for (com.jme3.scene.Spatial child : node.getChildren()) { | ||
| Geometry geom = findFirstGeometry(child); | ||
| if (geom != null) { | ||
| return geom; | ||
| } | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ public void simpleInitApp() { | |
| dl.setDirection(new Vector3f(-1,-1,-1).normalizeLocal()); | ||
| rootNode.addLight(dl); | ||
|
|
||
| Node teapotNode = (Node) assetManager.loadModel("Models/Teapot/Teapot.mesh.xml"); | ||
| Node teapotNode = (Node) assetManager.loadModel("Models/Teapot/Teapot.gltf"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switching to the glTF format for the teapot model will cause a References
|
||
| Geometry teapot = (Geometry) teapotNode.getChild(0); | ||
|
NwosuTy marked this conversation as resolved.
|
||
|
|
||
| // Sphere sph = new Sphere(16, 16, 4); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,13 +55,13 @@ public void simpleInitApp() { | |
| Node scene = new Node("Scene"); | ||
| Spatial obj1 = assetManager.loadModel("Models/Ferrari/Car.scene"); | ||
| obj1.setLocalTranslation(-4, 0, 0); | ||
| Spatial obj2 = assetManager.loadModel("Models/Oto/Oto.mesh.xml"); | ||
| Spatial obj2 = assetManager.loadModel("Models/Elephant/Elephant.gltf"); | ||
| obj2.setLocalTranslation(-2, 0, 0); | ||
| Spatial obj3 = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml"); | ||
| Spatial obj3 = assetManager.loadModel("Models/Ninja/Ninja.gltf"); | ||
| obj3.setLocalTranslation(-0, 0, 0); | ||
| Spatial obj4 = assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml"); | ||
| Spatial obj4 = assetManager.loadModel("Models/Sinbad/Sword.gltf"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replacing the Sinbad character model with just his sword significantly reduces the complexity of this texture atlas test. If the full Sinbad character model is not available in glTF, consider using another character model (like |
||
| obj4.setLocalTranslation(2, 0, 0); | ||
| Spatial obj5 = assetManager.loadModel("Models/Tree/Tree.mesh.j3o"); | ||
| Spatial obj5 = assetManager.loadModel("Models/Tree/Tree.gltf"); | ||
| obj5.setLocalTranslation(4, 0, 0); | ||
| scene.attachChild(obj1); | ||
| scene.attachChild(obj2); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.