render system?

Ginger2
hYdos 2020-03-06 08:07:31 +10:00
parent b04274b2e8
commit 3968dafe36
12 changed files with 93 additions and 14 deletions

View File

@ -9,7 +9,7 @@ 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.common.render.Renderer;
import com.github.hydos.ginger.engine.opengl.render.models.GLTexturedModel;
import com.github.hydos.ginger.engine.opengl.render.shaders.StaticShader;
import com.github.hydos.ginger.engine.opengl.utils.GLLoader;

View File

@ -0,0 +1,13 @@
package com.github.hydos.ginger.engine.common.exceptions;
public class GingerException extends RuntimeException
{
public GingerException(String string)
{super(string);}
/**
* default engine exception (ginger2)
*/
private static final long serialVersionUID = 6473251828709805188L;
}

View File

@ -0,0 +1,10 @@
package com.github.hydos.ginger.engine.common.exceptions;
public class OpenGLException extends RuntimeException
{
/**
* default openGL exception from ginger
*/
private static final long serialVersionUID = 4522795553161016196L;
}

View File

@ -0,0 +1,10 @@
package com.github.hydos.ginger.engine.common.exceptions;
public class VulkanExcpetion extends RuntimeException
{
/**
* default vulkan exception
*/
private static final long serialVersionUID = -2001638471757509524L;
}

View File

@ -0,0 +1,15 @@
package com.github.hydos.ginger.engine.common.render;
public abstract class Renderer
{
public int priority = 2;//default is 2. 1 is the highest and 10 is the lowest
public void VKRender()
{}
public void VKBindShaders()
{}
public void VKUnbindShaders()
{}
}

View File

@ -1,5 +0,0 @@
package com.github.hydos.ginger.engine.opengl.render;
public abstract class Renderer
{
}

View File

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

View File

@ -7,7 +7,7 @@ import org.lwjgl.opengl.*;
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.common.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.GLLoader;

View File

@ -9,6 +9,7 @@ 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.common.render.Renderer;
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;

View File

@ -10,6 +10,7 @@ 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.common.render.Renderer;
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;

View File

@ -4,7 +4,7 @@ import org.joml.Matrix4f;
import org.lwjgl.opengl.*;
import com.github.hydos.ginger.engine.common.cameras.Camera;
import com.github.hydos.ginger.engine.opengl.render.Renderer;
import com.github.hydos.ginger.engine.common.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.GLLoader;

View File

@ -1,9 +1,43 @@
package com.github.hydos.ginger.engine.vulkan.render.renderers;
/**
* used to manage all the renderers and shaders to go with them
* @author hydos
*
*/
import java.util.*;
import com.github.hydos.ginger.engine.common.exceptions.GingerException;
import com.github.hydos.ginger.engine.common.render.Renderer;
/** used to manage all the renderers and shaders to go with them
*
* @author hydos */
public class VKRenderManager
{
private static VKRenderManager instance;
public List<Renderer> renderers;
public VKRenderManager()
{ instance = this; }
public void addRenderer(Renderer renderer)
{
if(renderers == null || renderers.size() == 0)
{
renderers = new ArrayList<Renderer>();
renderers.add(renderer);
}else {
for(int i = 0; i < renderers.size(); i++)
{
Renderer r = renderers.get(i);
if(r.priority < renderer.priority) {
renderers.add(i, renderer);
return;
}
}
}
}
public VKRenderManager getInstance()
{
if (instance == null)
{ throw new GingerException("The Vulkan render manager is not setup"); }
return instance;
}
}