Other stuff
parent
d08a17bf83
commit
662fd9a8ef
|
@ -36,7 +36,7 @@ public class Litecraft extends Game
|
|||
Window.create(1200, 800, "LiteCraft", 60);
|
||||
GingerUtils.init();
|
||||
Window.setBackgroundColour(0.2f, 0.2f, 0.6f);
|
||||
TexturedModel dirtModel = ModelLoader.loadGenericCube("block/cubes/soil/gravel.png");
|
||||
TexturedModel dirtModel = ModelLoader.loadGenericCube("block/cubes/stone/brick/brick.png");
|
||||
StaticCube.scaleCube(1);
|
||||
Player player = new Player(dirtModel, new Vector3f(0, 0, -3), 0, 180f, 0, new Vector3f(0.2f, 0.2f, 0.2f));
|
||||
Camera camera = new Camera(new Vector3f(0, 0.1f, 0), player);
|
||||
|
|
|
@ -5,17 +5,15 @@ import com.github.hydos.ginger.engine.render.models.TexturedModel;
|
|||
|
||||
public class Block
|
||||
{
|
||||
public static final Block AIR = new Block(new Properties().visible(false));
|
||||
public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties());
|
||||
public static final Block STONE = new Block("block/cubes/stone/basic/gneiss.png", new Properties());
|
||||
|
||||
public static class Properties
|
||||
{ // add properties to this builder!
|
||||
private boolean visible = true;
|
||||
private boolean fullCube = true;
|
||||
|
||||
public Properties visible(boolean visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Properties fullCube(boolean fullCube)
|
||||
{
|
||||
this.fullCube = fullCube;
|
||||
|
@ -27,14 +25,20 @@ public class Block
|
|||
|
||||
public boolean isVisible()
|
||||
{ return visible; }
|
||||
}
|
||||
|
||||
public static final Block AIR = new Block(new Properties().visible(false));
|
||||
public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties());
|
||||
public static final Block STONE = new Block("block/cubes/stone/cobblestone.png", new Properties());
|
||||
public Properties visible(boolean visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public final TexturedModel model;
|
||||
public final boolean visible;
|
||||
|
||||
protected Block(Properties properties)
|
||||
{ this((TexturedModel) null, properties); }
|
||||
|
||||
protected Block(String texture, Properties properties)
|
||||
{ this(ModelLoader.loadGenericCube(texture), properties); }
|
||||
|
||||
|
@ -43,7 +47,4 @@ public class Block
|
|||
this.model = model;
|
||||
this.visible = properties.visible;
|
||||
}
|
||||
|
||||
protected Block(Properties properties)
|
||||
{ this((TexturedModel) null, properties); }
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ public class FirstPersonCamera extends Camera
|
|||
public FirstPersonCamera(Player player)
|
||||
{
|
||||
super(player);
|
||||
player.isVisible = false;
|
||||
}
|
||||
|
||||
public float getPitch()
|
||||
|
@ -35,6 +36,5 @@ public class FirstPersonCamera extends Camera
|
|||
roll = player.getRotX();
|
||||
yaw = -player.getRotY() + 180;
|
||||
pitch = player.getRotZ();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,7 @@ public class ModelLoader
|
|||
|
||||
public static TexturedModel loadModel(String objPath, String texturePath)
|
||||
{
|
||||
Mesh data = OBJFileLoader.loadModel(objPath, texturePath);
|
||||
TexturedModel tm = new TexturedModel(Loader.loadToVAO(data.getVertices(), data.getIndices(), data.getNormals(), data.getTextureCoords()), new ModelTexture(texturePath));
|
||||
return tm;
|
||||
Mesh data = OBJFileLoader.loadModel(objPath);
|
||||
return new TexturedModel(Loader.loadToVAO(data.getVertices(), data.getIndices(),data.getNormals(), data.getTextureCoords()), new ModelTexture(texturePath));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ import com.github.hydos.ginger.engine.math.vectors.*;
|
|||
|
||||
public class OBJFileLoader
|
||||
{
|
||||
public static String resourceLocation = "C:/Users/Hayden/Desktop/Ginger3D/src/main/resources/models/";
|
||||
public static String resourceLocation = "~/Desktop/Ginger3D/src/main/resources/models/";
|
||||
|
||||
public static Mesh loadModel(String filePath, String texturePath)
|
||||
public static Mesh loadModel(String filePath)
|
||||
{
|
||||
AIScene scene = null;
|
||||
try
|
||||
|
|
|
@ -24,6 +24,7 @@ public class ModelTexture
|
|||
|
||||
public ModelTexture(String file)
|
||||
{
|
||||
// TODO: Add a missing texture placholder in case of null file.
|
||||
texture = Image.createImage("/textures/" + file);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.textureID);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 10241, 9729.0f);
|
||||
|
|
Loading…
Reference in New Issue