Merge branch 'liteCraft' of https://github.com/halotroop/Ginger3D into liteCraft

pull/12/head
hYdos 2020-02-26 16:43:55 +10:00
commit d8eb6d4df5
297 changed files with 1911 additions and 63 deletions

View File

@ -39,7 +39,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/stonebrick.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);

View File

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

View File

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

View File

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

View File

@ -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

View File

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

File diff suppressed because one or more lines are too long

View File

@ -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

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 726 B

View File

Before

Width:  |  Height:  |  Size: 478 B

After

Width:  |  Height:  |  Size: 478 B

View File

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 257 B

View File

Before

Width:  |  Height:  |  Size: 301 B

After

Width:  |  Height:  |  Size: 301 B

View File

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 281 B

View File

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 278 B

View File

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

View File

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

View File

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 268 B

View File

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 310 B

View File

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 316 B

View File

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 296 B

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View File

Before

Width:  |  Height:  |  Size: 303 B

After

Width:  |  Height:  |  Size: 303 B

View File

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

View File

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

View File

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

View File

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 381 B

View File

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 608 B

View File

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 710 B

View File

Before

Width:  |  Height:  |  Size: 726 B

After

Width:  |  Height:  |  Size: 726 B

View File

Before

Width:  |  Height:  |  Size: 813 B

After

Width:  |  Height:  |  Size: 813 B

View File

Before

Width:  |  Height:  |  Size: 690 B

After

Width:  |  Height:  |  Size: 690 B

View File

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

View File

Before

Width:  |  Height:  |  Size: 665 B

After

Width:  |  Height:  |  Size: 665 B

View File

Before

Width:  |  Height:  |  Size: 735 B

After

Width:  |  Height:  |  Size: 735 B

View File

Before

Width:  |  Height:  |  Size: 960 B

After

Width:  |  Height:  |  Size: 960 B

View File

Before

Width:  |  Height:  |  Size: 957 B

After

Width:  |  Height:  |  Size: 957 B

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View File

Before

Width:  |  Height:  |  Size: 333 B

After

Width:  |  Height:  |  Size: 333 B

View File

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 297 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

View File

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 278 B

View File

@ -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

View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 791 B

After

Width:  |  Height:  |  Size: 791 B

View File

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 712 B

View File

Before

Width:  |  Height:  |  Size: 724 B

After

Width:  |  Height:  |  Size: 724 B

View File

Before

Width:  |  Height:  |  Size: 756 B

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

Some files were not shown because too many files have changed in this diff Show More