Merge branch 'liteCraft' of https://github.com/halotroop/Ginger3D into liteCraft
|
@ -39,7 +39,7 @@ public class Litecraft extends Game
|
||||||
Window.create(1200, 800, "LiteCraft", 60);
|
Window.create(1200, 800, "LiteCraft", 60);
|
||||||
GingerUtils.init();
|
GingerUtils.init();
|
||||||
Window.setBackgroundColour(0.2f, 0.2f, 0.6f);
|
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/stonebrick.png");
|
||||||
StaticCube.scaleCube(1);
|
StaticCube.scaleCube(1);
|
||||||
Player player = new Player(dirtModel, new Vector3f(0, 0, -3), 0, 180f, 0, new Vector3f(0.2f, 0.2f, 0.2f));
|
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);
|
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 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
|
public static class Properties
|
||||||
{ // add properties to this builder!
|
{ // add properties to this builder!
|
||||||
private boolean visible = true;
|
private boolean visible = true;
|
||||||
private boolean fullCube = true;
|
private boolean fullCube = true;
|
||||||
|
|
||||||
public Properties visible(boolean visible)
|
|
||||||
{
|
|
||||||
this.visible = visible;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Properties fullCube(boolean fullCube)
|
public Properties fullCube(boolean fullCube)
|
||||||
{
|
{
|
||||||
this.fullCube = fullCube;
|
this.fullCube = fullCube;
|
||||||
|
@ -27,14 +25,20 @@ public class Block
|
||||||
|
|
||||||
public boolean isVisible()
|
public boolean isVisible()
|
||||||
{ return visible; }
|
{ return visible; }
|
||||||
|
|
||||||
|
public Properties visible(boolean visible)
|
||||||
|
{
|
||||||
|
this.visible = visible;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 final TexturedModel model;
|
public final TexturedModel model;
|
||||||
public final boolean visible;
|
public final boolean visible;
|
||||||
|
|
||||||
|
protected Block(Properties properties)
|
||||||
|
{ this((TexturedModel) null, properties); }
|
||||||
|
|
||||||
protected Block(String texture, Properties properties)
|
protected Block(String texture, Properties properties)
|
||||||
{ this(ModelLoader.loadGenericCube(texture), properties); }
|
{ this(ModelLoader.loadGenericCube(texture), properties); }
|
||||||
|
|
||||||
|
@ -43,7 +47,4 @@ public class Block
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.visible = properties.visible;
|
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)
|
public FirstPersonCamera(Player player)
|
||||||
{
|
{
|
||||||
super(player);
|
super(player);
|
||||||
|
player.isVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getPitch()
|
public float getPitch()
|
||||||
|
@ -35,6 +36,5 @@ public class FirstPersonCamera extends Camera
|
||||||
roll = player.getRotX();
|
roll = player.getRotX();
|
||||||
yaw = -player.getRotY() + 180;
|
yaw = -player.getRotY() + 180;
|
||||||
pitch = player.getRotZ();
|
pitch = player.getRotZ();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,7 @@ public class ModelLoader
|
||||||
|
|
||||||
public static TexturedModel loadModel(String objPath, String texturePath)
|
public static TexturedModel loadModel(String objPath, String texturePath)
|
||||||
{
|
{
|
||||||
Mesh data = OBJFileLoader.loadModel(objPath, texturePath);
|
Mesh data = OBJFileLoader.loadModel(objPath);
|
||||||
TexturedModel tm = new TexturedModel(Loader.loadToVAO(data.getVertices(), data.getIndices(), data.getNormals(), data.getTextureCoords()), new ModelTexture(texturePath));
|
return new TexturedModel(Loader.loadToVAO(data.getVertices(), data.getIndices(),data.getNormals(), data.getTextureCoords()), new ModelTexture(texturePath));
|
||||||
return tm;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@ import com.github.hydos.ginger.engine.math.vectors.*;
|
||||||
|
|
||||||
public class OBJFileLoader
|
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;
|
AIScene scene = null;
|
||||||
try
|
try
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class ModelTexture
|
||||||
|
|
||||||
public ModelTexture(String file)
|
public ModelTexture(String file)
|
||||||
{
|
{
|
||||||
|
// TODO: Add a missing texture placholder in case of null file.
|
||||||
texture = Image.createImage("/textures/" + file);
|
texture = Image.createImage("/textures/" + file);
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.textureID);
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.textureID);
|
||||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 10241, 9729.0f);
|
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 10241, 9729.0f);
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Made in Blockbench 3.3.1
|
||||||
|
newmtl 0
|
||||||
|
map_Kd textures/blocks/cubes/wood/planks/planks_oak.png
|
||||||
|
newmtl 1
|
||||||
|
map_Kd textures/blocks/cubes/wood/logs/side/log_oak.png
|
||||||
|
newmtl none
|
After Width: | Height: | Size: 625 B |
After Width: | Height: | Size: 786 B |
After Width: | Height: | Size: 698 B |
After Width: | Height: | Size: 810 B |
After Width: | Height: | Size: 763 B |
After Width: | Height: | Size: 769 B |
After Width: | Height: | Size: 857 B |
After Width: | Height: | Size: 767 B |
After Width: | Height: | Size: 829 B |
After Width: | Height: | Size: 794 B |
After Width: | Height: | Size: 795 B |
After Width: | Height: | Size: 859 B |
After Width: | Height: | Size: 780 B |
After Width: | Height: | Size: 765 B |
After Width: | Height: | Size: 850 B |
After Width: | Height: | Size: 792 B |
Before Width: | Height: | Size: 329 B |
Before Width: | Height: | Size: 584 B |
Before Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 557 B |
Before Width: | Height: | Size: 400 B |
Before Width: | Height: | Size: 590 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 411 B |
Before Width: | Height: | Size: 631 B |
Before Width: | Height: | Size: 412 B |
Before Width: | Height: | Size: 417 B |
Before Width: | Height: | Size: 664 B |
Before Width: | Height: | Size: 835 B |
Before Width: | Height: | Size: 566 B |
Before Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 726 B |
Before Width: | Height: | Size: 478 B After Width: | Height: | Size: 478 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 301 B |
Before Width: | Height: | Size: 281 B After Width: | Height: | Size: 281 B |
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 316 B After Width: | Height: | Size: 316 B |
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 614 B After Width: | Height: | Size: 614 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 232 B After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 303 B |
Before Width: | Height: | Size: 633 B After Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 608 B After Width: | Height: | Size: 608 B |
Before Width: | Height: | Size: 710 B After Width: | Height: | Size: 710 B |
Before Width: | Height: | Size: 726 B After Width: | Height: | Size: 726 B |
Before Width: | Height: | Size: 813 B After Width: | Height: | Size: 813 B |
Before Width: | Height: | Size: 690 B After Width: | Height: | Size: 690 B |
Before Width: | Height: | Size: 643 B After Width: | Height: | Size: 643 B |
Before Width: | Height: | Size: 665 B After Width: | Height: | Size: 665 B |
Before Width: | Height: | Size: 735 B After Width: | Height: | Size: 735 B |
Before Width: | Height: | Size: 960 B After Width: | Height: | Size: 960 B |
Before Width: | Height: | Size: 957 B After Width: | Height: | Size: 957 B |
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 333 B |
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 278 B |
|
@ -1,7 +0,0 @@
|
||||||
[LocalizedFileNames]
|
|
||||||
emerald_block.png=@emerald_block.png,0
|
|
||||||
lapis_block.png=@lapis_block.png,0
|
|
||||||
diamond_block.png=@diamond_block.png,0
|
|
||||||
iron_block.png=@iron_block.png,0
|
|
||||||
coal_block.png=@coal_block.png,0
|
|
||||||
gold_block.png=@gold_block.png,0
|
|
|
@ -1,8 +0,0 @@
|
||||||
[LocalizedFileNames]
|
|
||||||
emerald_ore.png=@emerald_ore.png,0
|
|
||||||
lapis_ore.png=@lapis_ore.png,0
|
|
||||||
diamond_ore.png=@diamond_ore.png,0
|
|
||||||
iron_ore.png=@iron_ore.png,0
|
|
||||||
coal_ore.png=@coal_ore.png,0
|
|
||||||
gold_ore.png=@gold_ore.png,0
|
|
||||||
quartz_ore.png=@quartz_ore.png,0
|
|
Before Width: | Height: | Size: 791 B After Width: | Height: | Size: 791 B |
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 724 B |
Before Width: | Height: | Size: 756 B After Width: | Height: | Size: 756 B |
Before Width: | Height: | Size: 418 B |