-
Notifications
You must be signed in to change notification settings - Fork 22
Runtime usage
Zsuró Tibor edited this page Oct 20, 2022
·
17 revisions
To use this library in your gradle project, add the version number and jitpack repository information to your root build.gradle
file:
allprojects {
ext {
...
mundusVersion = 'v0.4.0'
gltfVersion = '2.0.0-rc.1' // Only needed if targeting HTML, version should match what Mundus uses
}
repositories {
...
maven { url 'https://jitpack.io' }
}
}
And add the dependency in your core project:
project(":core") {
...
dependencies {
...
api "com.github.jamestkhan.mundus:gdx-runtime:$mundusVersion"
}
}
If you are targeting HTML you will also need the following:
project(":html") {
...
dependencies {
...
api "com.github.jamestkhan.mundus:gdx-runtime:$mundusVersion:sources"
api "com.github.jamestkhan.mundus:commons:$mundusVersion:sources"
api "com.github.mgsx-dev.gdx-gltf:gltf:$gltfVersion:sources"
}
}
Copy your mundus project into your core/assets/mundus
directory.
public class LibGDXMundusExample extends ApplicationAdapter {
private Mundus mundus;
private Scene scene;
private FirstPersonCameraController controller;
@Override
public void create () {
mundus = new Mundus(Gdx.files.internal("mundus"));
scene = mundus.loadScene("Main Scene.mundus");
scene.cam.position.set(230, 150, 190);
scene.cam.direction.rotate(Vector3.Y, 70);
scene.cam.direction.rotate(Vector3.Z, -20);
controller = new FirstPersonCameraController(scene.cam);
controller.setVelocity(200f);
Gdx.input.setInputProcessor(controller);
}
@Override
public void render () {
ScreenUtils.clear(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
controller.update();
scene.sceneGraph.update();
scene.render();
}
@Override
public void dispose () {
mundus.dispose();
}
}