Themed desktops

This commit is contained in:
Willem Cazander 2022-03-05 19:02:07 +01:00
parent 63c3053dac
commit 195b840fdc
5 changed files with 60 additions and 12 deletions

View file

@ -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<ModelInstance> modelInstances) {

View file

@ -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<ModelInstance> 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();
}
}

View file

@ -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<ModelInstance> 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();
}
}

View file

@ -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<ModelInstance> 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();
}
}

View file

@ -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));
}