diff --git a/src/main/java/com/github/halotroop/litecraft/Litecraft.java b/src/main/java/com/github/halotroop/litecraft/Litecraft.java index 5b0c748..f28a56e 100644 --- a/src/main/java/com/github/halotroop/litecraft/Litecraft.java +++ b/src/main/java/com/github/halotroop/litecraft/Litecraft.java @@ -7,18 +7,19 @@ import com.github.halotroop.litecraft.screens.*; import com.github.halotroop.litecraft.types.block.Blocks; import com.github.halotroop.litecraft.util.RelativeDirection; import com.github.halotroop.litecraft.world.World; -import com.github.hydos.ginger.engine.openGL.Constants; +import com.github.hydos.ginger.engine.common.Constants; +import com.github.hydos.ginger.engine.common.api.GingerRegister; +import com.github.hydos.ginger.engine.common.api.game.*; +import com.github.hydos.ginger.engine.common.cameras.*; +import com.github.hydos.ginger.engine.common.elements.objects.*; +import com.github.hydos.ginger.engine.common.io.Window; +import com.github.hydos.ginger.engine.common.obj.ModelLoader; +import com.github.hydos.ginger.engine.common.obj.shapes.StaticCube; import com.github.hydos.ginger.engine.openGL.api.*; -import com.github.hydos.ginger.engine.openGL.api.game.*; -import com.github.hydos.ginger.engine.openGL.cameras.*; -import com.github.hydos.ginger.engine.openGL.elements.objects.*; import com.github.hydos.ginger.engine.openGL.font.FontType; -import com.github.hydos.ginger.engine.openGL.io.Window; -import com.github.hydos.ginger.engine.openGL.obj.ModelLoader; -import com.github.hydos.ginger.engine.openGL.obj.shapes.StaticCube; import com.github.hydos.ginger.engine.openGL.render.MasterRenderer; import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; -import com.github.hydos.ginger.engine.openGL.utils.Loader; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; import tk.valoeghese.gateways.client.io.*; @@ -27,7 +28,7 @@ public class Litecraft extends Game private static Litecraft INSTANCE; private World world; private LitecraftSave save; - private Ginger engine; + private GingerGL engine; public Player player; private Camera camera; public int fps, ups, tps; @@ -119,8 +120,8 @@ public class Litecraft extends Game TexturedModel playerModel = ModelLoader.loadGenericCube("block/cubes/stone/brick/stonebrick.png"); StaticCube.scaleCube(1f); Light sun = new Light(new Vector3f(0, 105, 0), new Vector3f(0.9765625f, 0.98828125f, 0.05859375f), new Vector3f(0.002f, 0.002f, 0.002f)); - FontType font = new FontType(Loader.loadFontAtlas("candara.png"), "candara.fnt"); - this.engine = new Ginger(); + FontType font = new FontType(GlLoader.loadFontAtlas("candara.png"), "candara.fnt"); + this.engine = new GingerGL(); this.player = new Player(playerModel, new Vector3f(0, 0, -3), 0, 180f, 0, new Vector3f(0.2f, 0.2f, 0.2f)); this.camera = new FirstPersonCamera(player); this.player.setVisible(false); diff --git a/src/main/java/com/github/halotroop/litecraft/save/LitecraftSave.java b/src/main/java/com/github/halotroop/litecraft/save/LitecraftSave.java index 2184f30..c18672c 100644 --- a/src/main/java/com/github/halotroop/litecraft/save/LitecraftSave.java +++ b/src/main/java/com/github/halotroop/litecraft/save/LitecraftSave.java @@ -8,8 +8,8 @@ import org.joml.Vector3f; import com.github.halotroop.litecraft.Litecraft; import com.github.halotroop.litecraft.world.*; import com.github.halotroop.litecraft.world.dimension.Dimension; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.elements.objects.Player; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.elements.objects.Player; import tk.valoeghese.sod.*; diff --git a/src/main/java/com/github/halotroop/litecraft/screens/ExitGameScreen.java b/src/main/java/com/github/halotroop/litecraft/screens/ExitGameScreen.java index 4840c61..52fb041 100644 --- a/src/main/java/com/github/halotroop/litecraft/screens/ExitGameScreen.java +++ b/src/main/java/com/github/halotroop/litecraft/screens/ExitGameScreen.java @@ -2,15 +2,15 @@ package com.github.halotroop.litecraft.screens; import org.joml.*; +import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.openGL.api.*; import com.github.hydos.ginger.engine.openGL.font.GUIText; -import com.github.hydos.ginger.engine.openGL.io.Window; import com.github.hydos.ginger.engine.openGL.screen.Screen; public class ExitGameScreen extends Screen { private GUIText infoText; - private Ginger ginger3D = Ginger.getInstance(); + private GingerGL ginger3D = GingerGL.getInstance(); public ExitGameScreen() { diff --git a/src/main/java/com/github/halotroop/litecraft/screens/IngameHUD.java b/src/main/java/com/github/halotroop/litecraft/screens/IngameHUD.java index b3dc6a0..c0c90ae 100644 --- a/src/main/java/com/github/halotroop/litecraft/screens/IngameHUD.java +++ b/src/main/java/com/github/halotroop/litecraft/screens/IngameHUD.java @@ -3,6 +3,7 @@ package com.github.halotroop.litecraft.screens; import org.joml.*; import com.github.halotroop.litecraft.Litecraft; +import com.github.hydos.ginger.engine.common.api.GingerRegister; import com.github.hydos.ginger.engine.openGL.api.*; import com.github.hydos.ginger.engine.openGL.font.GUIText; import com.github.hydos.ginger.engine.openGL.screen.Screen; @@ -11,7 +12,7 @@ public class IngameHUD extends Screen { private GUIText debugText; private GUIText positionText; - private Ginger ginger3D = Ginger.getInstance(); + private GingerGL ginger3D = GingerGL.getInstance(); private Litecraft litecraft = Litecraft.getInstance(); public IngameHUD() diff --git a/src/main/java/com/github/halotroop/litecraft/screens/TitleScreen.java b/src/main/java/com/github/halotroop/litecraft/screens/TitleScreen.java index 43f8c5c..73875ba 100644 --- a/src/main/java/com/github/halotroop/litecraft/screens/TitleScreen.java +++ b/src/main/java/com/github/halotroop/litecraft/screens/TitleScreen.java @@ -7,11 +7,11 @@ import org.joml.*; import com.github.halotroop.litecraft.Litecraft; import com.github.halotroop.litecraft.save.LitecraftSave; import com.github.halotroop.litecraft.world.dimension.Dimensions; -import com.github.hydos.ginger.engine.openGL.api.Ginger; -import com.github.hydos.ginger.engine.openGL.elements.GuiTexture; -import com.github.hydos.ginger.engine.openGL.elements.buttons.TextureButton; +import com.github.hydos.ginger.engine.common.elements.GuiTexture; +import com.github.hydos.ginger.engine.common.elements.buttons.TextureButton; +import com.github.hydos.ginger.engine.common.io.Window; +import com.github.hydos.ginger.engine.openGL.api.GingerGL; import com.github.hydos.ginger.engine.openGL.font.GUIText; -import com.github.hydos.ginger.engine.openGL.io.Window; import com.github.hydos.ginger.engine.openGL.screen.Screen; /** @@ -20,7 +20,7 @@ import com.github.hydos.ginger.engine.openGL.screen.Screen; public class TitleScreen extends Screen { private GUIText debugText; - private Ginger ginger3D = Ginger.getInstance(); + private GingerGL ginger3D = GingerGL.getInstance(); private TextureButton playButton; private Litecraft litecraft = Litecraft.getInstance(); 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 3953134..2a9c52b 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 @@ -2,7 +2,7 @@ package com.github.halotroop.litecraft.types.block; import java.util.*; -import com.github.hydos.ginger.engine.openGL.obj.ModelLoader; +import com.github.hydos.ginger.engine.common.obj.ModelLoader; import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; public class Block diff --git a/src/main/java/com/github/halotroop/litecraft/types/block/BlockInstance.java b/src/main/java/com/github/halotroop/litecraft/types/block/BlockInstance.java index f3d5d32..39185c0 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/block/BlockInstance.java +++ b/src/main/java/com/github/halotroop/litecraft/types/block/BlockInstance.java @@ -3,7 +3,7 @@ package com.github.halotroop.litecraft.types.block; import org.joml.Vector3f; import com.github.halotroop.litecraft.world.Chunk; -import com.github.hydos.ginger.engine.openGL.elements.objects.RenderObject; +import com.github.hydos.ginger.engine.common.elements.objects.RenderObject; public class BlockInstance extends RenderObject { diff --git a/src/main/java/com/github/halotroop/litecraft/types/entity/Entity.java b/src/main/java/com/github/halotroop/litecraft/types/entity/Entity.java index a950d74..934f114 100644 --- a/src/main/java/com/github/halotroop/litecraft/types/entity/Entity.java +++ b/src/main/java/com/github/halotroop/litecraft/types/entity/Entity.java @@ -2,7 +2,7 @@ package com.github.halotroop.litecraft.types.entity; import org.joml.Vector3f; -import com.github.hydos.ginger.engine.openGL.elements.objects.RenderObject; +import com.github.hydos.ginger.engine.common.elements.objects.RenderObject; import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; public abstract class Entity extends RenderObject diff --git a/src/main/java/com/github/halotroop/litecraft/world/World.java b/src/main/java/com/github/halotroop/litecraft/world/World.java index e70c209..7183e48 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/World.java +++ b/src/main/java/com/github/halotroop/litecraft/world/World.java @@ -15,8 +15,8 @@ import com.github.halotroop.litecraft.world.block.BlockRenderer; import com.github.halotroop.litecraft.world.dimension.Dimension; import com.github.halotroop.litecraft.world.gen.*; import com.github.halotroop.litecraft.world.gen.modifier.WorldModifier; -import com.github.hydos.ginger.engine.openGL.elements.objects.Player; -import com.github.hydos.ginger.engine.openGL.obj.ModelLoader; +import com.github.hydos.ginger.engine.common.elements.objects.Player; +import com.github.hydos.ginger.engine.common.obj.ModelLoader; import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; import it.unimi.dsi.fastutil.longs.*; diff --git a/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java b/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java index eedb257..6aa7222 100644 --- a/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java +++ b/src/main/java/com/github/halotroop/litecraft/world/block/BlockRenderer.java @@ -6,14 +6,14 @@ import org.lwjgl.opengl.*; import com.github.halotroop.litecraft.types.block.BlockInstance; import com.github.halotroop.litecraft.world.Chunk; import com.github.halotroop.litecraft.world.gen.WorldGenConstants; -import com.github.hydos.ginger.engine.openGL.api.GingerRegister; -import com.github.hydos.ginger.engine.openGL.elements.objects.RenderObject; -import com.github.hydos.ginger.engine.openGL.io.Window; -import com.github.hydos.ginger.engine.openGL.math.Maths; +import com.github.hydos.ginger.engine.common.api.GingerRegister; +import com.github.hydos.ginger.engine.common.elements.objects.RenderObject; +import com.github.hydos.ginger.engine.common.io.Window; +import com.github.hydos.ginger.engine.common.math.Maths; import com.github.hydos.ginger.engine.openGL.render.Renderer; import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; import com.github.hydos.ginger.engine.openGL.render.shaders.StaticShader; -import com.github.hydos.ginger.engine.openGL.utils.Loader; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; public class BlockRenderer extends Renderer implements WorldGenConstants { @@ -28,7 +28,7 @@ public class BlockRenderer extends Renderer implements WorldGenConstants shader.start(); shader.loadProjectionMatrix(projectionMatrix); shader.stop(); - this.atlasID = Loader.createBlockAtlas(); + this.atlasID = GlLoader.createBlockAtlas(); } private void prepBlockInstance(RenderObject entity) diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/Constants.java b/src/main/java/com/github/hydos/ginger/engine/common/Constants.java similarity index 83% rename from src/main/java/com/github/hydos/ginger/engine/openGL/Constants.java rename to src/main/java/com/github/hydos/ginger/engine/common/Constants.java index cf7d2c6..6b0bee7 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/Constants.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/Constants.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL; +package com.github.hydos.ginger.engine.common; import org.joml.Vector3f; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerRegister.java b/src/main/java/com/github/hydos/ginger/engine/common/api/GingerRegister.java similarity index 90% rename from src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerRegister.java rename to src/main/java/com/github/hydos/ginger/engine/common/api/GingerRegister.java index 87050ed..9b371e6 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerRegister.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/api/GingerRegister.java @@ -1,9 +1,9 @@ -package com.github.hydos.ginger.engine.openGL.api; +package com.github.hydos.ginger.engine.common.api; import java.util.*; -import com.github.hydos.ginger.engine.openGL.api.game.Game; -import com.github.hydos.ginger.engine.openGL.elements.buttons.TextureButton; +import com.github.hydos.ginger.engine.common.api.game.Game; +import com.github.hydos.ginger.engine.common.elements.buttons.TextureButton; import com.github.hydos.ginger.engine.openGL.font.GUIText; import com.github.hydos.ginger.engine.openGL.postprocessing.Fbo; import com.github.hydos.ginger.engine.openGL.render.MasterRenderer; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/api/game/Game.java b/src/main/java/com/github/hydos/ginger/engine/common/api/game/Game.java similarity index 77% rename from src/main/java/com/github/hydos/ginger/engine/openGL/api/game/Game.java rename to src/main/java/com/github/hydos/ginger/engine/common/api/game/Game.java index 6193cac..61b5e8f 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/api/game/Game.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/api/game/Game.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.api.game; +package com.github.hydos.ginger.engine.common.api.game; public abstract class Game { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/api/game/GameData.java b/src/main/java/com/github/hydos/ginger/engine/common/api/game/GameData.java similarity index 77% rename from src/main/java/com/github/hydos/ginger/engine/openGL/api/game/GameData.java rename to src/main/java/com/github/hydos/ginger/engine/common/api/game/GameData.java index 6fdc084..a667789 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/api/game/GameData.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/api/game/GameData.java @@ -1,12 +1,12 @@ -package com.github.hydos.ginger.engine.openGL.api.game; +package com.github.hydos.ginger.engine.common.api.game; import java.util.*; import org.joml.Vector4f; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.elements.GuiTexture; -import com.github.hydos.ginger.engine.openGL.elements.objects.*; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.elements.GuiTexture; +import com.github.hydos.ginger.engine.common.elements.objects.*; /** * Used for storing essential engine game data so main class isn't messy diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/cameras/Camera.java b/src/main/java/com/github/hydos/ginger/engine/common/cameras/Camera.java similarity index 93% rename from src/main/java/com/github/hydos/ginger/engine/openGL/cameras/Camera.java rename to src/main/java/com/github/hydos/ginger/engine/common/cameras/Camera.java index 97b9852..0ac7b34 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/cameras/Camera.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/cameras/Camera.java @@ -1,10 +1,10 @@ -package com.github.hydos.ginger.engine.openGL.cameras; +package com.github.hydos.ginger.engine.common.cameras; import org.joml.Vector3f; import org.lwjgl.glfw.*; -import com.github.hydos.ginger.engine.openGL.elements.objects.Player; -import com.github.hydos.ginger.engine.openGL.io.Window; +import com.github.hydos.ginger.engine.common.elements.objects.Player; +import com.github.hydos.ginger.engine.common.io.Window; public class Camera { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/cameras/FirstPersonCamera.java b/src/main/java/com/github/hydos/ginger/engine/common/cameras/FirstPersonCamera.java similarity index 83% rename from src/main/java/com/github/hydos/ginger/engine/openGL/cameras/FirstPersonCamera.java rename to src/main/java/com/github/hydos/ginger/engine/common/cameras/FirstPersonCamera.java index 92384af..e887491 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/cameras/FirstPersonCamera.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/cameras/FirstPersonCamera.java @@ -1,9 +1,9 @@ -package com.github.hydos.ginger.engine.openGL.cameras; +package com.github.hydos.ginger.engine.common.cameras; import org.joml.Vector3f; -import com.github.hydos.ginger.engine.openGL.elements.objects.Player; -import com.github.hydos.ginger.engine.openGL.io.Window; +import com.github.hydos.ginger.engine.common.elements.objects.Player; +import com.github.hydos.ginger.engine.common.io.Window; public class FirstPersonCamera extends Camera { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/GuiTexture.java b/src/main/java/com/github/hydos/ginger/engine/common/elements/GuiTexture.java similarity index 91% rename from src/main/java/com/github/hydos/ginger/engine/openGL/elements/GuiTexture.java rename to src/main/java/com/github/hydos/ginger/engine/common/elements/GuiTexture.java index 85504c7..dfbb62b 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/GuiTexture.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/elements/GuiTexture.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.elements; +package com.github.hydos.ginger.engine.common.elements; import org.joml.Vector2f; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/buttons/TextureButton.java b/src/main/java/com/github/hydos/ginger/engine/common/elements/buttons/TextureButton.java similarity index 82% rename from src/main/java/com/github/hydos/ginger/engine/openGL/elements/buttons/TextureButton.java rename to src/main/java/com/github/hydos/ginger/engine/common/elements/buttons/TextureButton.java index c9af767..9f10d7e 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/buttons/TextureButton.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/elements/buttons/TextureButton.java @@ -1,13 +1,13 @@ -package com.github.hydos.ginger.engine.openGL.elements.buttons; +package com.github.hydos.ginger.engine.common.elements.buttons; import java.util.List; import org.joml.Vector2f; import org.lwjgl.glfw.GLFW; -import com.github.hydos.ginger.engine.openGL.elements.GuiTexture; -import com.github.hydos.ginger.engine.openGL.io.Window; -import com.github.hydos.ginger.engine.openGL.utils.Loader; +import com.github.hydos.ginger.engine.common.elements.GuiTexture; +import com.github.hydos.ginger.engine.common.io.Window; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; public class TextureButton { @@ -20,7 +20,7 @@ public class TextureButton public TextureButton(String texture, Vector2f position, Vector2f scale) { resourceLocation = texture; - guiTexture = new GuiTexture(Loader.loadTextureDirectly(texture), position, scale); + guiTexture = new GuiTexture(GlLoader.loadTextureDirectly(texture), position, scale); } public void hide(List guiTextureList) diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/objects/Light.java b/src/main/java/com/github/hydos/ginger/engine/common/elements/objects/Light.java similarity index 92% rename from src/main/java/com/github/hydos/ginger/engine/openGL/elements/objects/Light.java rename to src/main/java/com/github/hydos/ginger/engine/common/elements/objects/Light.java index b5c5ec3..28928e4 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/objects/Light.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/elements/objects/Light.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.elements.objects; +package com.github.hydos.ginger.engine.common.elements.objects; import org.joml.Vector3f; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/objects/Player.java b/src/main/java/com/github/hydos/ginger/engine/common/elements/objects/Player.java similarity index 92% rename from src/main/java/com/github/hydos/ginger/engine/openGL/elements/objects/Player.java rename to src/main/java/com/github/hydos/ginger/engine/common/elements/objects/Player.java index a9159e2..39aa042 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/objects/Player.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/elements/objects/Player.java @@ -1,13 +1,13 @@ -package com.github.hydos.ginger.engine.openGL.elements.objects; +package com.github.hydos.ginger.engine.common.elements.objects; import org.joml.Vector3f; import com.github.halotroop.litecraft.Litecraft; import com.github.halotroop.litecraft.util.RelativeDirection; import com.github.halotroop.litecraft.world.gen.WorldGenConstants; -import com.github.hydos.ginger.engine.openGL.Constants; -import com.github.hydos.ginger.engine.openGL.api.GingerRegister; -import com.github.hydos.ginger.engine.openGL.io.Window; +import com.github.hydos.ginger.engine.common.Constants; +import com.github.hydos.ginger.engine.common.api.GingerRegister; +import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; public class Player extends RenderObject implements WorldGenConstants diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/objects/RenderObject.java b/src/main/java/com/github/hydos/ginger/engine/common/elements/objects/RenderObject.java similarity index 96% rename from src/main/java/com/github/hydos/ginger/engine/openGL/elements/objects/RenderObject.java rename to src/main/java/com/github/hydos/ginger/engine/common/elements/objects/RenderObject.java index 3c8fb86..76754f9 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/elements/objects/RenderObject.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/elements/objects/RenderObject.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.elements.objects; +package com.github.hydos.ginger.engine.common.elements.objects; import org.joml.Vector3f; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/io/Window.java b/src/main/java/com/github/hydos/ginger/engine/common/io/Window.java similarity index 97% rename from src/main/java/com/github/hydos/ginger/engine/openGL/io/Window.java rename to src/main/java/com/github/hydos/ginger/engine/common/io/Window.java index 38f77f6..dbc87a4 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/io/Window.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/io/Window.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.io; +package com.github.hydos.ginger.engine.common.io; import java.nio.*; @@ -7,7 +7,7 @@ import org.lwjgl.BufferUtils; import org.lwjgl.glfw.*; import org.lwjgl.opengl.*; -import com.github.hydos.ginger.engine.openGL.api.Ginger; +import com.github.hydos.ginger.engine.openGL.api.GingerGL; import com.github.hydos.ginger.engine.openGL.render.texture.Image; public class Window @@ -189,7 +189,7 @@ public class Window // Hack to make the FBO update when the screen size is changed if ((oldWindowHeight != Window.getHeight() || oldWindowWidth != Window.getWidth()) && Window.getHeight() > 10 && Window.getWidth() > 10) { - Ginger.getInstance().contrastFbo.resizeFBOs(); + GingerGL.getInstance().contrastFbo.resizeFBOs(); oldWindowWidth = Window.getWidth(); oldWindowHeight = Window.getHeight(); } diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/math/Maths.java b/src/main/java/com/github/hydos/ginger/engine/common/math/Maths.java similarity index 95% rename from src/main/java/com/github/hydos/ginger/engine/openGL/math/Maths.java rename to src/main/java/com/github/hydos/ginger/engine/common/math/Maths.java index c94a839..fa8902d 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/math/Maths.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/math/Maths.java @@ -1,10 +1,10 @@ -package com.github.hydos.ginger.engine.openGL.math; +package com.github.hydos.ginger.engine.common.math; import java.lang.Math; import org.joml.*; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; +import com.github.hydos.ginger.engine.common.cameras.Camera; public class Maths { diff --git a/src/main/java/com/github/hydos/ginger/engine/common/obj/Material.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/Material.java new file mode 100644 index 0000000..bd21501 --- /dev/null +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/Material.java @@ -0,0 +1,5 @@ +package com.github.hydos.ginger.engine.common.obj; + +public class Material +{ +} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/Mesh.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/Mesh.java similarity index 93% rename from src/main/java/com/github/hydos/ginger/engine/openGL/obj/Mesh.java rename to src/main/java/com/github/hydos/ginger/engine/common/obj/Mesh.java index 3415ce9..2c630b6 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/Mesh.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/Mesh.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.obj; +package com.github.hydos.ginger.engine.common.obj; public class Mesh { diff --git a/src/main/java/com/github/hydos/ginger/engine/common/obj/ModelLoader.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/ModelLoader.java new file mode 100644 index 0000000..6d9a7ba --- /dev/null +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/ModelLoader.java @@ -0,0 +1,22 @@ +package com.github.hydos.ginger.engine.common.obj; + +import com.github.hydos.ginger.engine.common.obj.shapes.StaticCube; +import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; +import com.github.hydos.ginger.engine.openGL.render.texture.ModelTexture; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; + +public class ModelLoader +{ + public static TexturedModel loadGenericCube(String cubeTexture) + { + Mesh data = StaticCube.getCube(); + TexturedModel tm = new TexturedModel(GlLoader.loadToVAO(data.getVertices(), data.getIndices(), data.getNormals(), data.getTextureCoords()), new ModelTexture(cubeTexture)); + return tm; + } + + public static TexturedModel loadModel(String objPath, String texturePath) + { + Mesh data = OBJFileLoader.loadModel(objPath); + return new TexturedModel(GlLoader.loadToVAO(data.getVertices(), data.getIndices(), data.getNormals(), data.getTextureCoords()), new ModelTexture(texturePath)); + } +} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/OBJFileLoader.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/OBJFileLoader.java similarity index 98% rename from src/main/java/com/github/hydos/ginger/engine/openGL/obj/OBJFileLoader.java rename to src/main/java/com/github/hydos/ginger/engine/common/obj/OBJFileLoader.java index 6a14ab9..c70cbc0 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/OBJFileLoader.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/OBJFileLoader.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.obj; +package com.github.hydos.ginger.engine.common.obj; import org.joml.*; import org.lwjgl.assimp.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/Vertex.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/Vertex.java similarity index 96% rename from src/main/java/com/github/hydos/ginger/engine/openGL/obj/Vertex.java rename to src/main/java/com/github/hydos/ginger/engine/common/obj/Vertex.java index 209683f..e06901e 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/Vertex.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/Vertex.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.obj; +package com.github.hydos.ginger.engine.common.obj; import org.joml.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/normals/ModelDataNM.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/normals/ModelDataNM.java similarity index 93% rename from src/main/java/com/github/hydos/ginger/engine/openGL/obj/normals/ModelDataNM.java rename to src/main/java/com/github/hydos/ginger/engine/common/obj/normals/ModelDataNM.java index af21b7b..2dea790 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/normals/ModelDataNM.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/normals/ModelDataNM.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.obj.normals; +package com.github.hydos.ginger.engine.common.obj.normals; public class ModelDataNM { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/normals/NormalMappedObjLoader.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/normals/NormalMappedObjLoader.java similarity index 96% rename from src/main/java/com/github/hydos/ginger/engine/openGL/obj/normals/NormalMappedObjLoader.java rename to src/main/java/com/github/hydos/ginger/engine/common/obj/normals/NormalMappedObjLoader.java index 174315e..cb2b71c 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/normals/NormalMappedObjLoader.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/normals/NormalMappedObjLoader.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.obj.normals; +package com.github.hydos.ginger.engine.common.obj.normals; import java.io.*; import java.util.*; @@ -6,7 +6,7 @@ import java.util.*; import org.joml.*; import com.github.hydos.ginger.engine.openGL.render.models.RawModel; -import com.github.hydos.ginger.engine.openGL.utils.Loader; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; public class NormalMappedObjLoader { @@ -166,7 +166,7 @@ public class NormalMappedObjLoader float furthest = convertDataToArrays(vertices, textures, normals, verticesArray, texturesArray, normalsArray, tangentsArray); int[] indicesArray = convertIndicesListToArray(indices); - return Loader.loadToVAO(verticesArray, indicesArray, normalsArray, tangentsArray, texturesArray); + return GlLoader.loadToVAO(verticesArray, indicesArray, normalsArray, tangentsArray, texturesArray); } private static VertexNM processVertex(String[] vertex, List vertices, diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/normals/VertexNM.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/normals/VertexNM.java similarity index 97% rename from src/main/java/com/github/hydos/ginger/engine/openGL/obj/normals/VertexNM.java rename to src/main/java/com/github/hydos/ginger/engine/common/obj/normals/VertexNM.java index 5ff0662..701d2c7 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/normals/VertexNM.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/normals/VertexNM.java @@ -1,4 +1,4 @@ -package com.github.hydos.ginger.engine.openGL.obj.normals; +package com.github.hydos.ginger.engine.common.obj.normals; import java.util.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/common/obj/shapes/ShapeMesh.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/shapes/ShapeMesh.java new file mode 100644 index 0000000..dce7dda --- /dev/null +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/shapes/ShapeMesh.java @@ -0,0 +1 @@ +package com.github.hydos.ginger.engine.common.obj.shapes; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/shapes/StaticCube.java b/src/main/java/com/github/hydos/ginger/engine/common/obj/shapes/StaticCube.java similarity index 93% rename from src/main/java/com/github/hydos/ginger/engine/openGL/obj/shapes/StaticCube.java rename to src/main/java/com/github/hydos/ginger/engine/common/obj/shapes/StaticCube.java index ffd4558..532e4fc 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/shapes/StaticCube.java +++ b/src/main/java/com/github/hydos/ginger/engine/common/obj/shapes/StaticCube.java @@ -1,6 +1,6 @@ -package com.github.hydos.ginger.engine.openGL.obj.shapes; +package com.github.hydos.ginger.engine.common.obj.shapes; -import com.github.hydos.ginger.engine.openGL.obj.Mesh; +import com.github.hydos.ginger.engine.common.obj.Mesh; public class StaticCube { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/api/Ginger.java b/src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerGL.java similarity index 86% rename from src/main/java/com/github/hydos/ginger/engine/openGL/api/Ginger.java rename to src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerGL.java index 7a5468f..78ccd43 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/api/Ginger.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerGL.java @@ -5,22 +5,22 @@ import org.joml.Vector2f; import com.github.halotroop.litecraft.Litecraft; import com.github.halotroop.litecraft.logic.Timer; import com.github.halotroop.litecraft.logic.Timer.TickListener; -import com.github.hydos.ginger.engine.openGL.api.game.*; -import com.github.hydos.ginger.engine.openGL.elements.buttons.TextureButton; -import com.github.hydos.ginger.engine.openGL.elements.objects.Player; +import com.github.hydos.ginger.engine.common.api.GingerRegister; +import com.github.hydos.ginger.engine.common.api.game.*; +import com.github.hydos.ginger.engine.common.elements.buttons.TextureButton; +import com.github.hydos.ginger.engine.common.elements.objects.Player; +import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.openGL.font.*; -import com.github.hydos.ginger.engine.openGL.io.Window; -import com.github.hydos.ginger.engine.openGL.particle.ParticleMaster; import com.github.hydos.ginger.engine.openGL.postprocessing.*; import com.github.hydos.ginger.engine.openGL.render.MasterRenderer; import com.github.hydos.ginger.engine.openGL.render.tools.MousePicker; import com.github.hydos.ginger.engine.openGL.screen.Screen; -import com.github.hydos.ginger.engine.openGL.utils.Loader; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; import com.github.hydos.multithreading.GingerThreading; -public class Ginger +public class GingerGL { - private static Ginger INSTANCE; + private static GingerGL INSTANCE; private GingerRegister registry; public MousePicker picker; public FontType globalFont; @@ -42,10 +42,9 @@ public class Ginger { Window.stop(); PostProcessing.cleanUp(); - ParticleMaster.cleanUp(); registry.masterRenderer.cleanUp(); TextMaster.cleanUp(); - Loader.cleanUp(); + GlLoader.cleanUp(); } public void openScreen(Screen screen) @@ -91,7 +90,6 @@ public class Ginger GingerUtils.preRenderScene(registry.masterRenderer); contrastFbo.bindFBO(); registry.masterRenderer.renderScene(data.entities, data.normalMapEntities, data.lights, data.camera, data.clippingPlane, game.getWorld()); - ParticleMaster.renderParticles(data.camera); contrastFbo.unbindFBO(); PostProcessing.doPostProcessing(contrastFbo.colorTexture); if (data.handleGuis) renderOverlays(game); @@ -112,7 +110,6 @@ public class Ginger registry.masterRenderer = masterRenderer; picker = new MousePicker(game.data.camera, masterRenderer.getProjectionMatrix()); PostProcessing.init(); - ParticleMaster.init(masterRenderer.getProjectionMatrix()); } public void startGameLoop() @@ -136,11 +133,10 @@ public class Ginger registry.game.update(); picker.update(); GingerUtils.update(); - ParticleMaster.update(data.camera); Window.update(); Litecraft.getInstance().ups += 1; } - public static Ginger getInstance() + public static GingerGL getInstance() { return INSTANCE; } } \ No newline at end of file diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerUtils.java b/src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerUtils.java index b007794..87fc316 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerUtils.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/api/GingerUtils.java @@ -1,8 +1,8 @@ package com.github.hydos.ginger.engine.openGL.api; +import com.github.hydos.ginger.engine.common.obj.ModelLoader; +import com.github.hydos.ginger.engine.common.obj.normals.NormalMappedObjLoader; import com.github.hydos.ginger.engine.openGL.font.TextMaster; -import com.github.hydos.ginger.engine.openGL.obj.ModelLoader; -import com.github.hydos.ginger.engine.openGL.obj.normals.NormalMappedObjLoader; import com.github.hydos.ginger.engine.openGL.render.MasterRenderer; import com.github.hydos.ginger.engine.openGL.render.models.*; import com.github.hydos.ginger.engine.openGL.render.texture.ModelTexture; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/font/MetaFile.java b/src/main/java/com/github/hydos/ginger/engine/openGL/font/MetaFile.java index ed10c8c..7c5127e 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/font/MetaFile.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/font/MetaFile.java @@ -3,7 +3,7 @@ package com.github.hydos.ginger.engine.openGL.font; import java.io.*; import java.util.*; -import com.github.hydos.ginger.engine.openGL.io.Window; +import com.github.hydos.ginger.engine.common.io.Window; /** Provides functionality for getting the values from a font file. */ public class MetaFile diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/font/TextMaster.java b/src/main/java/com/github/hydos/ginger/engine/openGL/font/TextMaster.java index 2ffbcfe..c84189d 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/font/TextMaster.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/font/TextMaster.java @@ -2,9 +2,9 @@ package com.github.hydos.ginger.engine.openGL.font; import java.util.*; -import com.github.hydos.ginger.engine.openGL.api.Ginger; +import com.github.hydos.ginger.engine.openGL.api.GingerGL; import com.github.hydos.ginger.engine.openGL.render.renderers.FontRenderer; -import com.github.hydos.ginger.engine.openGL.utils.Loader; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; public class TextMaster { @@ -21,7 +21,7 @@ public class TextMaster { FontType font = text.getFont(); TextMeshData data = font.loadText(text); - int vao = Loader.loadToVAO(data.getVertexPositions(), data.getTextureCoords()); + int vao = GlLoader.loadToVAO(data.getVertexPositions(), data.getTextureCoords()); text.setMeshInfo(vao, data.getVertexCount()); List textBatch = texts.get(font); if (textBatch == null) @@ -46,10 +46,10 @@ public class TextMaster public static void render(GUIText buildText) { Map> oldTexts = texts; - List oldFontText = texts.get(Ginger.getInstance().globalFont); + List oldFontText = texts.get(GingerGL.getInstance().globalFont); oldFontText.add(buildText); texts.clear(); - texts.put(Ginger.getInstance().globalFont, oldFontText); + texts.put(GingerGL.getInstance().globalFont, oldFontText); texts = oldTexts; } } diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/Material.java b/src/main/java/com/github/hydos/ginger/engine/openGL/obj/Material.java deleted file mode 100644 index 2b354d4..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/Material.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.obj; - -public class Material -{ -} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/ModelLoader.java b/src/main/java/com/github/hydos/ginger/engine/openGL/obj/ModelLoader.java deleted file mode 100644 index 083c345..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/ModelLoader.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.obj; - -import com.github.hydos.ginger.engine.openGL.obj.shapes.StaticCube; -import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; -import com.github.hydos.ginger.engine.openGL.render.texture.ModelTexture; -import com.github.hydos.ginger.engine.openGL.utils.Loader; - -public class ModelLoader -{ - public static TexturedModel loadGenericCube(String cubeTexture) - { - Mesh data = StaticCube.getCube(); - TexturedModel tm = new TexturedModel(Loader.loadToVAO(data.getVertices(), data.getIndices(), data.getNormals(), data.getTextureCoords()), new ModelTexture(cubeTexture)); - return tm; - } - - public static TexturedModel loadModel(String objPath, String texturePath) - { - Mesh data = OBJFileLoader.loadModel(objPath); - return new TexturedModel(Loader.loadToVAO(data.getVertices(), data.getIndices(), data.getNormals(), data.getTextureCoords()), new ModelTexture(texturePath)); - } -} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/shapes/ShapeMesh.java b/src/main/java/com/github/hydos/ginger/engine/openGL/obj/shapes/ShapeMesh.java deleted file mode 100644 index 9640cac..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/obj/shapes/ShapeMesh.java +++ /dev/null @@ -1 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.obj.shapes; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/InsertionSort.java b/src/main/java/com/github/hydos/ginger/engine/openGL/particle/InsertionSort.java deleted file mode 100644 index eafd9ec..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/InsertionSort.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.particle; - -import java.util.List; - -public class InsertionSort -{ - /** Sorts a list of particles so that the particles with the highest distance - * from the camera are first, and the particles with the shortest distance - * are last. - * - * @param list - * - the list of particles needing sorting. */ - public static void sortHighToLow(List list) - { - for (int i = 1; i < list.size(); i++) - { - Particle item = list.get(i); - if (item.getDistance() > list.get(i - 1).getDistance()) - { sortUpHighToLow(list, i); } - } - } - - private static void sortUpHighToLow(List list, int i) - { - Particle item = list.get(i); - int attemptPos = i - 1; - while (attemptPos != 0 && list.get(attemptPos - 1).getDistance() < item.getDistance()) - { attemptPos--; } - list.remove(i); - list.add(attemptPos, item); - } -} \ No newline at end of file diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/Particle.java b/src/main/java/com/github/hydos/ginger/engine/openGL/particle/Particle.java deleted file mode 100644 index fe73aec..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/Particle.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.particle; - -import java.lang.Math; - -import org.joml.*; - -import com.github.hydos.ginger.engine.openGL.Constants; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.io.Window; - -public class Particle -{ - private Vector3f position; - private Vector3f velocity; - private float gravityEffect; - private float lifeLength; - private float rotation; - private Vector3f scale; - private Vector2f texOffset1 = new Vector2f(); - private Vector2f texOffset2 = new Vector2f(); - private float blend; - private ParticleTexture texture; - private float elapsedTime = 0; - private float distance; - - public Particle(ParticleTexture texture, Vector3f position, Vector3f velocity, float gravityEffect, float lifeLength, float rotation, - Vector3f scale) - { - super(); - this.position = position; - this.velocity = velocity; - this.gravityEffect = gravityEffect; - this.lifeLength = lifeLength; - this.rotation = rotation; - this.scale = scale; - this.texture = texture; - ParticleMaster.addParticle(this); - } - - public float getBlend() - { return blend; } - - public float getDistance() - { return distance; } - - public Vector3f getPosition() - { return position; } - - public float getRotation() - { return rotation; } - - public Vector3f getScale() - { return scale; } - - public Vector2f getTexOffset1() - { return texOffset1; } - - public Vector2f getTexOffset2() - { return texOffset2; } - - public ParticleTexture getTexture() - { return texture; } - - private void setTextureOffset(Vector2f offset, int index) - { - int column = index % texture.getNumberOfRows(); - int row = index / texture.getNumberOfRows(); - offset.x = (float) column / texture.getNumberOfRows(); - offset.y = (float) row / texture.getNumberOfRows(); - } - - public boolean update(Camera camera) - { - float time = (float) Window.getTime() / 1000000; - velocity.y += Constants.gravity.y() * gravityEffect * time; - Vector3f change = new Vector3f(velocity); - change.mul(time); - position.add(change, position); - distance = camera.getPosition().sub(position).lengthSquared(); - elapsedTime += time; - updateTextureCoordInfo(); - return elapsedTime < lifeLength; - } - - private void updateTextureCoordInfo() - { - float lifeFactor = elapsedTime / lifeLength; - int stageCount = texture.getNumberOfRows() * texture.getNumberOfRows(); - float atlasProgression = lifeFactor * stageCount; - int index1 = (int) Math.floor(atlasProgression); - int index2 = index1 < stageCount - 1 ? index1 + 1 : index1; - this.blend = atlasProgression % 1; - setTextureOffset(texOffset1, index1); - setTextureOffset(texOffset2, index2); - } -} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/ParticleMaster.java b/src/main/java/com/github/hydos/ginger/engine/openGL/particle/ParticleMaster.java deleted file mode 100644 index 00bea1d..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/ParticleMaster.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.particle; - -import java.util.*; -import java.util.Map.Entry; - -import org.joml.Matrix4f; - -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.render.renderers.ParticleRenderer; - -public class ParticleMaster -{ - private static Map> particles = new HashMap>(); - private static ParticleRenderer particleRenderer; - - public static void addParticle(Particle particle) - { - List list = particles.get(particle.getTexture()); - if (list == null) - { - list = new ArrayList(); - particles.put(particle.getTexture(), list); - } - list.add(particle); - } - - public static void cleanUp() - { particleRenderer.cleanUp(); } - - public static void init(Matrix4f projectionMatrix) - { particleRenderer = new ParticleRenderer(projectionMatrix); } - - public static void renderParticles(Camera camera) - { particleRenderer.render(particles, camera); } - - public static void update(Camera camera) - { - Iterator>> mapIterator = particles.entrySet().iterator(); - while (mapIterator.hasNext()) - { - List list = mapIterator.next().getValue(); - Iterator iterator = list.iterator(); - while (iterator.hasNext()) - { - Particle p = iterator.next(); - boolean stillAlive = p.update(camera); - if (!stillAlive) - { - iterator.remove(); - if (list.isEmpty()) - { mapIterator.remove(); } - } - } - InsertionSort.sortHighToLow(list); - } - } -} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/ParticleSystem.java b/src/main/java/com/github/hydos/ginger/engine/openGL/particle/ParticleSystem.java deleted file mode 100644 index 470e60f..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/ParticleSystem.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.particle; - -import java.lang.Math; -import java.util.Random; - -import org.joml.*; - -import com.github.hydos.ginger.engine.openGL.io.Window; - -public class ParticleSystem -{ - private static Vector3f generateRandomUnitVectorWithinCone(Vector3f coneDirection, float angle) - { - float cosAngle = (float) Math.cos(angle); - Random random = new Random(); - float theta = (float) (random.nextFloat() * 2f * Math.PI); - float z = cosAngle + (random.nextFloat() * (1 - cosAngle)); - float rootOneMinusZSquared = (float) Math.sqrt(1 - z * z); - float x = (float) (rootOneMinusZSquared * Math.cos(theta)); - float y = (float) (rootOneMinusZSquared * Math.sin(theta)); - Vector4f direction = new Vector4f(x, y, z, 1); - if (coneDirection.x != 0 || coneDirection.y != 0 || (coneDirection.z != 1 && coneDirection.z != -1)) - { - Vector3f rotateAxis = coneDirection.cross(new Vector3f(0, 0, 1)); - rotateAxis.normalize(); - float rotateAngle = (float) Math.acos(coneDirection.dot(new Vector3f(0, 0, 1))); - Matrix4f rotationMatrix = new Matrix4f(); - rotationMatrix.rotate(-rotateAngle, rotateAxis); - rotationMatrix.transform(direction); - } - else if (coneDirection.z == -1) - { direction.z *= -1; } - return new Vector3f(direction.x, direction.y, direction.z); - } - - private float pps, averageSpeed, gravityComplient, averageLifeLength, averageScale; - private float speedError, lifeError, scaleError = 0; - private boolean randomRotation = false; - private Vector3f direction; - private float directionDeviation = 0; - private ParticleTexture texture; - private Random random = new Random(); - - public ParticleSystem(ParticleTexture texture, float pps, float speed, float gravityComplient, float lifeLength, float scale) - { - this.pps = pps / 100000; - this.averageSpeed = speed; - this.gravityComplient = gravityComplient; - this.averageLifeLength = lifeLength; - this.averageScale = scale; - this.texture = texture; - } - - private void emitParticle(Vector3f center) - { - Vector3f velocity = null; - if (direction != null) - { - velocity = generateRandomUnitVectorWithinCone(direction, directionDeviation); - } - else - { - velocity = generateRandomUnitVector(); - } - velocity.normalize(); - velocity.mul(generateValue(averageSpeed, speedError)); - float scale = generateValue(averageScale, scaleError); - float lifeLength = generateValue(averageLifeLength, lifeError); - new Particle(texture, new Vector3f(center), velocity, gravityComplient, lifeLength, generateRotation(), new Vector3f(scale, scale, scale)); - } - - public void generateParticles(Vector3f systemCenter) - { - float delta = (float) Window.getTime(); - float particlesToCreate = pps * delta; - int count = (int) Math.floor(particlesToCreate); - float partialParticle = particlesToCreate % 1; - for (int i = 0; i < count; i++) - { emitParticle(systemCenter); } - if (Math.random() < partialParticle) - { emitParticle(systemCenter); } - } - - private Vector3f generateRandomUnitVector() - { - float theta = (float) (random.nextFloat() * 2f * Math.PI); - float z = (random.nextFloat() * 2) - 1; - float rootOneMinusZSquared = (float) Math.sqrt(1 - z * z); - float x = (float) (rootOneMinusZSquared * Math.cos(theta)); - float y = (float) (rootOneMinusZSquared * Math.sin(theta)); - return new Vector3f(x, y, z); - } - - private float generateRotation() - { - if (randomRotation) - { - return random.nextFloat() * 360f; - } - else - { - return 0; - } - } - - private float generateValue(float average, float errorMargin) - { - float offset = (random.nextFloat() - 0.5f) * 2f * errorMargin; - return average + offset; - } - - public void randomizeRotation() - { randomRotation = true; } - - /** @param direction - The average direction in which particles are emitted. - * @param deviation - A value between 0 and 1 indicating how far from the chosen direction particles can deviate. */ - public void setDirection(Vector3f direction, float deviation) - { - this.direction = new Vector3f(direction); - this.directionDeviation = (float) (deviation * Math.PI); - } - - /** @param error - * - A number between 0 and 1, where 0 means no error margin. */ - public void setLifeError(float error) - { this.lifeError = error * averageLifeLength; } - - /** @param error - * - A number between 0 and 1, where 0 means no error margin. */ - public void setScaleError(float error) - { this.scaleError = error * averageScale; } - - /** @param error - * - A number between 0 and 1, where 0 means no error margin. */ - public void setSpeedError(float error) - { this.speedError = error * averageSpeed; } -} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/ParticleTexture.java b/src/main/java/com/github/hydos/ginger/engine/openGL/particle/ParticleTexture.java deleted file mode 100644 index 28c8657..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/particle/ParticleTexture.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.particle; - -public class ParticleTexture -{ - private int textureID; - private int numberOfRows; - - public ParticleTexture(int textureID, int numberOfRows) - { - super(); - this.textureID = textureID; - this.numberOfRows = numberOfRows; - } - - public int getNumberOfRows() - { return numberOfRows; } - - public int getTextureID() - { return textureID; } -} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/postprocessing/Fbo.java b/src/main/java/com/github/hydos/ginger/engine/openGL/postprocessing/Fbo.java index 5c947ef..8d272c8 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/postprocessing/Fbo.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/postprocessing/Fbo.java @@ -8,8 +8,8 @@ import java.nio.ByteBuffer; import org.lwjgl.glfw.*; import org.lwjgl.system.Callback; +import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.openGL.fbo.FboCallbackHandler; -import com.github.hydos.ginger.engine.openGL.io.Window; public class Fbo { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/postprocessing/PostProcessing.java b/src/main/java/com/github/hydos/ginger/engine/openGL/postprocessing/PostProcessing.java index b20806d..bfe03eb 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/postprocessing/PostProcessing.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/postprocessing/PostProcessing.java @@ -3,7 +3,7 @@ package com.github.hydos.ginger.engine.openGL.postprocessing; import org.lwjgl.opengl.*; import com.github.hydos.ginger.engine.openGL.render.models.RawModel; -import com.github.hydos.ginger.engine.openGL.utils.Loader; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; public class PostProcessing { @@ -33,7 +33,7 @@ public class PostProcessing public static void init() { - quad = Loader.loadToVAO(POSITIONS, 2); + quad = GlLoader.loadToVAO(POSITIONS, 2); contrastChanger = new ContrastChanger(); } diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/MasterRenderer.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/MasterRenderer.java index 98dc264..f63d531 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/MasterRenderer.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/MasterRenderer.java @@ -8,10 +8,10 @@ import org.lwjgl.opengl.*; import com.github.halotroop.litecraft.world.World; import com.github.halotroop.litecraft.world.block.BlockRenderer; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.elements.GuiTexture; -import com.github.hydos.ginger.engine.openGL.elements.objects.*; -import com.github.hydos.ginger.engine.openGL.io.Window; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.elements.GuiTexture; +import com.github.hydos.ginger.engine.common.elements.objects.*; +import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; import com.github.hydos.ginger.engine.openGL.render.renderers.*; import com.github.hydos.ginger.engine.openGL.render.shaders.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/GuiRenderer.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/GuiRenderer.java index cf2884d..2c1246e 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/GuiRenderer.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/GuiRenderer.java @@ -5,12 +5,12 @@ import java.util.List; import org.joml.Matrix4f; import org.lwjgl.opengl.*; -import com.github.hydos.ginger.engine.openGL.elements.GuiTexture; -import com.github.hydos.ginger.engine.openGL.math.Maths; +import com.github.hydos.ginger.engine.common.elements.GuiTexture; +import com.github.hydos.ginger.engine.common.math.Maths; import com.github.hydos.ginger.engine.openGL.render.Renderer; import com.github.hydos.ginger.engine.openGL.render.models.RawModel; import com.github.hydos.ginger.engine.openGL.render.shaders.GuiShader; -import com.github.hydos.ginger.engine.openGL.utils.Loader; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; public class GuiRenderer extends Renderer { @@ -24,7 +24,7 @@ public class GuiRenderer extends Renderer { -1, 1, -1, -1, 1, 1, 1, -1 }; - quad = Loader.loadToVAO(positions, 2); + quad = GlLoader.loadToVAO(positions, 2); } public void cleanUp() diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/NormalMappingRenderer.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/NormalMappingRenderer.java index 694b9ab..68729b6 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/NormalMappingRenderer.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/NormalMappingRenderer.java @@ -5,10 +5,10 @@ import java.util.*; import org.joml.*; import org.lwjgl.opengl.*; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.elements.objects.*; -import com.github.hydos.ginger.engine.openGL.io.Window; -import com.github.hydos.ginger.engine.openGL.math.Maths; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.elements.objects.*; +import com.github.hydos.ginger.engine.common.io.Window; +import com.github.hydos.ginger.engine.common.math.Maths; import com.github.hydos.ginger.engine.openGL.render.*; import com.github.hydos.ginger.engine.openGL.render.models.*; import com.github.hydos.ginger.engine.openGL.render.shaders.NormalMappingShader; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/ObjectRenderer.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/ObjectRenderer.java index 7771b20..bc45ca3 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/ObjectRenderer.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/ObjectRenderer.java @@ -6,10 +6,10 @@ import org.joml.Matrix4f; import org.lwjgl.opengl.*; import com.github.halotroop.litecraft.types.block.BlockInstance; -import com.github.hydos.ginger.engine.openGL.api.GingerRegister; -import com.github.hydos.ginger.engine.openGL.elements.objects.RenderObject; -import com.github.hydos.ginger.engine.openGL.io.Window; -import com.github.hydos.ginger.engine.openGL.math.Maths; +import com.github.hydos.ginger.engine.common.api.GingerRegister; +import com.github.hydos.ginger.engine.common.elements.objects.RenderObject; +import com.github.hydos.ginger.engine.common.io.Window; +import com.github.hydos.ginger.engine.common.math.Maths; import com.github.hydos.ginger.engine.openGL.render.*; import com.github.hydos.ginger.engine.openGL.render.models.*; import com.github.hydos.ginger.engine.openGL.render.shaders.StaticShader; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/ParticleRenderer.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/ParticleRenderer.java deleted file mode 100644 index a6f4d90..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/ParticleRenderer.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.render.renderers; - -import java.lang.Math; -import java.nio.FloatBuffer; -import java.util.*; - -import org.joml.*; -import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.*; - -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.math.Maths; -import com.github.hydos.ginger.engine.openGL.particle.*; -import com.github.hydos.ginger.engine.openGL.render.Renderer; -import com.github.hydos.ginger.engine.openGL.render.models.RawModel; -import com.github.hydos.ginger.engine.openGL.render.shaders.ParticleShader; -import com.github.hydos.ginger.engine.openGL.utils.Loader; - -public class ParticleRenderer extends Renderer -{ - private static final float[] VERTICES = - { - -0.5f, 0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f, -0.5f - }; - private static final int MAX_INSTANCES = 10000; - private static final int INSTANCE_DATA_LENGTH = 21; - private static final FloatBuffer buffer = BufferUtils.createFloatBuffer(MAX_INSTANCES * INSTANCE_DATA_LENGTH); - private RawModel quad; - private ParticleShader shader; - private int vbo; - private int pointer; - - public ParticleRenderer(Matrix4f projectionMatrix) - { - quad = Loader.loadToVAO(VERTICES, 2); - this.vbo = Loader.createEmptyVbo(INSTANCE_DATA_LENGTH * MAX_INSTANCES); - Loader.addInstancedAttribute(quad.getVaoID(), vbo, 1, 4, INSTANCE_DATA_LENGTH, 0); - Loader.addInstancedAttribute(quad.getVaoID(), vbo, 2, 4, INSTANCE_DATA_LENGTH, 4); - Loader.addInstancedAttribute(quad.getVaoID(), vbo, 3, 4, INSTANCE_DATA_LENGTH, 8); - Loader.addInstancedAttribute(quad.getVaoID(), vbo, 4, 4, INSTANCE_DATA_LENGTH, 12); - Loader.addInstancedAttribute(quad.getVaoID(), vbo, 5, 4, INSTANCE_DATA_LENGTH, 16); - Loader.addInstancedAttribute(quad.getVaoID(), vbo, 6, 1, INSTANCE_DATA_LENGTH, 20); - shader = new ParticleShader(); - shader.start(); - shader.loadProjectionMatrix(projectionMatrix); - shader.stop(); - } - - private void bindTexture(ParticleTexture texture) - { - GL13.glActiveTexture(GL13.GL_TEXTURE0); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID()); - shader.loadNumberOfRows(texture.getNumberOfRows()); - } - - public void cleanUp() - { shader.cleanUp(); } - - private void finishRendering() - { - shader.stop(); - GL30.glBindVertexArray(0); - GL11.glDisable(GL11.GL_BLEND); - GL20.glDisableVertexAttribArray(0); - GL20.glDisableVertexAttribArray(1); - GL20.glDisableVertexAttribArray(2); - GL20.glDisableVertexAttribArray(3); - GL20.glDisableVertexAttribArray(4); - GL20.glDisableVertexAttribArray(5); - GL20.glDisableVertexAttribArray(6); - } - - private void prepare() - { - shader.start(); - GL30.glBindVertexArray(quad.getVaoID()); - GL20.glEnableVertexAttribArray(0); - GL20.glEnableVertexAttribArray(1); - GL20.glEnableVertexAttribArray(2); - GL20.glEnableVertexAttribArray(3); - GL20.glEnableVertexAttribArray(4); - GL20.glEnableVertexAttribArray(5); - GL20.glEnableVertexAttribArray(6); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);//TODO: add all particle effects into 1 texture to fix overlapping - } - - public void render(Map> particles, Camera camera) - { - Matrix4f viewMatrix = Maths.createViewMatrix(camera); - prepare(); - for (ParticleTexture texture : particles.keySet()) - { - bindTexture(texture); - List particleList = particles.get(texture); - pointer = 0; - float[] vboData = new float[particleList.size() * INSTANCE_DATA_LENGTH]; - for (Particle particle : particleList) - { - updateModelViewMatrix(particle.getPosition(), particle.getRotation(), particle.getScale().x, viewMatrix, vboData); - updateTexCoordInfo(particle, vboData); - } - Loader.updateVbo(vbo, vboData, buffer); - GL31.glDrawArraysInstanced(GL11.GL_TRIANGLE_STRIP, 0, quad.getVertexCount(), particleList.size()); - } - finishRendering(); - } - - private void storeMatrixData(Matrix4f matrix, float[] vboData) - { - vboData[pointer++] = matrix.m00(); - vboData[pointer++] = matrix.m01(); - vboData[pointer++] = matrix.m02(); - vboData[pointer++] = matrix.m03(); - vboData[pointer++] = matrix.m10(); - vboData[pointer++] = matrix.m11(); - vboData[pointer++] = matrix.m12(); - vboData[pointer++] = matrix.m13(); - vboData[pointer++] = matrix.m20(); - vboData[pointer++] = matrix.m21(); - vboData[pointer++] = matrix.m22(); - vboData[pointer++] = matrix.m23(); - vboData[pointer++] = matrix.m30(); - vboData[pointer++] = matrix.m31(); - vboData[pointer++] = matrix.m32(); - vboData[pointer++] = matrix.m33(); - } - - private void updateModelViewMatrix(Vector3f position, float rotation, float scale, Matrix4f viewMatrix, float[] vboData) - { - Matrix4f modelMatrix = new Matrix4f(); - modelMatrix.translate(position, modelMatrix); - modelMatrix._m00(viewMatrix.m00()); - modelMatrix._m01(viewMatrix.m10()); - modelMatrix._m02(viewMatrix.m20()); - modelMatrix._m10(viewMatrix.m01()); - modelMatrix._m11(viewMatrix.m11()); - modelMatrix._m12(viewMatrix.m21()); - modelMatrix._m20(viewMatrix.m02()); - modelMatrix._m21(viewMatrix.m12()); - modelMatrix._m22(viewMatrix.m22()); - modelMatrix.rotate((float) Math.toRadians(rotation), new Vector3f(0, 0, 1), modelMatrix); - modelMatrix.scale(new Vector3f(scale, scale, scale), modelMatrix); - Matrix4f modelViewMatrix = viewMatrix.mul(modelMatrix); - storeMatrixData(modelViewMatrix, vboData); - } - - private void updateTexCoordInfo(Particle particle, float[] data) - { - data[pointer++] = particle.getTexOffset1().x; - data[pointer++] = particle.getTexOffset1().y; - data[pointer++] = particle.getTexOffset2().x; - data[pointer++] = particle.getTexOffset2().y; - data[pointer++] = particle.getBlend(); - } -} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/SkyboxRenderer.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/SkyboxRenderer.java index 79ff45b..6d90742 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/SkyboxRenderer.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/renderers/SkyboxRenderer.java @@ -3,11 +3,11 @@ package com.github.hydos.ginger.engine.openGL.render.renderers; import org.joml.Matrix4f; import org.lwjgl.opengl.*; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; +import com.github.hydos.ginger.engine.common.cameras.Camera; import com.github.hydos.ginger.engine.openGL.render.Renderer; import com.github.hydos.ginger.engine.openGL.render.models.RawModel; import com.github.hydos.ginger.engine.openGL.render.shaders.SkyboxShader; -import com.github.hydos.ginger.engine.openGL.utils.Loader; +import com.github.hydos.ginger.engine.openGL.utils.GlLoader; public class SkyboxRenderer extends Renderer { @@ -62,8 +62,8 @@ public class SkyboxRenderer extends Renderer public SkyboxRenderer(Matrix4f projectionMatrix) { - cube = Loader.loadToVAO(VERTICES, 3); - texture = Loader.loadCubeMap(TEXTURE_FILES); + cube = GlLoader.loadToVAO(VERTICES, 3); + texture = GlLoader.loadCubeMap(TEXTURE_FILES); shader = new SkyboxShader(); shader.start(); shader.loadProjectionMatrix(projectionMatrix); diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/NormalMappingShader.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/NormalMappingShader.java index 0cdfa9e..552b78b 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/NormalMappingShader.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/NormalMappingShader.java @@ -4,7 +4,7 @@ import java.util.List; import org.joml.*; -import com.github.hydos.ginger.engine.openGL.elements.objects.Light; +import com.github.hydos.ginger.engine.common.elements.objects.Light; public class NormalMappingShader extends ShaderProgram { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/SkyboxShader.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/SkyboxShader.java index 4e07115..f960a90 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/SkyboxShader.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/SkyboxShader.java @@ -2,8 +2,8 @@ package com.github.hydos.ginger.engine.openGL.render.shaders; import org.joml.Matrix4f; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.math.Maths; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.math.Maths; public class SkyboxShader extends ShaderProgram { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/StaticShader.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/StaticShader.java index 652329b..c687e3f 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/StaticShader.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/StaticShader.java @@ -4,9 +4,9 @@ import java.util.List; import org.joml.*; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.elements.objects.Light; -import com.github.hydos.ginger.engine.openGL.math.Maths; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.elements.objects.Light; +import com.github.hydos.ginger.engine.common.math.Maths; public class StaticShader extends ShaderProgram { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/TerrainShader.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/TerrainShader.java index d64b129..9d375f9 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/TerrainShader.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/shaders/TerrainShader.java @@ -4,9 +4,9 @@ import java.util.List; import org.joml.*; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.elements.objects.Light; -import com.github.hydos.ginger.engine.openGL.math.Maths; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.elements.objects.Light; +import com.github.hydos.ginger.engine.common.math.Maths; public class TerrainShader extends ShaderProgram { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/render/tools/MousePicker.java b/src/main/java/com/github/hydos/ginger/engine/openGL/render/tools/MousePicker.java index 054b493..90e714e 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/render/tools/MousePicker.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/render/tools/MousePicker.java @@ -2,9 +2,9 @@ package com.github.hydos.ginger.engine.openGL.render.tools; import org.joml.*; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.io.Window; -import com.github.hydos.ginger.engine.openGL.math.Maths; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.io.Window; +import com.github.hydos.ginger.engine.common.math.Maths; public class MousePicker { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/screen/Screen.java b/src/main/java/com/github/hydos/ginger/engine/openGL/screen/Screen.java index cfa639e..87f4b8c 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/screen/Screen.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/screen/Screen.java @@ -2,7 +2,7 @@ package com.github.hydos.ginger.engine.openGL.screen; import java.util.List; -import com.github.hydos.ginger.engine.openGL.elements.GuiTexture; +import com.github.hydos.ginger.engine.common.elements.GuiTexture; public abstract class Screen { diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowBox.java b/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowBox.java index 4f52329..fc01d0f 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowBox.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowBox.java @@ -4,8 +4,8 @@ import java.lang.Math; import org.joml.*; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.io.Window; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.openGL.render.MasterRenderer; /** Represents the 3D cuboidal area of the world in which objects will cast diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowFrameBuffer.java b/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowFrameBuffer.java index 7209465..7c02d69 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowFrameBuffer.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowFrameBuffer.java @@ -4,7 +4,7 @@ import java.nio.ByteBuffer; import org.lwjgl.opengl.*; -import com.github.hydos.ginger.engine.openGL.io.Window; +import com.github.hydos.ginger.engine.common.io.Window; /** The frame buffer for the shadow pass. This class sets up the depth texture * which can be rendered to during the shadow render pass, producing a shadow diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowMapEntityRenderer.java b/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowMapEntityRenderer.java index 0b46761..b381389 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowMapEntityRenderer.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowMapEntityRenderer.java @@ -5,8 +5,8 @@ import java.util.*; import org.joml.Matrix4f; import org.lwjgl.opengl.*; -import com.github.hydos.ginger.engine.openGL.elements.objects.RenderObject; -import com.github.hydos.ginger.engine.openGL.math.Maths; +import com.github.hydos.ginger.engine.common.elements.objects.RenderObject; +import com.github.hydos.ginger.engine.common.math.Maths; import com.github.hydos.ginger.engine.openGL.render.MasterRenderer; import com.github.hydos.ginger.engine.openGL.render.models.*; diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowMapMasterRenderer.java b/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowMapMasterRenderer.java index 459d149..3efa5d1 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowMapMasterRenderer.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/shadow/ShadowMapMasterRenderer.java @@ -6,8 +6,8 @@ import java.util.*; import org.joml.*; import org.lwjgl.opengl.GL11; -import com.github.hydos.ginger.engine.openGL.cameras.Camera; -import com.github.hydos.ginger.engine.openGL.elements.objects.*; +import com.github.hydos.ginger.engine.common.cameras.Camera; +import com.github.hydos.ginger.engine.common.elements.objects.*; import com.github.hydos.ginger.engine.openGL.render.models.TexturedModel; /** This class is in charge of using all of the classes in the shadows package to diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/terrain/TerrainTexture.java b/src/main/java/com/github/hydos/ginger/engine/openGL/terrain/TerrainTexture.java deleted file mode 100644 index 86f3628..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/terrain/TerrainTexture.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.terrain; - -public class TerrainTexture -{ - private int textureID; - - public TerrainTexture(int textureID) - { - super(); - this.textureID = textureID; - } - - public int getTextureID() - { return textureID; } -} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/terrain/TerrainTexturePack.java b/src/main/java/com/github/hydos/ginger/engine/openGL/terrain/TerrainTexturePack.java deleted file mode 100644 index 2abc7d5..0000000 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/terrain/TerrainTexturePack.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.github.hydos.ginger.engine.openGL.terrain; - -public class TerrainTexturePack -{ - private TerrainTexture backgroundTexture; - private TerrainTexture rTexture; - private TerrainTexture gTexture; - private TerrainTexture bTexture; - - public TerrainTexturePack(TerrainTexture backgroundTexture, TerrainTexture rTexture, TerrainTexture gTexture, - TerrainTexture bTexture) - { - this.backgroundTexture = backgroundTexture; - this.rTexture = rTexture; - this.gTexture = gTexture; - this.bTexture = bTexture; - } - - public TerrainTexture getBackgroundTexture() - { return backgroundTexture; } - - public TerrainTexture getbTexture() - { return bTexture; } - - public TerrainTexture getgTexture() - { return gTexture; } - - public TerrainTexture getrTexture() - { return rTexture; } -} diff --git a/src/main/java/com/github/hydos/ginger/engine/openGL/utils/Loader.java b/src/main/java/com/github/hydos/ginger/engine/openGL/utils/GlLoader.java similarity index 96% rename from src/main/java/com/github/hydos/ginger/engine/openGL/utils/Loader.java rename to src/main/java/com/github/hydos/ginger/engine/openGL/utils/GlLoader.java index af3f771..8450ff0 100644 --- a/src/main/java/com/github/hydos/ginger/engine/openGL/utils/Loader.java +++ b/src/main/java/com/github/hydos/ginger/engine/openGL/utils/GlLoader.java @@ -7,12 +7,11 @@ import org.lwjgl.BufferUtils; import org.lwjgl.opengl.*; import com.github.halotroop.litecraft.types.block.*; -import com.github.hydos.ginger.engine.openGL.io.Window; +import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.openGL.render.models.RawModel; import com.github.hydos.ginger.engine.openGL.render.texture.*; -import com.github.hydos.ginger.engine.openGL.terrain.TerrainTexture; -public class Loader +public class GlLoader { private static List vaos = new ArrayList(); private static List vbos = new ArrayList(); @@ -100,9 +99,6 @@ public class Loader return textureID; } - public static TerrainTexture loadTerrainTexture(String string) - { return new TerrainTexture(new ModelTexture("terrain/" + string).getTextureID()); } - public static int loadTexture(String path) { return loadTextureDirectly("/textures/" + path); } diff --git a/src/main/java/com/github/hydos/ginger/engine/vulkan/api/GingerV.java b/src/main/java/com/github/hydos/ginger/engine/vulkan/api/GingerV.java new file mode 100644 index 0000000..b34d023 --- /dev/null +++ b/src/main/java/com/github/hydos/ginger/engine/vulkan/api/GingerV.java @@ -0,0 +1,5 @@ +package com.github.hydos.ginger.engine.vulkan.api; + +public class GingerV { + +} diff --git a/src/main/java/com/github/hydos/ginger/engine/vulkan/utils/VLoader.java b/src/main/java/com/github/hydos/ginger/engine/vulkan/utils/VLoader.java new file mode 100644 index 0000000..f3322ef --- /dev/null +++ b/src/main/java/com/github/hydos/ginger/engine/vulkan/utils/VLoader.java @@ -0,0 +1,10 @@ +package com.github.hydos.ginger.engine.vulkan.utils; +/** + * + * @author hayden + * used to load vulkan related objects such as textures + * + */ +public class VLoader { + +} diff --git a/src/main/java/com/github/hydos/multithreading/GingerThreading.java b/src/main/java/com/github/hydos/multithreading/GingerThreading.java index 461c23e..b68054d 100644 --- a/src/main/java/com/github/hydos/multithreading/GingerThreading.java +++ b/src/main/java/com/github/hydos/multithreading/GingerThreading.java @@ -3,7 +3,7 @@ package com.github.hydos.multithreading; import java.util.*; import com.github.halotroop.litecraft.Litecraft; -import com.github.hydos.ginger.engine.openGL.io.Window; +import com.github.hydos.ginger.engine.common.io.Window; public class GingerThreading extends Thread {