[Refactor] Changes for consistency

liteCraft
Caroline Bell 2020-03-04 12:24:32 -08:00
parent 118d68a64e
commit ba367bf1f5
9 changed files with 24 additions and 24 deletions

View File

@ -21,7 +21,8 @@ import com.github.hydos.ginger.engine.opengl.api.*;
import com.github.hydos.ginger.engine.opengl.postprocessing.PostProcessing; import com.github.hydos.ginger.engine.opengl.postprocessing.PostProcessing;
import com.github.hydos.ginger.engine.opengl.render.MasterRenderer; import com.github.hydos.ginger.engine.opengl.render.MasterRenderer;
import com.github.hydos.ginger.engine.opengl.render.models.GLTexturedModel; import com.github.hydos.ginger.engine.opengl.render.models.GLTexturedModel;
import com.github.hydos.ginger.engine.opengl.utils.GLLoader; import com.github.hydos.ginger.engine.opengl.utils.*;
import tk.valoeghese.gateways.client.io.*; import tk.valoeghese.gateways.client.io.*;
public class Litecraft extends Game public class Litecraft extends Game
@ -98,7 +99,7 @@ public class Litecraft extends Game
public void renderWorld(Game game) public void renderWorld(Game game)
{ {
GameData data = game.data; GameData data = game.data;
GingerUtils.preRenderScene(((GingerGL)engine).getRegistry().masterRenderer); GLUtils.preRenderScene(((GingerGL)engine).getRegistry().masterRenderer);
((GingerGL)engine).contrastFbo.bindFBO(); ((GingerGL)engine).contrastFbo.bindFBO();
((GingerGL)engine).getRegistry().masterRenderer.renderScene(data.entities, data.normalMapEntities, data.lights, data.camera, data.clippingPlane); ((GingerGL)engine).getRegistry().masterRenderer.renderScene(data.entities, data.normalMapEntities, data.lights, data.camera, data.clippingPlane);
((GingerGL)engine).contrastFbo.unbindFBO(); ((GingerGL)engine).contrastFbo.unbindFBO();
@ -129,7 +130,7 @@ public class Litecraft extends Game
KeyCallbackHandler.trackWindow(Window.getWindow()); KeyCallbackHandler.trackWindow(Window.getWindow());
MouseCallbackHandler.trackWindow(Window.getWindow()); MouseCallbackHandler.trackWindow(Window.getWindow());
// set up ginger utilities // set up ginger utilities
GingerUtils.init(); GLUtils.init();
switch (Window.renderAPI) switch (Window.renderAPI)
{ {

View File

@ -5,7 +5,7 @@ import com.github.hydos.ginger.engine.common.io.Window;
import com.github.hydos.ginger.engine.common.screen.Screen; import com.github.hydos.ginger.engine.common.screen.Screen;
import com.github.hydos.ginger.engine.common.util.Timer; import com.github.hydos.ginger.engine.common.util.Timer;
import com.github.hydos.ginger.engine.common.util.Timer.TickListener; import com.github.hydos.ginger.engine.common.util.Timer.TickListener;
import com.github.hydos.ginger.engine.opengl.api.GingerUtils; import com.github.hydos.ginger.engine.opengl.utils.GLUtils;
public abstract class GingerEngine public abstract class GingerEngine
{ {
@ -42,7 +42,7 @@ public abstract class GingerEngine
// Things that should be run as often as possible, without limits // Things that should be run as often as possible, without limits
public void update() public void update()
{ {
GingerUtils.update(); GLUtils.update();
Window.update(); Window.update();
} }

View File

@ -6,7 +6,7 @@ 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.common.elements.buttons.TextureButton;
import com.github.hydos.ginger.engine.common.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.common.screen.Screen;
import com.github.hydos.ginger.engine.opengl.postprocessing.Fbo; import com.github.hydos.ginger.engine.opengl.postprocessing.FrameBufferObject;
import com.github.hydos.ginger.engine.opengl.render.MasterRenderer; import com.github.hydos.ginger.engine.opengl.render.MasterRenderer;
/** Used if a game wants to access engine variables safely */ /** Used if a game wants to access engine variables safely */
@ -20,7 +20,7 @@ public class GingerRegister
public List<GUIText> texts; public List<GUIText> texts;
public List<TextureButton> guiButtons; public List<TextureButton> guiButtons;
public List<Fbo> fbos; public List<FrameBufferObject> frameBufferObjects;
public Game game; public Game game;
public Screen currentScreen; public Screen currentScreen;
public boolean wireframe = false; public boolean wireframe = false;

View File

@ -19,7 +19,7 @@ public class GingerGL extends GingerEngine
{ {
public MousePicker picker; public MousePicker picker;
public FontType globalFont; public FontType globalFont;
public Fbo contrastFbo; public FrameBufferObject contrastFbo;
public void cleanup() public void cleanup()
{ {
@ -77,7 +77,7 @@ public class GingerGL extends GingerEngine
getRegistry().registerGame(game); getRegistry().registerGame(game);
timer = new Timer(game.data.tickSpeed); timer = new Timer(game.data.tickSpeed);
timer.addTickListener(gameTickListener); timer.addTickListener(gameTickListener);
contrastFbo = new Fbo(new ContrastChanger()); contrastFbo = new FrameBufferObject(new ContrastChanger());
getRegistry().masterRenderer = masterRenderer; getRegistry().masterRenderer = masterRenderer;
picker = new MousePicker(game.data.camera, masterRenderer.getProjectionMatrix()); picker = new MousePicker(game.data.camera, masterRenderer.getProjectionMatrix());
PostProcessing.init(); PostProcessing.init();

View File

@ -11,7 +11,7 @@ import org.lwjgl.system.Callback;
import com.github.hydos.ginger.engine.common.fbo.FboCallbackHandler; import com.github.hydos.ginger.engine.common.fbo.FboCallbackHandler;
import com.github.hydos.ginger.engine.common.io.Window; import com.github.hydos.ginger.engine.common.io.Window;
public class Fbo public class FrameBufferObject
{ {
long window; long window;
int width = 1024; int width = 1024;
@ -34,7 +34,7 @@ public class Fbo
GLFWFramebufferSizeCallback fbCallback; GLFWFramebufferSizeCallback fbCallback;
Callback debugProc; Callback debugProc;
public Fbo(FboCallbackHandler handler) public FrameBufferObject(FboCallbackHandler handler)
{ {
this.handler = handler; this.handler = handler;
this.window = Window.getWindow(); this.window = Window.getWindow();

View File

@ -4,27 +4,27 @@ import org.lwjgl.opengl.GL11;
public class ImageRenderer public class ImageRenderer
{ {
private Fbo fbo; private FrameBufferObject frameBufferObject;
protected ImageRenderer() protected ImageRenderer()
{} {}
protected ImageRenderer(int width, int height) protected ImageRenderer(int width, int height)
{ this.fbo = new Fbo(new ContrastChanger()); } { this.frameBufferObject = new FrameBufferObject(new ContrastChanger()); }
protected void cleanUp() protected void cleanUp()
{} {}
protected int getOutputTexture() protected int getOutputTexture()
{ return fbo.colorTexture; } { return frameBufferObject.colorTexture; }
protected void renderQuad() protected void renderQuad()
{ {
if (fbo != null) if (frameBufferObject != null)
{ fbo.bindFBO(); } { frameBufferObject.bindFBO(); }
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, 4); GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, 4);
if (fbo != null) if (frameBufferObject != null)
{ fbo.unbindFBO(); } { frameBufferObject.unbindFBO(); }
} }
} }

View File

@ -1,4 +1,4 @@
package com.github.hydos.ginger.engine.opengl.api; package com.github.hydos.ginger.engine.opengl.utils;
import com.github.hydos.ginger.engine.common.font.TextMaster; 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.ModelLoader;
@ -7,7 +7,7 @@ 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.models.*;
import com.github.hydos.ginger.engine.opengl.render.texture.ModelTexture; import com.github.hydos.ginger.engine.opengl.render.texture.ModelTexture;
public class GingerUtils public class GLUtils
{ {
public static GLTexturedModel createTexturedModel(String texturePath, String modelPath) public static GLTexturedModel createTexturedModel(String texturePath, String modelPath)
{ {

View File

@ -1,6 +1,6 @@
package com.github.hydos.ginger.engine.vulkan.api; package com.github.hydos.ginger.engine.vulkan.api;
import com.github.hydos.ginger.engine.vulkan.io.VkWindow; import com.github.hydos.ginger.engine.vulkan.io.VKWindow;
import com.github.hydos.ginger.engine.vulkan.utils.VKUtils; import com.github.hydos.ginger.engine.vulkan.utils.VKUtils;
public class GingerVK public class GingerVK
@ -9,7 +9,7 @@ public class GingerVK
{ {
System.out.println("Game " + gameName + " successfuly started in Vulkan mode."); System.out.println("Game " + gameName + " successfuly started in Vulkan mode.");
VKUtils.createInstance(); VKUtils.createInstance();
VkWindow.createSurface(); VKWindow.createSurface();
VKUtils.createPhysicalDevice(); VKUtils.createPhysicalDevice();
VKUtils.createLogicalDevice(); VKUtils.createLogicalDevice();
} }

View File

@ -13,9 +13,8 @@ import com.github.hydos.ginger.engine.vulkan.utils.*;
/** /**
* used for window related vulkan only things * used for window related vulkan only things
* @author hydos * @author hydos
*
*/ */
public class VkWindow public class VKWindow
{ {
public static void createSurface() public static void createSurface()
{ {