ginger3D is now jut a library again
parent
c4d07d5902
commit
038ea02cd6
|
@ -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; }
|
||||
}
|
|
@ -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<GuiTexture> textures)
|
||||
{}
|
||||
|
||||
@Override
|
||||
public void show(List<GuiTexture> textures)
|
||||
{}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package io.github.hydos.ginger.UI.enums;
|
||||
|
||||
public enum UIColourType
|
||||
{
|
||||
light, dark
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package io.github.hydos.ginger.UI.enums;
|
||||
|
||||
public enum UIDefaultClipSide
|
||||
{
|
||||
top, bottom, left, right, centre
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package io.github.hydos.ginger.UI.enums;
|
||||
|
||||
public enum UIType
|
||||
{
|
||||
tab, wholeScreen
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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> guiTexture)
|
||||
{
|
||||
if (shown)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
guiTexture.add(this.guiTexture);
|
||||
this.shown = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void hide(List<GuiTexture> 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; }
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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); }
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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<Particle> 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<Particle> 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);
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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"); }
|
||||
}
|
|
@ -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(); }
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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"); }
|
||||
}
|
|
@ -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); }
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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 */
|
||||
}
|
Loading…
Reference in New Issue