From f4a4f8de1ceb5ea35acaf584a798059eb6254ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsur=C3=B3=20Tibor?= Date: Thu, 19 May 2022 18:55:40 +0000 Subject: [PATCH] Refactored runtime's Mundus --- .../com/mbrlabs/mundus/runtime/Mundus.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/gdx-runtime/src/com/mbrlabs/mundus/runtime/Mundus.java b/gdx-runtime/src/com/mbrlabs/mundus/runtime/Mundus.java index fab26d827..3215bdb03 100644 --- a/gdx-runtime/src/com/mbrlabs/mundus/runtime/Mundus.java +++ b/gdx-runtime/src/com/mbrlabs/mundus/runtime/Mundus.java @@ -18,9 +18,11 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; +import com.badlogic.gdx.graphics.g3d.ModelBatch; import com.badlogic.gdx.utils.Disposable; import com.mbrlabs.mundus.commons.Scene; import com.mbrlabs.mundus.commons.assets.AssetManager; +import com.mbrlabs.mundus.commons.shaders.ModelShader; /** * @author Marcus Brummer @@ -42,15 +44,8 @@ public Mundus(final FileHandle mundusRoot) { this.root = mundusRoot; this.assetManager = new AssetManager(root.child(PROJECT_ASSETS_DIR)); this.sceneLoader = new SceneLoader(this, root.child(PROJECT_SCENES_DIR)); - } - public void init() { - try { - assetManager.loadAssets(null, true); - shaders = new Shaders(); - } catch (Exception e) { - Gdx.app.log(TAG, e.getMessage()); - } + init(); } public AssetManager getAssetManager() { @@ -61,8 +56,11 @@ public Shaders getShaders() { return shaders; } - public Scene loadScene(final String name) { - return sceneLoader.load(name); + public Scene loadScene(final String name, final ModelBatch batch) { + final Scene scene = sceneLoader.load(name); + scene.batch = batch; + + return scene; } @Override @@ -70,4 +68,13 @@ public void dispose() { assetManager.dispose(); } + private void init() { + try { + assetManager.loadAssets(null, true); + shaders = new Shaders(); + } catch (Exception e) { + Gdx.app.log(TAG, e.getMessage()); + } + } + }