From 038ea02cd6707b49cf2f5e9f2ffda4724f977790 Mon Sep 17 00:00:00 2001 From: hYdos Date: Sat, 22 Feb 2020 09:04:43 +1000 Subject: [PATCH] ginger3D is now jut a library again --- .../io/github/hydos/ginger/UI/UIManager.java | 28 ------ .../ginger/UI/canvases/WelcomeScreen.java | 24 ----- .../hydos/ginger/UI/enums/UIColourType.java | 6 -- .../ginger/UI/enums/UIDefaultClipSide.java | 6 -- .../github/hydos/ginger/UI/enums/UIType.java | 6 -- .../engine/cameras/FirstPersonCamera.java | 51 ----------- .../ginger/engine/elements/GuiTexture.java | 34 -------- .../elements/buttons/TextureButton.java | 86 ------------------ .../engine/elements/objects/Entity.java | 73 ---------------- .../ginger/engine/elements/objects/Light.java | 39 --------- .../engine/elements/objects/RenderPlayer.java | 84 ------------------ .../hydos/ginger/engine/font/Character.java | 87 ------------------- .../hydos/ginger/engine/font/FontType.java | 37 -------- .../ginger/engine/font/TextMeshData.java | 23 ----- .../hydos/ginger/engine/obj/ModelData.java | 35 -------- .../hydos/ginger/engine/obj/ModelLoader.java | 15 ---- .../hydos/ginger/engine/obj/Vertex.java | 54 ------------ .../engine/obj/normals/ModelDataNM.java | 40 --------- .../ginger/engine/particle/InsertionSort.java | 32 ------- .../engine/particle/ParticleTexture.java | 20 ----- .../engine/postprocessing/ContrastShader.java | 20 ----- .../engine/postprocessing/ImageRenderer.java | 33 ------- .../ginger/engine/render/models/RawModel.java | 19 ---- .../engine/render/models/TexturedModel.java | 21 ----- .../engine/render/shaders/GuiShader.java | 24 ----- .../engine/render/shaders/ParticleShader.java | 36 -------- .../ginger/engine/shadow/ShadowShader.java | 29 ------- .../ginger/engine/terrain/TerrainTexture.java | 15 ---- .../engine/terrain/TerrainTexturePack.java | 30 ------- .../hydos/ginger/main/settings/Constants.java | 15 ---- .../ginger/main/tools/GSceneBuilder.java | 6 -- 31 files changed, 1028 deletions(-) delete mode 100644 src/main/java/io/github/hydos/ginger/UI/UIManager.java delete mode 100644 src/main/java/io/github/hydos/ginger/UI/canvases/WelcomeScreen.java delete mode 100644 src/main/java/io/github/hydos/ginger/UI/enums/UIColourType.java delete mode 100644 src/main/java/io/github/hydos/ginger/UI/enums/UIDefaultClipSide.java delete mode 100644 src/main/java/io/github/hydos/ginger/UI/enums/UIType.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/cameras/FirstPersonCamera.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/elements/GuiTexture.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/elements/buttons/TextureButton.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/elements/objects/Entity.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/elements/objects/Light.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/elements/objects/RenderPlayer.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/font/Character.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/font/FontType.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/font/TextMeshData.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/obj/ModelData.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/obj/ModelLoader.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/obj/Vertex.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/obj/normals/ModelDataNM.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/particle/InsertionSort.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/particle/ParticleTexture.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/postprocessing/ContrastShader.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/postprocessing/ImageRenderer.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/render/models/RawModel.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/render/models/TexturedModel.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/render/shaders/GuiShader.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/render/shaders/ParticleShader.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/shadow/ShadowShader.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/terrain/TerrainTexture.java delete mode 100644 src/main/java/io/github/hydos/ginger/engine/terrain/TerrainTexturePack.java delete mode 100644 src/main/java/io/github/hydos/ginger/main/settings/Constants.java delete mode 100644 src/main/java/io/github/hydos/ginger/main/tools/GSceneBuilder.java diff --git a/src/main/java/io/github/hydos/ginger/UI/UIManager.java b/src/main/java/io/github/hydos/ginger/UI/UIManager.java deleted file mode 100644 index 699ccc6..0000000 --- a/src/main/java/io/github/hydos/ginger/UI/UIManager.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.github.hydos.ginger.UI; - -import io.github.hydos.ginger.UI.canvases.WelcomeScreen; -import io.github.hydos.ginger.UI.enums.UIColourType; -import io.github.hydos.ginger.engine.elements.GuiTexture; - -public class UIManager -{ - UIColourType colourMode = UIColourType.dark; - GuiTexture background; - UICanvas welcomeScreen; - - public UIManager(UIColourType type) - { - if (type == UIColourType.dark) - { - // background = new GuiTexture(Loader.loadTextureDirectly("/engine/ui/dark/background/background.png"), new Vector2f(0,0), new Vector2f(10,10)); - } - this.colourMode = type; - welcomeScreen = new WelcomeScreen(); - } - - public void update() - { welcomeScreen.update(); } - - public GuiTexture getBackgroundTexture() - { return background; } -} diff --git a/src/main/java/io/github/hydos/ginger/UI/canvases/WelcomeScreen.java b/src/main/java/io/github/hydos/ginger/UI/canvases/WelcomeScreen.java deleted file mode 100644 index 5d9a399..0000000 --- a/src/main/java/io/github/hydos/ginger/UI/canvases/WelcomeScreen.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.github.hydos.ginger.UI.canvases; - -import java.util.List; - -import io.github.hydos.ginger.UI.UICanvas; -import io.github.hydos.ginger.engine.elements.GuiTexture; - -public class WelcomeScreen extends UICanvas -{ - public WelcomeScreen() - {} - - @Override - public void update() - {} - - @Override - public void hide(List textures) - {} - - @Override - public void show(List textures) - {} -} diff --git a/src/main/java/io/github/hydos/ginger/UI/enums/UIColourType.java b/src/main/java/io/github/hydos/ginger/UI/enums/UIColourType.java deleted file mode 100644 index 8c9506f..0000000 --- a/src/main/java/io/github/hydos/ginger/UI/enums/UIColourType.java +++ /dev/null @@ -1,6 +0,0 @@ -package io.github.hydos.ginger.UI.enums; - -public enum UIColourType -{ - light, dark -} diff --git a/src/main/java/io/github/hydos/ginger/UI/enums/UIDefaultClipSide.java b/src/main/java/io/github/hydos/ginger/UI/enums/UIDefaultClipSide.java deleted file mode 100644 index a782000..0000000 --- a/src/main/java/io/github/hydos/ginger/UI/enums/UIDefaultClipSide.java +++ /dev/null @@ -1,6 +0,0 @@ -package io.github.hydos.ginger.UI.enums; - -public enum UIDefaultClipSide -{ - top, bottom, left, right, centre -} diff --git a/src/main/java/io/github/hydos/ginger/UI/enums/UIType.java b/src/main/java/io/github/hydos/ginger/UI/enums/UIType.java deleted file mode 100644 index 30ee715..0000000 --- a/src/main/java/io/github/hydos/ginger/UI/enums/UIType.java +++ /dev/null @@ -1,6 +0,0 @@ -package io.github.hydos.ginger.UI.enums; - -public enum UIType -{ - tab, wholeScreen -} diff --git a/src/main/java/io/github/hydos/ginger/engine/cameras/FirstPersonCamera.java b/src/main/java/io/github/hydos/ginger/engine/cameras/FirstPersonCamera.java deleted file mode 100644 index 8aa3819..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/cameras/FirstPersonCamera.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.github.hydos.ginger.engine.cameras; - -import org.joml.Vector3f; -import org.lwjgl.glfw.GLFW; - -import io.github.hydos.ginger.engine.io.Window; - -public class FirstPersonCamera -{ - private Vector3f position = new Vector3f(0, 0, 0); - private float pitch, yaw; - private float roll; - - public FirstPersonCamera() - {} - - public FirstPersonCamera(Vector3f vector3f) - { this.position = vector3f; } - - public void move() - { - if (Window.isKeyDown(GLFW.GLFW_KEY_W)) - { position.z -= 0.05f; } - if (Window.isKeyDown(GLFW.GLFW_KEY_A)) - { position.x -= 0.05f; } - if (Window.isKeyDown(GLFW.GLFW_KEY_S)) - { position.z -= -0.05f; } - if (Window.isKeyDown(GLFW.GLFW_KEY_D)) - { position.x += 0.05f; } - if (Window.isKeyDown(GLFW.GLFW_KEY_SPACE)) - { position.y += 0.05f; } - if (Window.isKeyDown(GLFW.GLFW_KEY_LEFT_SHIFT)) - { position.y -= 0.05f; } - if (Window.isKeyDown(GLFW.GLFW_KEY_LEFT)) - { yaw -= 0.5f; } - if (Window.isKeyDown(GLFW.GLFW_KEY_RIGHT)) - { yaw += 0.5f; } - } - - public Vector3f getPosition() - { return position; } - - public float getPitch() - { return pitch; } - - public float getYaw() - { return yaw; } - - public float getRoll() - { return roll; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/elements/GuiTexture.java b/src/main/java/io/github/hydos/ginger/engine/elements/GuiTexture.java deleted file mode 100644 index 7d9db65..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/elements/GuiTexture.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.github.hydos.ginger.engine.elements; - -import org.joml.Vector2f; - -public class GuiTexture -{ - private int texture; - private Vector2f position, scale; - - public GuiTexture(int texture, Vector2f position, Vector2f scale) - { - this.texture = texture; - this.position = position; - this.scale = scale; - } - - public int getTexture() - { return texture; } - - public Vector2f getPosition() - { return position; } - - public Vector2f getScale() - { return scale; } - - public void setTexture(int texture) - { this.texture = texture; } - - public void setPosition(Vector2f position) - { this.position = position; } - - public void setScale(Vector2f scale) - { this.scale = scale; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/elements/buttons/TextureButton.java b/src/main/java/io/github/hydos/ginger/engine/elements/buttons/TextureButton.java deleted file mode 100644 index 378ad20..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/elements/buttons/TextureButton.java +++ /dev/null @@ -1,86 +0,0 @@ -package io.github.hydos.ginger.engine.elements.buttons; - -import java.util.List; - -import org.joml.Vector2f; -import org.lwjgl.glfw.GLFW; - -import io.github.hydos.ginger.engine.elements.GuiTexture; -import io.github.hydos.ginger.engine.io.Window; -import io.github.hydos.ginger.engine.utils.Loader; - -public class TextureButton -{ - private GuiTexture guiTexture; - private boolean shown = false; - private boolean clicked = false; - private boolean isHovering = false; - - public TextureButton(String texture, Vector2f position, Vector2f scale) - { guiTexture = new GuiTexture(Loader.loadTextureDirectly(texture), position, scale); } - - public void update() - { - if (shown) - { - Vector2f location = guiTexture.getPosition(); - Vector2f scale = guiTexture.getScale(); - Vector2f mouseCoords = Window.getNormalizedMouseCoordinates(); - if (location.y + scale.y > -mouseCoords.y && location.y - scale.y < -mouseCoords.y && location.x + scale.x > mouseCoords.x && location.x - scale.x < mouseCoords.x) - { - isHovering = true; - if (Window.isMousePressed(GLFW.GLFW_MOUSE_BUTTON_1)) - { - clicked = true; - } - else - { - clicked = false; - } - } - else - { - if (isHovering) - { isHovering = false; } - } - } - else - { - isHovering = false; - clicked = false; - } - } - - public void show(List guiTexture) - { - if (shown) - { - } - else - { - guiTexture.add(this.guiTexture); - this.shown = true; - } - } - - public void hide(List guiTexture) - { - if (!shown) - { - } - else - { - guiTexture.remove(this.guiTexture); - this.shown = false; - } - } - - public boolean isShown() - { return shown; } - - public boolean isClicked() - { return clicked; } - - public boolean isHovering() - { return isHovering; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/elements/objects/Entity.java b/src/main/java/io/github/hydos/ginger/engine/elements/objects/Entity.java deleted file mode 100644 index 93243d5..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/elements/objects/Entity.java +++ /dev/null @@ -1,73 +0,0 @@ -package io.github.hydos.ginger.engine.elements.objects; - -import org.joml.Vector3f; - -import io.github.hydos.ginger.engine.render.models.TexturedModel; - -public class Entity -{ - private TexturedModel model; - private Vector3f position; - private float rotX = 0, rotY = 0, rotZ = 0; - private Vector3f scale; - - public Entity(TexturedModel model, Vector3f position, float rotX, float rotY, float rotZ, Vector3f scale) - { - this.model = model; - this.position = position; - this.rotX = rotX; - this.rotY = rotY; - this.rotZ = rotZ; - this.scale = scale; - } - - public void increasePosition(float dx, float dy, float dz) - { - this.position.x += dx; - this.position.y += dy; - this.position.z += dz; - } - - public void increaseRotation(float dx, float dy, float dz) - { - this.rotX += dx; - this.rotY += dy; - this.rotZ += dz; - } - - public TexturedModel getModel() - { return model; } - - public void setModel(TexturedModel model) - { this.model = model; } - - public Vector3f getPosition() - { return position; } - - public void setPosition(Vector3f position) - { this.position = position; } - - public float getRotX() - { return rotX; } - - public void setRotX(float rotX) - { this.rotX = rotX; } - - public float getRotY() - { return rotY; } - - public void setRotY(float rotY) - { this.rotY = rotY; } - - public float getRotZ() - { return rotZ; } - - public void setRotZ(float rotZ) - { this.rotZ = rotZ; } - - public Vector3f getScale() - { return scale; } - - public void setScale(Vector3f scale) - { this.scale = scale; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/elements/objects/Light.java b/src/main/java/io/github/hydos/ginger/engine/elements/objects/Light.java deleted file mode 100644 index 9ba10e1..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/elements/objects/Light.java +++ /dev/null @@ -1,39 +0,0 @@ -package io.github.hydos.ginger.engine.elements.objects; - -import org.joml.Vector3f; - -public class Light -{ - private Vector3f position, colour, attenuation; - - public Light(Vector3f position, Vector3f colour) - { - this.position = position; - this.colour = colour; - } - - public Light(Vector3f position, Vector3f colour, Vector3f attenuation) - { - this.position = position; - this.colour = colour; - this.attenuation = attenuation; - } - - public void setAttenuation(Vector3f a) - { this.attenuation = a; } - - public Vector3f getPosition() - { return position; } - - public Vector3f getColour() - { return colour; } - - public void setPosition(Vector3f position) - { this.position = position; } - - public void setColour(Vector3f colour) - { this.colour = colour; } - - public Vector3f getAttenuation() - { return attenuation; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/elements/objects/RenderPlayer.java b/src/main/java/io/github/hydos/ginger/engine/elements/objects/RenderPlayer.java deleted file mode 100644 index 2483f61..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/elements/objects/RenderPlayer.java +++ /dev/null @@ -1,84 +0,0 @@ -package io.github.hydos.ginger.engine.elements.objects; - -import org.joml.Vector3f; -import org.lwjgl.glfw.GLFW; - -import io.github.hydos.ginger.engine.io.Window; -import io.github.hydos.ginger.engine.render.models.TexturedModel; -import io.github.hydos.ginger.engine.terrain.Terrain; -import io.github.hydos.ginger.main.settings.Constants; - -public class RenderPlayer extends Entity -{ - // private static float RUN_SPEED = 0.3f; - // private static float TURN_SPEED = 0.7f; - // public static float GRAVITY = -0.04f; - // private static float JUMP_POWER = 0.3f; - private static float terrainHeight = 0; - private float currentSpeed = 0; - private float currentTurn = 0; - private float upwardsSpeed = 0; - private boolean isInAir = false; - - public RenderPlayer(TexturedModel model, Vector3f position, float rotX, float rotY, float rotZ, Vector3f scale) - { super(model, position, rotX, rotY, rotZ, scale); } - - public void move(Terrain t) - { - checkInputs(); - super.increaseRotation(0, (float) ((currentTurn) * Window.getTime()), 0); - float distance = (float) ((currentSpeed) * (Window.getTime())); - float dx = (float) (distance * Math.sin(Math.toRadians(super.getRotY()))); - float dz = (float) (distance * Math.cos(Math.toRadians(super.getRotY()))); - super.increasePosition(dx, 0, dz); - super.increasePosition(0, (float) (upwardsSpeed * (Window.getTime())), 0); - terrainHeight = t.getHeightOfTerrain(super.getPosition().x, super.getPosition().z); - upwardsSpeed += Constants.gravity * Window.getTime(); - if (super.getPosition().y < terrainHeight) - { - isInAir = false; - upwardsSpeed = 0; - super.getPosition().y = terrainHeight; - } - } - - private void jump() - { - if (!isInAir) - { - isInAir = true; - this.upwardsSpeed = Constants.jumpPower; - } - } - - private void checkInputs() - { - if (Window.isKeyDown(GLFW.GLFW_KEY_W)) - { - this.currentSpeed = Constants.movementSpeed; - } - else if (Window.isKeyDown(GLFW.GLFW_KEY_S)) - { - this.currentSpeed = -Constants.movementSpeed; - } - else - { - this.currentSpeed = 0; - } - if (Window.isKeyDown(GLFW.GLFW_KEY_A)) - { - this.currentTurn = Constants.turnSpeed; - } - else if (Window.isKeyDown(GLFW.GLFW_KEY_D)) - { this.currentTurn = -Constants.turnSpeed; } - if (Window.isKeyReleased(68) || Window.isKeyReleased(65)) - { this.currentTurn = 0; } - if (Window.isKeyDown(GLFW.GLFW_KEY_SPACE)) - { - jump(); - } - else - { - } - } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/font/Character.java b/src/main/java/io/github/hydos/ginger/engine/font/Character.java deleted file mode 100644 index 7d90135..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/font/Character.java +++ /dev/null @@ -1,87 +0,0 @@ -package io.github.hydos.ginger.engine.font; - -/** Simple data structure class holding information about a certain glyph in the - * font texture atlas. All sizes are for a font-size of 1. */ -public class Character -{ - private int id; - private double xTextureCoord; - private double yTextureCoord; - private double xMaxTextureCoord; - private double yMaxTextureCoord; - private double xOffset; - private double yOffset; - private double sizeX; - private double sizeY; - private double xAdvance; - - /** @param id - * - the ASCII value of the character. - * @param xTextureCoord - * - the x texture coordinate for the top left corner of the - * character in the texture atlas. - * @param yTextureCoord - * - the y texture coordinate for the top left corner of the - * character in the texture atlas. - * @param xTexSize - * - the width of the character in the texture atlas. - * @param yTexSize - * - the height of the character in the texture atlas. - * @param xOffset - * - the x distance from the curser to the left edge of the - * character's quad. - * @param yOffset - * - the y distance from the curser to the top edge of the - * character's quad. - * @param sizeX - * - the width of the character's quad in screen space. - * @param sizeY - * - the height of the character's quad in screen space. - * @param xAdvance - * - how far in pixels the cursor should advance after adding - * this character. */ - protected Character(int id, double xTextureCoord, double yTextureCoord, double xTexSize, double yTexSize, - double xOffset, double yOffset, double sizeX, double sizeY, double xAdvance) - { - this.id = id; - this.xTextureCoord = xTextureCoord; - this.yTextureCoord = yTextureCoord; - this.xOffset = xOffset; - this.yOffset = yOffset; - this.sizeX = sizeX; - this.sizeY = sizeY; - this.xMaxTextureCoord = xTexSize + xTextureCoord; - this.yMaxTextureCoord = yTexSize + yTextureCoord; - this.xAdvance = xAdvance; - } - - protected int getId() - { return id; } - - protected double getxTextureCoord() - { return xTextureCoord; } - - protected double getyTextureCoord() - { return yTextureCoord; } - - protected double getXMaxTextureCoord() - { return xMaxTextureCoord; } - - protected double getYMaxTextureCoord() - { return yMaxTextureCoord; } - - protected double getxOffset() - { return xOffset; } - - protected double getyOffset() - { return yOffset; } - - protected double getSizeX() - { return sizeX; } - - protected double getSizeY() - { return sizeY; } - - protected double getxAdvance() - { return xAdvance; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/font/FontType.java b/src/main/java/io/github/hydos/ginger/engine/font/FontType.java deleted file mode 100644 index 5090f05..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/font/FontType.java +++ /dev/null @@ -1,37 +0,0 @@ -package io.github.hydos.ginger.engine.font; - -/** Represents a font. It holds the font's texture atlas as well as having the - * ability to create the quad vertices for any text using this font. */ -public class FontType -{ - private int textureAtlas; - private TextMeshCreator loader; - - /** Creates a new font and loads up the data about each character from the - * font file. - * - * @param textureAtlas - * - the ID of the font atlas texture. - * @param fontFile - * - the font file containing information about each character in - * the texture atlas. */ - public FontType(int textureAtlas, String fontFile) - { - this.textureAtlas = textureAtlas; - this.loader = new TextMeshCreator(fontFile); - } - - /** @return The font texture atlas. */ - public int getTextureAtlas() - { return textureAtlas; } - - /** Takes in an unloaded text and calculate all of the vertices for the quads - * on which this text will be rendered. The vertex positions and texture - * coords and calculated based on the information from the font file. - * - * @param text - * - the unloaded text. - * @return Information about the vertices of all the quads. */ - public TextMeshData loadText(GUIText text) - { return loader.createTextMesh(text); } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/font/TextMeshData.java b/src/main/java/io/github/hydos/ginger/engine/font/TextMeshData.java deleted file mode 100644 index 2d3f474..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/font/TextMeshData.java +++ /dev/null @@ -1,23 +0,0 @@ -package io.github.hydos.ginger.engine.font; - -/** Stores the vertex data for all the quads on which a text will be rendered. */ -public class TextMeshData -{ - private float[] vertexPositions; - private float[] textureCoords; - - protected TextMeshData(float[] vertexPositions, float[] textureCoords) - { - this.vertexPositions = vertexPositions; - this.textureCoords = textureCoords; - } - - public float[] getVertexPositions() - { return vertexPositions; } - - public float[] getTextureCoords() - { return textureCoords; } - - public int getVertexCount() - { return vertexPositions.length / 2; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/obj/ModelData.java b/src/main/java/io/github/hydos/ginger/engine/obj/ModelData.java deleted file mode 100644 index af418d2..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/obj/ModelData.java +++ /dev/null @@ -1,35 +0,0 @@ -package io.github.hydos.ginger.engine.obj; - -public class ModelData -{ - private float[] vertices; - private float[] textureCoords; - private float[] normals; - private int[] indices; - private float furthestPoint; - - public ModelData(float[] vertices, float[] textureCoords, float[] normals, int[] indices, - float furthestPoint) - { - this.vertices = vertices; - this.textureCoords = textureCoords; - this.normals = normals; - this.indices = indices; - this.furthestPoint = furthestPoint; - } - - public float[] getVertices() - { return vertices; } - - public float[] getTextureCoords() - { return textureCoords; } - - public float[] getNormals() - { return normals; } - - public int[] getIndices() - { return indices; } - - public float getFurthestPoint() - { return furthestPoint; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/obj/ModelLoader.java b/src/main/java/io/github/hydos/ginger/engine/obj/ModelLoader.java deleted file mode 100644 index 0e064b8..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/obj/ModelLoader.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.github.hydos.ginger.engine.obj; - -import io.github.hydos.ginger.engine.render.models.TexturedModel; -import io.github.hydos.ginger.engine.render.texture.ModelTexture; -import io.github.hydos.ginger.engine.utils.Loader; - -public class ModelLoader -{ - public static TexturedModel loadModel(String objPath, String texturePath) - { - ModelData data = OBJFileLoader.loadOBJ(objPath); - TexturedModel tm = new TexturedModel(Loader.loadToVAO(data.getVertices(), data.getIndices(), data.getNormals(), data.getTextureCoords()), new ModelTexture(texturePath)); - return tm; - } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/obj/Vertex.java b/src/main/java/io/github/hydos/ginger/engine/obj/Vertex.java deleted file mode 100644 index 4c5f000..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/obj/Vertex.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.github.hydos.ginger.engine.obj; - -import org.joml.Vector3f; - -public class Vertex -{ - private static final int NO_INDEX = -1; - private Vector3f position; - private int textureIndex = NO_INDEX; - private int normalIndex = NO_INDEX; - private Vertex duplicateVertex = null; - private int index; - private float length; - - public Vertex(int index, Vector3f position) - { - this.index = index; - this.position = position; - this.length = position.length(); - } - - public int getIndex() - { return index; } - - public float getLength() - { return length; } - - public boolean isSet() - { return textureIndex != NO_INDEX && normalIndex != NO_INDEX; } - - public boolean hasSameTextureAndNormal(int textureIndexOther, int normalIndexOther) - { return textureIndexOther == textureIndex && normalIndexOther == normalIndex; } - - public void setTextureIndex(int textureIndex) - { this.textureIndex = textureIndex; } - - public void setNormalIndex(int normalIndex) - { this.normalIndex = normalIndex; } - - public Vector3f getPosition() - { return position; } - - public int getTextureIndex() - { return textureIndex; } - - public int getNormalIndex() - { return normalIndex; } - - public Vertex getDuplicateVertex() - { return duplicateVertex; } - - public void setDuplicateVertex(Vertex duplicateVertex) - { this.duplicateVertex = duplicateVertex; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/obj/normals/ModelDataNM.java b/src/main/java/io/github/hydos/ginger/engine/obj/normals/ModelDataNM.java deleted file mode 100644 index 671c540..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/obj/normals/ModelDataNM.java +++ /dev/null @@ -1,40 +0,0 @@ -package io.github.hydos.ginger.engine.obj.normals; - -public class ModelDataNM -{ - private float[] vertices; - private float[] textureCoords; - private float[] normals; - private float[] tangents; - private int[] indices; - private float furthestPoint; - - public ModelDataNM(float[] vertices, float[] textureCoords, float[] normals, float[] tangents, int[] indices, - float furthestPoint) - { - this.vertices = vertices; - this.textureCoords = textureCoords; - this.normals = normals; - this.indices = indices; - this.furthestPoint = furthestPoint; - this.tangents = tangents; - } - - public float[] getVertices() - { return vertices; } - - public float[] getTextureCoords() - { return textureCoords; } - - public float[] getTangents() - { return tangents; } - - public float[] getNormals() - { return normals; } - - public int[] getIndices() - { return indices; } - - public float getFurthestPoint() - { return furthestPoint; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/particle/InsertionSort.java b/src/main/java/io/github/hydos/ginger/engine/particle/InsertionSort.java deleted file mode 100644 index 67726bb..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/particle/InsertionSort.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.github.hydos.ginger.engine.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/io/github/hydos/ginger/engine/particle/ParticleTexture.java b/src/main/java/io/github/hydos/ginger/engine/particle/ParticleTexture.java deleted file mode 100644 index a66b747..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/particle/ParticleTexture.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.github.hydos.ginger.engine.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 getTextureID() - { return textureID; } - - public int getNumberOfRows() - { return numberOfRows; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/postprocessing/ContrastShader.java b/src/main/java/io/github/hydos/ginger/engine/postprocessing/ContrastShader.java deleted file mode 100644 index cb6ace6..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/postprocessing/ContrastShader.java +++ /dev/null @@ -1,20 +0,0 @@ -package io.github.hydos.ginger.engine.postprocessing; - -import io.github.hydos.ginger.engine.render.shaders.ShaderProgram; - -public class ContrastShader extends ShaderProgram -{ - private static final String VERTEX_FILE = "contrastVertex.glsl"; - private static final String FRAGMENT_FILE = "contrastFragment.glsl"; - - public ContrastShader() - { super(VERTEX_FILE, FRAGMENT_FILE); } - - @Override - protected void getAllUniformLocations() - {} - - @Override - protected void bindAttributes() - { super.bindAttribute(0, "position"); } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/postprocessing/ImageRenderer.java b/src/main/java/io/github/hydos/ginger/engine/postprocessing/ImageRenderer.java deleted file mode 100644 index 8614ec3..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/postprocessing/ImageRenderer.java +++ /dev/null @@ -1,33 +0,0 @@ -package io.github.hydos.ginger.engine.postprocessing; - -import org.lwjgl.opengl.GL11; - -public class ImageRenderer -{ - private Fbo fbo; - - protected ImageRenderer(int width, int height) - { this.fbo = new Fbo(width, height, Fbo.NONE); } - - protected ImageRenderer() - {} - - protected void renderQuad() - { - if (fbo != null) - { fbo.bindFrameBuffer(); } - GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); - GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, 4); - if (fbo != null) - { fbo.unbindFrameBuffer(); } - } - - protected int getOutputTexture() - { return fbo.getColourTexture(); } - - protected void cleanUp() - { - if (fbo != null) - { fbo.cleanUp(); } - } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/render/models/RawModel.java b/src/main/java/io/github/hydos/ginger/engine/render/models/RawModel.java deleted file mode 100644 index 43209e0..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/render/models/RawModel.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.github.hydos.ginger.engine.render.models; - -public class RawModel -{ - private int vaoID; - private int vertexCount; - - public RawModel(int vaoID, int vertexCount) - { - this.vaoID = vaoID; - this.vertexCount = vertexCount; - } - - public int getVaoID() - { return vaoID; } - - public int getVertexCount() - { return vertexCount; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/render/models/TexturedModel.java b/src/main/java/io/github/hydos/ginger/engine/render/models/TexturedModel.java deleted file mode 100644 index 34a87bb..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/render/models/TexturedModel.java +++ /dev/null @@ -1,21 +0,0 @@ -package io.github.hydos.ginger.engine.render.models; - -import io.github.hydos.ginger.engine.render.texture.ModelTexture; - -public class TexturedModel -{ - private RawModel rawModel; - private ModelTexture texture; - - public TexturedModel(RawModel model, ModelTexture texture) - { - this.rawModel = model; - this.texture = texture; - } - - public RawModel getRawModel() - { return rawModel; } - - public ModelTexture getTexture() - { return texture; } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/render/shaders/GuiShader.java b/src/main/java/io/github/hydos/ginger/engine/render/shaders/GuiShader.java deleted file mode 100644 index c28b2c2..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/render/shaders/GuiShader.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.github.hydos.ginger.engine.render.shaders; - -import org.joml.Matrix4f; - -public class GuiShader extends ShaderProgram -{ - private static final String VERTEX_FILE = "guiVertexShader.glsl"; - private static final String FRAGMENT_FILE = "guiFragmentShader.glsl"; - private int location_transformationMatrix; - - public GuiShader() - { super(VERTEX_FILE, FRAGMENT_FILE); } - - public void loadTransformation(Matrix4f matrix) - { super.loadMatrix(location_transformationMatrix, matrix); } - - @Override - protected void getAllUniformLocations() - { location_transformationMatrix = super.getUniformLocation("transformationMatrix"); } - - @Override - protected void bindAttributes() - { super.bindAttribute(0, "position"); } -} \ No newline at end of file diff --git a/src/main/java/io/github/hydos/ginger/engine/render/shaders/ParticleShader.java b/src/main/java/io/github/hydos/ginger/engine/render/shaders/ParticleShader.java deleted file mode 100644 index 330b175..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/render/shaders/ParticleShader.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.github.hydos.ginger.engine.render.shaders; - -import org.joml.Matrix4f; - -public class ParticleShader extends ShaderProgram -{ - private static final String VERTEX_FILE = "particleVertexShader.glsl"; - private static final String FRAGMENT_FILE = "particleFragmentShader.glsl"; - private int location_numberOfRows; - private int location_projectionMatrix; - - public ParticleShader() - { super(VERTEX_FILE, FRAGMENT_FILE); } - - @Override - protected void getAllUniformLocations() - { - location_numberOfRows = super.getUniformLocation("numberOfRows"); - location_projectionMatrix = super.getUniformLocation("projectionMatrix"); - } - - @Override - protected void bindAttributes() - { - super.bindAttribute(0, "position"); - super.bindAttribute(1, "modelViewMatrix"); - super.bindAttribute(5, "texOffsets"); - super.bindAttribute(6, "blendFactor"); - } - - public void loadNumberOfRows(float numberOfRows) - { super.loadFloat(location_numberOfRows, numberOfRows); } - - public void loadProjectionMatrix(Matrix4f projectionMatrix) - { super.loadMatrix(location_projectionMatrix, projectionMatrix); } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/shadow/ShadowShader.java b/src/main/java/io/github/hydos/ginger/engine/shadow/ShadowShader.java deleted file mode 100644 index 93c4380..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/shadow/ShadowShader.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.github.hydos.ginger.engine.shadow; - -import org.joml.Matrix4f; - -import io.github.hydos.ginger.engine.render.shaders.ShaderProgram; - -public class ShadowShader extends ShaderProgram -{ - private static final String VERTEX_FILE = "shadowVertexShader.glsl"; - private static final String FRAGMENT_FILE = "shadowFragmentShader.glsl"; - private int location_mvpMatrix; - - protected ShadowShader() - { super(VERTEX_FILE, FRAGMENT_FILE); } - - @Override - protected void getAllUniformLocations() - { location_mvpMatrix = super.getUniformLocation("mvpMatrix"); } - - protected void loadMvpMatrix(Matrix4f mvpMatrix) - { super.loadMatrix(location_mvpMatrix, mvpMatrix); } - - @Override - protected void bindAttributes() - { - super.bindAttribute(0, "in_position"); - super.bindAttribute(1, "in_textureCoords"); - } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/terrain/TerrainTexture.java b/src/main/java/io/github/hydos/ginger/engine/terrain/TerrainTexture.java deleted file mode 100644 index dff647e..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/terrain/TerrainTexture.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.github.hydos.ginger.engine.terrain; - -public class TerrainTexture -{ - private int textureID; - - public int getTextureID() - { return textureID; } - - public TerrainTexture(int textureID) - { - super(); - this.textureID = textureID; - } -} diff --git a/src/main/java/io/github/hydos/ginger/engine/terrain/TerrainTexturePack.java b/src/main/java/io/github/hydos/ginger/engine/terrain/TerrainTexturePack.java deleted file mode 100644 index 28f6b09..0000000 --- a/src/main/java/io/github/hydos/ginger/engine/terrain/TerrainTexturePack.java +++ /dev/null @@ -1,30 +0,0 @@ -package io.github.hydos.ginger.engine.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 getrTexture() - { return rTexture; } - - public TerrainTexture getgTexture() - { return gTexture; } - - public TerrainTexture getbTexture() - { return bTexture; } -} diff --git a/src/main/java/io/github/hydos/ginger/main/settings/Constants.java b/src/main/java/io/github/hydos/ginger/main/settings/Constants.java deleted file mode 100644 index abf288c..0000000 --- a/src/main/java/io/github/hydos/ginger/main/settings/Constants.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.github.hydos.ginger.main.settings; - -public class Constants -{ - //player variables - public static float gravity = 0; - public static float jumpPower = 0; - public static float turnSpeed = 0; - public static float movementSpeed = 0; - //terrain variables - public static float terrainSize = 100; - public static float terrainMaxHeight = 10; - //FPS/UPS - public static final double NS = 1000000000 / 60.0; -} diff --git a/src/main/java/io/github/hydos/ginger/main/tools/GSceneBuilder.java b/src/main/java/io/github/hydos/ginger/main/tools/GSceneBuilder.java deleted file mode 100644 index 1e9bc0f..0000000 --- a/src/main/java/io/github/hydos/ginger/main/tools/GSceneBuilder.java +++ /dev/null @@ -1,6 +0,0 @@ -package io.github.hydos.ginger.main.tools; - -public class GSceneBuilder -{ - /** The class for turning GScene files into the engine parts in java */ -}