should be the final move of engine classes

pull/12/head
hYdos 2020-03-02 16:38:46 +10:00
parent 6db7693bc3
commit 2b4b1aa4d0
24 changed files with 53 additions and 61 deletions

View File

@ -12,11 +12,11 @@ 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.font.FontType;
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.font.FontType;
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.GlLoader;

View File

@ -2,10 +2,10 @@ package com.github.halotroop.litecraft.screens;
import org.joml.*;
import com.github.hydos.ginger.engine.common.font.GUIText;
import com.github.hydos.ginger.engine.common.io.Window;
import com.github.hydos.ginger.engine.common.screen.Screen;
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;
public class ExitGameScreen extends Screen
{

View File

@ -4,9 +4,9 @@ import org.joml.*;
import com.github.halotroop.litecraft.Litecraft;
import com.github.hydos.ginger.engine.common.api.GingerRegister;
import com.github.hydos.ginger.engine.common.font.GUIText;
import com.github.hydos.ginger.engine.common.screen.Screen;
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;
public class IngameHUD extends Screen
{

View File

@ -9,10 +9,10 @@ import com.github.halotroop.litecraft.save.LitecraftSave;
import com.github.halotroop.litecraft.world.dimension.Dimensions;
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.font.GUIText;
import com.github.hydos.ginger.engine.common.io.Window;
import com.github.hydos.ginger.engine.common.screen.Screen;
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.screen.Screen;
/**
* YeS

View File

@ -17,11 +17,9 @@ import com.github.hydos.ginger.engine.opengl.utils.GlLoader;
public class BlockRenderer extends Renderer implements WorldGenConstants
{
private StaticShader shader;
public int atlasID;
public BlockRenderer(StaticShader shader, Matrix4f projectionMatrix)
{
this.shader = shader;
@ -33,7 +31,8 @@ public class BlockRenderer extends Renderer implements WorldGenConstants
private void prepBlockInstance(RenderObject entity)
{
Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), entity.getRotX(), entity.getRotY(), entity.getRotZ(), entity.getScale());
Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), entity.getRotX(),
entity.getRotY(), entity.getRotZ(), entity.getScale());
shader.loadTransformationMatrix(transformationMatrix);
}
@ -52,19 +51,18 @@ public class BlockRenderer extends Renderer implements WorldGenConstants
GL20.glDisableVertexAttribArray(2);
GL30.glBindVertexArray(0);
}
public void enableWireframe() {
if (GingerRegister.getInstance().wireframe)
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
}
public void disableWireframe() {
if (GingerRegister.getInstance().wireframe)
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
}
public void prepareRender() {
//TODO: combine VBOS
public void enableWireframe()
{ if (GingerRegister.getInstance().wireframe)
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); }
public void disableWireframe()
{ if (GingerRegister.getInstance().wireframe)
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); }
public void prepareRender()
{
// TODO: combine VBOS
shader.start();
shader.loadSkyColour(Window.getColour());
shader.loadViewMatrix(GingerRegister.getInstance().game.data.camera);
@ -81,18 +79,18 @@ public class BlockRenderer extends Renderer implements WorldGenConstants
for (int x = 0; x < CHUNK_SIZE; x++)
for (int y = 0; y < CHUNK_SIZE; y++)
for (int z = 0; z < CHUNK_SIZE; z++)
{
BlockInstance entity = renderList[Chunk.index(x, y, z)];
if (entity != null && entity.getModel() != null)
{
TexturedModel blockModel = entity.getModel();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, blockModel.getTexture().getTextureID());
prepBlockInstance(entity);
GL11.glDrawElements(GL11.GL_TRIANGLES, blockModel.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
}
}
{
BlockInstance entity = renderList[Chunk.index(x, y, z)];
if (entity != null && entity.getModel() != null)
{
TexturedModel blockModel = entity.getModel();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, blockModel.getTexture().getTextureID());
prepBlockInstance(entity);
GL11.glDrawElements(GL11.GL_TRIANGLES, blockModel.getRawModel().getVertexCount(),
GL11.GL_UNSIGNED_INT, 0);
}
}
disableWireframe();
shader.stop();
}
}

View File

@ -4,10 +4,10 @@ import java.util.*;
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.common.font.GUIText;
import com.github.hydos.ginger.engine.common.screen.Screen;
import com.github.hydos.ginger.engine.opengl.postprocessing.Fbo;
import com.github.hydos.ginger.engine.opengl.render.MasterRenderer;
import com.github.hydos.ginger.engine.opengl.screen.Screen;
import com.github.hydos.multithreading.GingerThreading;
/** Used if a game wants to access engine variables safely */

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.fbo;
package com.github.hydos.ginger.engine.common.fbo;
public abstract class FboCallbackHandler
{

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.font;
package com.github.hydos.ginger.engine.common.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. */

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.font;
package com.github.hydos.ginger.engine.common.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. */

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.font;
package com.github.hydos.ginger.engine.common.font;
import org.joml.*;

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.font;
package com.github.hydos.ginger.engine.common.font;
import java.util.*;

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.font;
package com.github.hydos.ginger.engine.common.font;
import java.io.*;
import java.util.*;

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.font;
package com.github.hydos.ginger.engine.common.font;
import java.util.*;

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.font;
package com.github.hydos.ginger.engine.common.font;
import java.util.*;

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.font;
package com.github.hydos.ginger.engine.common.font;
/** Stores the vertex data for all the quads on which a text will be rendered. */
public class TextMeshData

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.font;
package com.github.hydos.ginger.engine.common.font;
import java.util.*;

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.screen;
package com.github.hydos.ginger.engine.common.screen;
import java.util.List;

View File

@ -9,12 +9,12 @@ 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.font.*;
import com.github.hydos.ginger.engine.common.io.Window;
import com.github.hydos.ginger.engine.opengl.font.*;
import com.github.hydos.ginger.engine.common.screen.Screen;
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.GlLoader;
import com.github.hydos.multithreading.GingerThreading;

View File

@ -1,8 +1,8 @@
package com.github.hydos.ginger.engine.opengl.api;
import com.github.hydos.ginger.engine.common.font.TextMaster;
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.render.MasterRenderer;
import com.github.hydos.ginger.engine.opengl.render.models.*;
import com.github.hydos.ginger.engine.opengl.render.texture.ModelTexture;

View File

@ -2,7 +2,7 @@ package com.github.hydos.ginger.engine.opengl.postprocessing;
import org.lwjgl.opengl.*;
import com.github.hydos.ginger.engine.opengl.fbo.FboCallbackHandler;
import com.github.hydos.ginger.engine.common.fbo.FboCallbackHandler;
public class ContrastChanger extends FboCallbackHandler
{

View File

@ -8,8 +8,8 @@ import java.nio.ByteBuffer;
import org.lwjgl.glfw.*;
import org.lwjgl.system.Callback;
import com.github.hydos.ginger.engine.common.fbo.FboCallbackHandler;
import com.github.hydos.ginger.engine.common.io.Window;
import com.github.hydos.ginger.engine.opengl.fbo.FboCallbackHandler;
public class Fbo
{

View File

@ -4,7 +4,7 @@ import java.util.*;
import org.lwjgl.opengl.*;
import com.github.hydos.ginger.engine.opengl.font.*;
import com.github.hydos.ginger.engine.common.font.*;
import com.github.hydos.ginger.engine.opengl.render.Renderer;
import com.github.hydos.ginger.engine.opengl.render.shaders.FontShader;

View File

@ -2,7 +2,7 @@ package com.github.hydos.ginger.engine.opengl.render.shaders;
import org.joml.*;
import com.github.hydos.ginger.engine.opengl.font.GUIText;
import com.github.hydos.ginger.engine.common.font.GUIText;
public class FontShader extends ShaderProgram
{

View File

@ -1,6 +0,0 @@
package com.github.hydos.ginger.engine.opengl.voxelutils;
public class BlockMesher
{
//TODO: supercoder i ask you that you figure a way to cull inner faces and not just whole blocks :)
}