From 6849bea21a3f7da36855821eaf95e99685a40381 Mon Sep 17 00:00:00 2001 From: hYdos Date: Sun, 1 Mar 2020 19:44:38 +1000 Subject: [PATCH] prepare for atlas texturing --- .../github/halotroop/litecraft/types/block/Block.java | 1 + .../halotroop/litecraft/types/block/Blocks.java | 5 +++++ .../litecraft/world/dimension/Dimensions.java | 1 + .../com/github/hydos/ginger/engine/utils/Loader.java | 11 ++++++++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Block.java b/src/main/java/com/github/halotroop/litecraft/types/block/Block.java index 0b5e564..63ab853 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Block.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Block.java @@ -64,6 +64,7 @@ public class Block this.identifier = properties.identifier; this.caveCarveThreshold = properties.caveCarveThreshold; IDENTIFIER_TO_BLOCK.put(this.identifier, this); + Blocks.blocks.add(this); } public static final Block getBlock(String identifier) diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java index d215f77..400ec4e 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/Blocks.java @@ -1,9 +1,14 @@ package com.github.halotroop.litecraft.types.block; +import java.util.*; + import com.github.halotroop.litecraft.types.block.Block.Properties; public final class Blocks { + + public static List blocks = new ArrayList(); + public static final Block AIR = new Block(new Properties("air").visible(false).fullCube(false)); public static final Block GRASS = new Block(new Properties("block/cubes/soil/grass/grass_top.png").caveCarveThreshold(0.04f)); public static final Block DIRT = new Block("block/cubes/soil/dirt.png", new Properties("dirt").caveCarveThreshold(0.04f)); diff --git a/src/main/java/com/github/halotroop/litecraft/world/dimension/Dimensions.java b/src/main/java/com/github/halotroop/litecraft/world/dimension/Dimensions.java index 4ce8887..87c9939 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/dimension/Dimensions.java +++ b/src/main/java/com/github/halotroop/litecraft/world/dimension/Dimensions.java @@ -1,6 +1,7 @@ package com.github.halotroop.litecraft.world.dimension; import com.github.halotroop.litecraft.world.gen.*; +import com.github.halotroop.litecraft.world.gen.modifier.CavesModifier; public final class Dimensions { diff --git a/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java b/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java index 4b46b09..e1417ac 100644 --- a/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java +++ b/src/main/java/com/github/hydos/ginger/engine/utils/Loader.java @@ -6,6 +6,7 @@ import java.util.*; import org.lwjgl.BufferUtils; import org.lwjgl.opengl.*; +import com.github.halotroop.litecraft.types.block.*; import com.github.hydos.ginger.engine.io.Window; import com.github.hydos.ginger.engine.render.models.RawModel; import com.github.hydos.ginger.engine.render.texture.*; @@ -104,7 +105,15 @@ public class Loader public static int loadTexture(String path) { return loadTextureDirectly("/textures/" + path); } - + + public int createBlockAtlas() + { + for(Block block: Blocks.blocks) { + + } + return 0; + } + public static int loadTextureDirectly(String path) { int textureID = GL11.glGenTextures();