diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java index 426e53c7..e66bb168 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java @@ -75,7 +75,7 @@ public abstract class AbstractScreenDesktop extends ScreenAdapter implements Des modelBatch = new ModelBatch(); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); - cam.position.set(10f, 10f, 10f); + cam.position.set(-20f, 30f, 0f); cam.lookAt(0, 0, 0); cam.near = 1f; cam.far = 300f; @@ -149,8 +149,6 @@ public abstract class AbstractScreenDesktop extends ScreenAdapter implements Des ImGui.render(); ImGuiSetup.imGuiGlImp.renderDrawData(ImGui.getDrawData()); - //Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()); - //Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); } protected void renderDesktop(float delta, ModelBatch modelBatch, PerspectiveCamera cam, Array modelInstances) { diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop1.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop1.java index 18997a90..403b9f6b 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop1.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop1.java @@ -1,10 +1,15 @@ package love.distributedrebirth.gdxapp4d.vrgem4.screen; -import com.badlogic.gdx.graphics.VertexAttributes.Usage; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.VertexAttributes; import com.badlogic.gdx.graphics.g3d.Material; import com.badlogic.gdx.graphics.g3d.Model; import com.badlogic.gdx.graphics.g3d.ModelInstance; import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; +import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute; +import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder; import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; import com.badlogic.gdx.utils.Array; @@ -14,20 +19,32 @@ import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class ScreenDesktop1 extends AbstractScreenDesktop { + private Texture backgroundImage; + private Model background; private Model grid; public ScreenDesktop1(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) { super("Desktop1", bootArgs, deskAppService); - //backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-front.png")); + } protected void createModel(ModelBuilder modelBuilder, Array modelInstances) { - grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(1f,1f,1f,.1f)), Usage.Position | Usage.Normal); + backgroundImage = new Texture(Gdx.files.internal("background/temple-os.png")); + int attr = VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates; + Material material = new Material(TextureAttribute.createDiffuse(backgroundImage)); + modelBuilder.begin(); + MeshPartBuilder mpb = modelBuilder.part("floor", GL20.GL_TRIANGLES, attr, material); + mpb.rect(-20f,-1f,-20f, -20f,-1f,20f, 20f,-1f,20f, 20f,-1f,-20f, 0,1,0); + background = modelBuilder.end(); + grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(.2f,.2f,.2f,1f)), VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal); + modelInstances.add(new ModelInstance(background, 0, 0, 0)); modelInstances.add(new ModelInstance(grid, 0, 0, 0)); } @Override protected void disposeDesktop() { + backgroundImage.dispose(); + background.dispose(); grid.dispose(); } } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop2.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop2.java index 8ccd3850..cae569b7 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop2.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop2.java @@ -1,10 +1,15 @@ package love.distributedrebirth.gdxapp4d.vrgem4.screen; -import com.badlogic.gdx.graphics.VertexAttributes.Usage; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.VertexAttributes; import com.badlogic.gdx.graphics.g3d.Material; import com.badlogic.gdx.graphics.g3d.Model; import com.badlogic.gdx.graphics.g3d.ModelInstance; import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; +import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute; +import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder; import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; import com.badlogic.gdx.utils.Array; @@ -14,20 +19,31 @@ import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class ScreenDesktop2 extends AbstractScreenDesktop { + private Texture backgroundImage; + private Model background; private Model grid; public ScreenDesktop2(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) { super("Desktop2", bootArgs, deskAppService); - //backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-nose.png")); } protected void createModel(ModelBuilder modelBuilder, Array modelInstances) { - grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(1f,1f,1f,.1f)), Usage.Position | Usage.Normal); + backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-front.png")); + int attr = VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates; + Material material = new Material(TextureAttribute.createDiffuse(backgroundImage)); + modelBuilder.begin(); + MeshPartBuilder mpb = modelBuilder.part("floor", GL20.GL_TRIANGLES, attr, material); + mpb.rect(-20f,-1f,-20f, -20f,-1f,20f, 20f,-1f,20f, 20f,-1f,-20f, 0,1,0); + background = modelBuilder.end(); + grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(.1f,.1f,.1f,1f)), VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal); + modelInstances.add(new ModelInstance(background, 0, 0, 0)); modelInstances.add(new ModelInstance(grid, 0, 0, 0)); } @Override protected void disposeDesktop() { + backgroundImage.dispose(); + background.dispose(); grid.dispose(); } } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop3.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop3.java index 64f39e07..bbcc03e4 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop3.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop3.java @@ -1,10 +1,15 @@ package love.distributedrebirth.gdxapp4d.vrgem4.screen; -import com.badlogic.gdx.graphics.VertexAttributes.Usage; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.VertexAttributes; import com.badlogic.gdx.graphics.g3d.Material; import com.badlogic.gdx.graphics.g3d.Model; import com.badlogic.gdx.graphics.g3d.ModelInstance; import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; +import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute; +import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder; import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; import com.badlogic.gdx.utils.Array; @@ -14,6 +19,8 @@ import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class ScreenDesktop3 extends AbstractScreenDesktop { + private Texture backgroundImage; + private Model background; private Model grid; public ScreenDesktop3(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) { @@ -21,12 +28,22 @@ public class ScreenDesktop3 extends AbstractScreenDesktop { } protected void createModel(ModelBuilder modelBuilder, Array modelInstances) { - grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(1f,1f,1f,.1f)), Usage.Position | Usage.Normal); + backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-nose.png")); + int attr = VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates; + Material material = new Material(TextureAttribute.createDiffuse(backgroundImage)); + modelBuilder.begin(); + MeshPartBuilder mpb = modelBuilder.part("floor", GL20.GL_TRIANGLES, attr, material); + mpb.rect(-20f,-1f,-20f, -20f,-1f,20f, 20f,-1f,20f, 20f,-1f,-20f, 0,1,0); + background = modelBuilder.end(); + grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(.1f,.1f,.1f,1f)), VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal); + modelInstances.add(new ModelInstance(background, 0, 0, 0)); modelInstances.add(new ModelInstance(grid, 0, 0, 0)); } @Override protected void disposeDesktop() { + backgroundImage.dispose(); + background.dispose(); grid.dispose(); } } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop4.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop4.java index 38781488..d9aca506 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop4.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/ScreenDesktop4.java @@ -55,7 +55,7 @@ public class ScreenDesktop4 extends AbstractScreenDesktop { } } } - grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(1f,1f,1f,.1f)), Usage.Position | Usage.Normal); + grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(.2f,.2f,.2f,1f)), Usage.Position | Usage.Normal); modelInstances.add(new ModelInstance(grid, 0, 0, 0)); }