--- /dev/null
+{\r
+ "version": [ 0, 1], \r
+ "id": "", \r
+ "meshes": [\r
+ {\r
+ "attributes": ["POSITION", "NORMAL"], \r
+ "vertices": [\r
+ -1.000000, -1.000000, -1.000000, -0.577349, -0.577349, -0.577349, \r
+ 1.000000, 1.000000, -1.000000, 0.577349, 0.577349, -0.577349, \r
+ 1.000000, -1.000000, -1.000000, 0.577349, -0.577349, -0.577349, \r
+ -1.000000, 1.000000, -1.000000, -0.577349, 0.577349, -0.577349, \r
+ -1.000000, 1.000000, 1.000000, -0.577349, 0.577349, 0.577349, \r
+ -1.000000, -1.000000, 1.000000, -0.577349, -0.577349, 0.577349, \r
+ 1.000000, 0.999999, 1.000000, 0.577349, 0.577349, 0.577349, \r
+ 0.999999, -1.000001, 1.000000, 0.577349, -0.577349, 0.577349\r
+ ], \r
+ "parts": [\r
+ {\r
+ "id": "mpart1", \r
+ "type": "TRIANGLES", \r
+ "indices": [\r
+ 0, 1, 2, 1, 0, 3, 4, 5, 6, 6, 5, 7, \r
+ 6, 2, 1, 2, 6, 7, 7, 0, 2, 0, 7, 5, \r
+ 4, 0, 5, 0, 4, 3, 4, 6, 3, 6, 1, 3\r
+ ]\r
+ }\r
+ ]\r
+ }\r
+ ], \r
+ "materials": [\r
+ {"id": "unnamed", \r
+ "diffuse": [ 0.800000, 0.800000, 0.800000], \r
+ "emissive": [ 0.800000, 0.800000, 0.800000], \r
+ "specular": [ 0.800000, 0.800000, 0.800000]}, \r
+ {"id": "Material", \r
+ "diffuse": [ 0.800000, 0.800000, 0.800000], \r
+ "emissive": [ 0.800000, 0.800000, 0.800000],\r
+ "textures": [\r
+ {\r
+ "id": "Knight_png", \r
+ "filename": "Knight.png", \r
+ "type": "DIFFUSE"\r
+ },\r
+ {\r
+ "id": "checkerboard", \r
+ "filename": "checkboard.png", \r
+ "type": "DIFFUSE"\r
+ }\r
+ ]}\r
+ ], \r
+ "nodes": [\r
+ {"id": "Cube", \r
+ "rotation": [-0.707107, 0.000000, 0.000000, 0.707107], \r
+ "scale": [ 1.000000, 1.000000, 1.000000], \r
+ "parts": [\r
+ {"meshpartid": "mpart1", \r
+ "materialid": "Material"}\r
+ ]\r
+ }\r
+ ], \r
+ "animations": [\r
+ {\r
+ "id": "Default Take", \r
+ "bones": []\r
+ }\r
+ ]\r
+}
\ No newline at end of file
import com.badlogic.gdx.graphics.OrthographicCamera;\r
import com.badlogic.gdx.math.Vector2;\r
import com.badlogic.gdx.scenes.scene2d.Stage;\r
+import com.badlogic.gdx.tests.g3d.ModelLoaderTest;\r
import com.badlogic.gdx.tests.utils.GdxTest;\r
\r
public class LwjglDebugStarter {\r
// new SharedLibraryLoader("../../extensions/gdx-controllers/gdx-controllers-desktop/libs/gdx-controllers-desktop-natives.jar").load("gdx-controllers-desktop");\r
// new SharedLibraryLoader("../../gdx/libs/gdx-natives.jar").load("gdx");\r
\r
- GdxTest test = new GdxTest() {\r
- OrthographicCamera camera;\r
- Stage stage;\r
-\r
- @Override\r
- public void create () {\r
- camera = new OrthographicCamera(600, 600);\r
- stage = new Stage(600, 600, false);\r
- Vector2 screenposition = new Vector2(100,100);\r
- System.out.println(screenposition);\r
- Vector2 stageposition = stage.screenToStageCoordinates(screenposition);\r
- System.out.println(stageposition);\r
- screenposition = stage.stageToScreenCoordinates(stageposition);\r
- System.out.println(screenposition);\r
- }\r
-\r
- };\r
+ GdxTest test = new ModelLoaderTest();\r
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();\r
config.useGL20 = test.needsGL20();\r
- config.width = 600;\r
- config.height = 600;\r
+ config.width = 480;\r
+ config.height = 320;\r
new LwjglApplication(test, config);\r
}\r
}\r
--- /dev/null
+package com.badlogic.gdx.tests.g3d;
+
+import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.assets.AssetManager;
+import com.badlogic.gdx.graphics.GL20;
+import com.badlogic.gdx.graphics.PerspectiveCamera;
+import com.badlogic.gdx.graphics.g3d.Model;
+import com.badlogic.gdx.graphics.g3d.ModelBatch;
+import com.badlogic.gdx.graphics.g3d.ModelInstance;
+import com.badlogic.gdx.tests.utils.GdxTest;
+
+public class ModelLoaderTest extends GdxTest {
+ AssetManager assets;
+ PerspectiveCamera camera;
+ ModelBatch batch;
+ Model model;
+ ModelInstance instance;
+
+ @Override
+ public void create () {
+ camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
+ camera.position.set(0, 0, 5);
+ camera.near = 1;
+ camera.far = 100;
+ camera.update();
+ assets = new AssetManager();
+ assets.load("data/g3d/cube.g3dj", Model.class);
+ assets.finishLoading();
+ model = assets.get("data/g3d/cube.g3dj", Model.class);
+ instance = new ModelInstance(model);
+ batch = new ModelBatch();
+ }
+
+ @Override
+ public boolean needsGL20 () {
+ return true;
+ }
+
+ @Override
+ public void render () {
+ Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
+ Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
+
+ batch.begin(camera);
+ batch.render(instance);
+ batch.end();
+ }
+
+ @Override
+ public void dispose () {
+ assets.dispose();
+ batch.dispose();
+ }
+}