simpler renderer (very good 10/10 ngl)
parent
54ba0d5e07
commit
4026e407c6
|
@ -1,60 +1,35 @@
|
||||||
package io.github.hydos.ginger;
|
package io.github.hydos.ginger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import io.github.hydos.ginger.engine.api.*;
|
||||||
import java.util.List;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
|
|
||||||
import org.joml.Vector4f;
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
|
||||||
import io.github.hydos.ginger.engine.elements.GuiTexture;
|
|
||||||
import io.github.hydos.ginger.engine.elements.buttons.TextureButton;
|
import io.github.hydos.ginger.engine.elements.buttons.TextureButton;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Entity;
|
import io.github.hydos.ginger.engine.elements.objects.*;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Light;
|
import io.github.hydos.ginger.engine.font.*;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Player;
|
|
||||||
import io.github.hydos.ginger.engine.font.FontType;
|
|
||||||
import io.github.hydos.ginger.engine.font.GUIText;
|
|
||||||
import io.github.hydos.ginger.engine.font.TextMaster;
|
|
||||||
import io.github.hydos.ginger.engine.io.Window;
|
import io.github.hydos.ginger.engine.io.Window;
|
||||||
import io.github.hydos.ginger.engine.math.vectors.Vector2f;
|
import io.github.hydos.ginger.engine.math.vectors.*;
|
||||||
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
|
||||||
import io.github.hydos.ginger.engine.obj.ModelLoader;
|
import io.github.hydos.ginger.engine.obj.ModelLoader;
|
||||||
import io.github.hydos.ginger.engine.obj.normals.NormalMappedObjLoader;
|
import io.github.hydos.ginger.engine.obj.normals.NormalMappedObjLoader;
|
||||||
import io.github.hydos.ginger.engine.particle.ParticleMaster;
|
import io.github.hydos.ginger.engine.particle.*;
|
||||||
import io.github.hydos.ginger.engine.particle.ParticleSystem;
|
|
||||||
import io.github.hydos.ginger.engine.particle.ParticleTexture;
|
|
||||||
import io.github.hydos.ginger.engine.postprocessing.Fbo;
|
|
||||||
import io.github.hydos.ginger.engine.postprocessing.PostProcessing;
|
|
||||||
import io.github.hydos.ginger.engine.render.MasterRenderer;
|
import io.github.hydos.ginger.engine.render.MasterRenderer;
|
||||||
import io.github.hydos.ginger.engine.render.models.TexturedModel;
|
import io.github.hydos.ginger.engine.render.models.TexturedModel;
|
||||||
import io.github.hydos.ginger.engine.render.texture.ModelTexture;
|
import io.github.hydos.ginger.engine.render.texture.ModelTexture;
|
||||||
import io.github.hydos.ginger.engine.render.tools.MousePicker;
|
import io.github.hydos.ginger.engine.terrain.*;
|
||||||
import io.github.hydos.ginger.engine.terrain.Terrain;
|
|
||||||
import io.github.hydos.ginger.engine.terrain.TerrainTexture;
|
|
||||||
import io.github.hydos.ginger.engine.terrain.TerrainTexturePack;
|
|
||||||
import io.github.hydos.ginger.engine.utils.Loader;
|
import io.github.hydos.ginger.engine.utils.Loader;
|
||||||
import io.github.hydos.ginger.main.GingerMain;
|
import io.github.hydos.ginger.main.GingerMain;
|
||||||
import io.github.hydos.ginger.main.settings.Constants;
|
import io.github.hydos.ginger.main.settings.Constants;
|
||||||
|
|
||||||
public class Example {
|
public class Example extends Game{
|
||||||
|
|
||||||
private MasterRenderer masterRenderer;
|
|
||||||
|
|
||||||
private List<Terrain> terrains = new ArrayList<Terrain>();
|
|
||||||
|
|
||||||
private List<GuiTexture> guis = new ArrayList<GuiTexture>();
|
|
||||||
|
|
||||||
private List<Light> lights = new ArrayList<Light>();
|
|
||||||
|
|
||||||
private List<Entity> entities = new ArrayList<Entity>();
|
|
||||||
|
|
||||||
private List<Entity> normalMapEntities = new ArrayList<Entity>();
|
|
||||||
|
|
||||||
|
private Ginger ginger3D;
|
||||||
|
|
||||||
public void main(String[] args) {
|
public void main(String[] args) {
|
||||||
|
//Render Player's constant variables
|
||||||
|
Constants.movementSpeed = 0.000005f;
|
||||||
|
Constants.turnSpeed = 0.00002f;
|
||||||
|
Constants.gravity = -0.000000000005f;
|
||||||
|
Constants.jumpPower = 0.000005f;
|
||||||
|
|
||||||
|
Window.create(1200, 800, "Simple Ginger Example", 60);
|
||||||
Window.create(1200, 800, "Ginger Example", 60);
|
|
||||||
|
|
||||||
GingerMain.init();
|
GingerMain.init();
|
||||||
|
|
||||||
|
@ -64,13 +39,11 @@ public class Example {
|
||||||
TexturedModel tModel = ModelLoader.loadModel("stall.obj", "stallTexture.png");
|
TexturedModel tModel = ModelLoader.loadModel("stall.obj", "stallTexture.png");
|
||||||
tModel.getTexture().setReflectivity(1f);
|
tModel.getTexture().setReflectivity(1f);
|
||||||
tModel.getTexture().setShineDamper(7f);
|
tModel.getTexture().setShineDamper(7f);
|
||||||
Player entity = new Player(tModel, new Vector3f(0,0,-3),0,180f,0, new Vector3f(0.2f, 0.2f, 0.2f));
|
Player player = new Player(tModel, new Vector3f(0,0,-3),0,180f,0, new Vector3f(0.2f, 0.2f, 0.2f));
|
||||||
Constants.movementSpeed = 0.000005f;
|
Camera camera = new Camera(new Vector3f(0,0.1f,0), player);
|
||||||
Constants.turnSpeed = 0.00002f;
|
ginger3D = new Ginger();
|
||||||
Constants.gravity = -0.000000000005f;
|
data = new GameData(player, camera);
|
||||||
Constants.jumpPower = 0.000005f;
|
ginger3D.setup(new MasterRenderer(data.camera), data);
|
||||||
ThirdPersonCamera camera = new ThirdPersonCamera(new Vector3f(0,0.1f,0), entity);
|
|
||||||
masterRenderer = new MasterRenderer(camera);
|
|
||||||
|
|
||||||
|
|
||||||
FontType font = new FontType(Loader.loadFontAtlas("candara.png"), "candara.fnt");
|
FontType font = new FontType(Loader.loadFontAtlas("candara.png"), "candara.fnt");
|
||||||
|
@ -78,7 +51,7 @@ public class Example {
|
||||||
GUIText text = new GUIText("german", 3, font, new Vector2f(0,0), 1f, true);
|
GUIText text = new GUIText("german", 3, font, new Vector2f(0,0), 1f, true);
|
||||||
text.setColour(0, 1, 0);
|
text.setColour(0, 1, 0);
|
||||||
|
|
||||||
ParticleMaster.init(masterRenderer.getProjectionMatrix());
|
ParticleMaster.init(ginger3D.masterRenderer.getProjectionMatrix());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +63,7 @@ public class Example {
|
||||||
|
|
||||||
|
|
||||||
Light sun = new Light(new Vector3f(100,105,-100), new Vector3f(1.3f, 1.3f, 1.3f), new Vector3f(0.0001f, 0.0001f, 0.0001f));
|
Light sun = new Light(new Vector3f(100,105,-100), new Vector3f(1.3f, 1.3f, 1.3f), new Vector3f(0.0001f, 0.0001f, 0.0001f));
|
||||||
lights.add(sun);
|
data.lights.add(sun);
|
||||||
|
|
||||||
TexturedModel tgrass = ModelLoader.loadModel("grass.obj", "grass.png");
|
TexturedModel tgrass = ModelLoader.loadModel("grass.obj", "grass.png");
|
||||||
tgrass.getTexture().setTransparency(true);
|
tgrass.getTexture().setTransparency(true);
|
||||||
|
@ -109,10 +82,7 @@ public class Example {
|
||||||
Entity dragon = new Entity(dragonMdl, new Vector3f(3,terrain.getHeightOfTerrain(3, -3),-3),0,180f,0, new Vector3f(0.2f, 0.2f, 0.2f));
|
Entity dragon = new Entity(dragonMdl, new Vector3f(3,terrain.getHeightOfTerrain(3, -3),-3),0,180f,0, new Vector3f(0.2f, 0.2f, 0.2f));
|
||||||
|
|
||||||
Entity grassEntity = new Entity(tgrass, new Vector3f(-3,terrain.getHeightOfTerrain(-3, -3),-3),0,180f,0, new Vector3f(0.2f, 0.2f, 0.2f));
|
Entity grassEntity = new Entity(tgrass, new Vector3f(-3,terrain.getHeightOfTerrain(-3, -3),-3),0,180f,0, new Vector3f(0.2f, 0.2f, 0.2f));
|
||||||
entities.add(grassEntity);
|
data.entities.add(grassEntity);
|
||||||
|
|
||||||
MousePicker picker = new MousePicker(camera, masterRenderer.getProjectionMatrix(), terrain);
|
|
||||||
|
|
||||||
|
|
||||||
TexturedModel barrelModel = new TexturedModel(NormalMappedObjLoader.loadOBJ("barrel.obj"), new ModelTexture("barrel.png"));
|
TexturedModel barrelModel = new TexturedModel(NormalMappedObjLoader.loadOBJ("barrel.obj"), new ModelTexture("barrel.png"));
|
||||||
barrelModel.getTexture().setNormalMap(new ModelTexture("modelNormals/barrelNormal.png").getTextureID());
|
barrelModel.getTexture().setNormalMap(new ModelTexture("modelNormals/barrelNormal.png").getTextureID());
|
||||||
|
@ -120,80 +90,61 @@ public class Example {
|
||||||
barrelModel.getTexture().setReflectivity(0.5f);
|
barrelModel.getTexture().setReflectivity(0.5f);
|
||||||
|
|
||||||
Entity barrel = new Entity(barrelModel, new Vector3f(1,terrain.getHeightOfTerrain(1, 1),1), 0, 0, 0, new Vector3f(0.25f,0.25f,0.25f));
|
Entity barrel = new Entity(barrelModel, new Vector3f(1,terrain.getHeightOfTerrain(1, 1),1), 0, 0, 0, new Vector3f(0.25f,0.25f,0.25f));
|
||||||
normalMapEntities.add(barrel);
|
data.normalMapEntities.add(barrel);
|
||||||
entities.add(entity);
|
data.entities.add(player);
|
||||||
entities.add(dragon);
|
data.entities.add(dragon);
|
||||||
|
|
||||||
float colour = 0;
|
data.flatTerrains.add(terrain);
|
||||||
terrains.add(terrain);
|
|
||||||
|
|
||||||
ParticleTexture particleTexture = new ParticleTexture(Loader.loadTexture("particles/smoke.png"), 8);
|
ParticleSystem system = setupParticles();
|
||||||
|
|
||||||
TextureButton button = new TextureButton("/textures/guis/ginger.png", new Vector2f(0.8f, 0), new Vector2f(0.1f, 0.1f));
|
TextureButton button = new TextureButton("/textures/guis/ginger.png", new Vector2f(0.8f, 0), new Vector2f(0.1f, 0.1f));
|
||||||
button.show(guis);
|
button.show(data.guis);
|
||||||
|
|
||||||
|
Window.lockMouse();
|
||||||
|
|
||||||
|
while(!Window.closed()) {
|
||||||
|
|
||||||
|
if(Window.isUpdating()) {
|
||||||
|
ginger3D.update(data);
|
||||||
|
|
||||||
|
ginger3D.masterRenderer.renderShadowMap(data.entities, sun);
|
||||||
|
|
||||||
|
camera.move();
|
||||||
|
player.move(terrain);
|
||||||
|
|
||||||
|
system.generateParticles(new Vector3f(0,-2,0));
|
||||||
|
|
||||||
|
ginger3D.render(data, this);
|
||||||
|
|
||||||
|
dragon.increaseRotation(0,1,0);
|
||||||
|
barrel.increaseRotation(0, 1, 0);
|
||||||
|
|
||||||
|
button.update();
|
||||||
|
if(button.isClicked()) {
|
||||||
|
System.out.println("click");
|
||||||
|
button.hide(data.guis);
|
||||||
|
}
|
||||||
|
|
||||||
|
ginger3D.postRender();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ParticleSystem setupParticles() {
|
||||||
|
ParticleTexture particleTexture = new ParticleTexture(Loader.loadTexture("particles/smoke.png"), 8);
|
||||||
|
|
||||||
|
|
||||||
ParticleSystem system = new ParticleSystem(particleTexture, 100, 10f, 0.3f, 4, 3f);
|
ParticleSystem system = new ParticleSystem(particleTexture, 100, 10f, 0.3f, 4, 3f);
|
||||||
system.randomizeRotation();
|
system.randomizeRotation();
|
||||||
system.setDirection(new Vector3f(0,0.001f,0), 0.00001f);
|
system.setDirection(new Vector3f(0,0.001f,0), 0.00001f);
|
||||||
system.setLifeError(0);
|
system.setLifeError(0);
|
||||||
system.setSpeedError(0);
|
system.setSpeedError(0);
|
||||||
system.setScaleError(1f);
|
system.setScaleError(1f);
|
||||||
|
return system;
|
||||||
Fbo fbo = new Fbo();
|
|
||||||
PostProcessing.init();
|
|
||||||
|
|
||||||
while(!Window.closed()) {
|
|
||||||
|
|
||||||
if(Window.isUpdating()) {
|
|
||||||
Window.update();
|
|
||||||
GingerMain.update();
|
|
||||||
colour = colour + 0.001f;
|
|
||||||
picker.update();
|
|
||||||
ParticleMaster.update(camera);
|
|
||||||
|
|
||||||
masterRenderer.renderShadowMap(entities, sun);
|
|
||||||
|
|
||||||
camera.move();
|
|
||||||
entity.move(terrain);
|
|
||||||
|
|
||||||
Vector3f terrainPoint = picker.getCurrentTerrainPoint();
|
|
||||||
if(terrainPoint!=null) {
|
|
||||||
barrel.setPosition(terrainPoint);
|
|
||||||
if(Window.isMouseDown(GLFW.GLFW_MOUSE_BUTTON_1)) {
|
|
||||||
normalMapEntities.add(new Entity(barrelModel, terrainPoint, 0, 0, 0, new Vector3f(0.25f,0.25f,0.25f)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
system.generateParticles(new Vector3f(0,-2,0));
|
|
||||||
|
|
||||||
dragon.increaseRotation(0,1,0);
|
|
||||||
barrel.increaseRotation(0, 1, 0);
|
|
||||||
|
|
||||||
GingerMain.preRenderScene(masterRenderer);
|
|
||||||
ParticleMaster.renderParticles(camera);
|
|
||||||
fbo.bindFBO();
|
|
||||||
masterRenderer.renderScene(entities, normalMapEntities, terrains, lights, camera, new Vector4f(0, -1, 0, 100000));
|
|
||||||
fbo.unbindFBO();
|
|
||||||
PostProcessing.doPostProcessing(fbo.colorTexture);
|
|
||||||
// TODO: get fbo's working
|
|
||||||
button.update();
|
|
||||||
if(button.isClicked()) {
|
|
||||||
System.out.println("click");
|
|
||||||
button.hide(guis);
|
|
||||||
}
|
|
||||||
// masterRenderer.renderScene(entities, normalMapEntities, terrains, lights, camera, new Vector4f(0, -1, 0, 100000));
|
|
||||||
masterRenderer.renderGuis(guis);
|
|
||||||
TextMaster.render();
|
|
||||||
|
|
||||||
Window.swapBuffers();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Window.stop();
|
|
||||||
PostProcessing.cleanUp();
|
|
||||||
ParticleMaster.cleanUp();
|
|
||||||
masterRenderer.cleanUp();
|
|
||||||
TextMaster.cleanUp();
|
|
||||||
Loader.cleanUp();
|
|
||||||
System.exit(0);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package io.github.hydos.ginger.engine.api;
|
||||||
|
|
||||||
|
public abstract class Game {
|
||||||
|
|
||||||
|
public GameData data;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package io.github.hydos.ginger.engine.api;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
|
import io.github.hydos.ginger.engine.elements.GuiTexture;
|
||||||
|
import io.github.hydos.ginger.engine.elements.objects.*;
|
||||||
|
import io.github.hydos.ginger.engine.terrain.Terrain;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used for storing essential engine game data so main class isn't messy
|
||||||
|
* Also in general used with Game Class
|
||||||
|
*/
|
||||||
|
public class GameData {
|
||||||
|
|
||||||
|
public List<GuiTexture> guis;
|
||||||
|
public List<Entity> entities;
|
||||||
|
public List<Light> lights;
|
||||||
|
public List<Entity> normalMapEntities;
|
||||||
|
public List<Terrain> flatTerrains;
|
||||||
|
public Player player;
|
||||||
|
public Camera camera;
|
||||||
|
public Vector4f clippingPlane;
|
||||||
|
|
||||||
|
public GameData(Player player, Camera camera) {
|
||||||
|
clippingPlane = new Vector4f(0, -1, 0, 100000);
|
||||||
|
guis = new ArrayList<GuiTexture>();
|
||||||
|
entities = new ArrayList<Entity>();
|
||||||
|
lights = new ArrayList<Light>();
|
||||||
|
normalMapEntities = new ArrayList<Entity>();
|
||||||
|
flatTerrains = new ArrayList<Terrain>();
|
||||||
|
this.player = player;
|
||||||
|
this.camera = camera;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package io.github.hydos.ginger.engine.api;
|
||||||
|
|
||||||
|
import io.github.hydos.ginger.engine.font.TextMaster;
|
||||||
|
import io.github.hydos.ginger.engine.io.Window;
|
||||||
|
import io.github.hydos.ginger.engine.particle.ParticleMaster;
|
||||||
|
import io.github.hydos.ginger.engine.postprocessing.*;
|
||||||
|
import io.github.hydos.ginger.engine.render.MasterRenderer;
|
||||||
|
import io.github.hydos.ginger.engine.render.tools.MousePicker;
|
||||||
|
import io.github.hydos.ginger.engine.utils.Loader;
|
||||||
|
import io.github.hydos.ginger.main.GingerMain;
|
||||||
|
|
||||||
|
public class Ginger {
|
||||||
|
|
||||||
|
public MasterRenderer masterRenderer;
|
||||||
|
|
||||||
|
MousePicker picker;
|
||||||
|
|
||||||
|
public Fbo contrastFbo;
|
||||||
|
|
||||||
|
public void setup(MasterRenderer masterRenderer, GameData data) {
|
||||||
|
contrastFbo = new Fbo();
|
||||||
|
this.masterRenderer = masterRenderer;
|
||||||
|
picker = new MousePicker(data.camera, masterRenderer.getProjectionMatrix(), null);
|
||||||
|
PostProcessing.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(GameData data) {
|
||||||
|
data.camera.move();
|
||||||
|
data.player.move(null);
|
||||||
|
Window.update();
|
||||||
|
GingerMain.update();
|
||||||
|
picker.update();
|
||||||
|
ParticleMaster.update(data.camera);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(GameData data, Game game) {
|
||||||
|
GingerMain.preRenderScene(masterRenderer);
|
||||||
|
ParticleMaster.renderParticles(data.camera);
|
||||||
|
contrastFbo.bindFBO();
|
||||||
|
masterRenderer.renderScene(data.entities, data.normalMapEntities, data.flatTerrains, data.lights, data.camera, data.clippingPlane);
|
||||||
|
contrastFbo.unbindFBO();
|
||||||
|
PostProcessing.doPostProcessing(contrastFbo.colorTexture);
|
||||||
|
masterRenderer.renderGuis(data.guis);
|
||||||
|
TextMaster.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postRender() {
|
||||||
|
Window.swapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cleanup() {
|
||||||
|
Window.stop();
|
||||||
|
PostProcessing.cleanUp();
|
||||||
|
ParticleMaster.cleanUp();
|
||||||
|
masterRenderer.cleanUp();
|
||||||
|
TextMaster.cleanUp();
|
||||||
|
Loader.cleanUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package io.github.hydos.ginger.engine.api;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* make your own resource manager if you want!
|
||||||
|
*/
|
||||||
|
public abstract class ResourceManager {
|
||||||
|
|
||||||
|
public abstract String getResourcePath(String path);
|
||||||
|
|
||||||
|
public abstract boolean getResourceInternally(String path);
|
||||||
|
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import io.github.hydos.ginger.engine.elements.objects.Player;
|
||||||
import io.github.hydos.ginger.engine.io.Window;
|
import io.github.hydos.ginger.engine.io.Window;
|
||||||
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
||||||
|
|
||||||
public class ThirdPersonCamera {
|
public class Camera {
|
||||||
|
|
||||||
private float distanceFromPlayer = 5;
|
private float distanceFromPlayer = 5;
|
||||||
private float angleAroundPlayer = 0;
|
private float angleAroundPlayer = 0;
|
||||||
|
@ -21,12 +21,12 @@ public class ThirdPersonCamera {
|
||||||
private Player player;
|
private Player player;
|
||||||
|
|
||||||
|
|
||||||
public ThirdPersonCamera(Player player) {
|
public Camera(Player player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThirdPersonCamera(Vector3f vector3f, Player player) {
|
public Camera(Vector3f vector3f, Player player) {
|
||||||
this.position = vector3f;
|
this.position = vector3f;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class Player extends Entity{
|
||||||
|
|
||||||
public void move(Terrain t) {
|
public void move(Terrain t) {
|
||||||
checkInputs();
|
checkInputs();
|
||||||
|
if(t != null) {
|
||||||
super.increaseRotation(0, (float) ((currentTurn) * Window.getTime() ), 0);
|
super.increaseRotation(0, (float) ((currentTurn) * Window.getTime() ), 0);
|
||||||
float distance = (float) ((currentSpeed) * (Window.getTime()));
|
float distance = (float) ((currentSpeed) * (Window.getTime()));
|
||||||
float dx = (float) (distance * Math.sin(Math.toRadians(super.getRotY())));
|
float dx = (float) (distance * Math.sin(Math.toRadians(super.getRotY())));
|
||||||
|
@ -38,6 +39,8 @@ public class Player extends Entity{
|
||||||
upwardsSpeed = 0;
|
upwardsSpeed = 0;
|
||||||
super.getPosition().y = terrainHeight;
|
super.getPosition().y = terrainHeight;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.github.hydos.ginger.engine.math;
|
package io.github.hydos.ginger.engine.math;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
import io.github.hydos.ginger.engine.math.vectors.Vector2f;
|
import io.github.hydos.ginger.engine.math.vectors.Vector2f;
|
||||||
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
||||||
|
@ -18,7 +18,7 @@ public class Maths {
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Matrix4f createViewMatrix(ThirdPersonCamera camera) {
|
public static Matrix4f createViewMatrix(Camera camera) {
|
||||||
Matrix4f viewMatrix = new Matrix4f();
|
Matrix4f viewMatrix = new Matrix4f();
|
||||||
viewMatrix.setIdentity();
|
viewMatrix.setIdentity();
|
||||||
Matrix4f.rotate((float) Math.toRadians(camera.getPitch()), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
|
Matrix4f.rotate((float) Math.toRadians(camera.getPitch()), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.github.hydos.ginger.engine.particle;
|
package io.github.hydos.ginger.engine.particle;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.io.Window;
|
import io.github.hydos.ginger.engine.io.Window;
|
||||||
import io.github.hydos.ginger.engine.math.vectors.Vector2f;
|
import io.github.hydos.ginger.engine.math.vectors.Vector2f;
|
||||||
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
||||||
|
@ -70,7 +70,7 @@ public class Particle {
|
||||||
return blend;
|
return blend;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean update(ThirdPersonCamera camera) {
|
public boolean update(Camera camera) {
|
||||||
float time = (float) Window.getTime() / 1000000;
|
float time = (float) Window.getTime() / 1000000;
|
||||||
velocity.y += Constants.gravity * gravityEffect * time;
|
velocity.y += Constants.gravity * gravityEffect * time;
|
||||||
Vector3f change = new Vector3f(velocity);
|
Vector3f change = new Vector3f(velocity);
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
import io.github.hydos.ginger.engine.render.renderers.ParticleRenderer;
|
import io.github.hydos.ginger.engine.render.renderers.ParticleRenderer;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class ParticleMaster {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void update(ThirdPersonCamera camera) {
|
public static void update(Camera camera) {
|
||||||
Iterator<Entry<ParticleTexture, List<Particle>>> mapIterator = particles.entrySet().iterator();
|
Iterator<Entry<ParticleTexture, List<Particle>>> mapIterator = particles.entrySet().iterator();
|
||||||
while(mapIterator.hasNext()) {
|
while(mapIterator.hasNext()) {
|
||||||
List<Particle> list = mapIterator.next().getValue();
|
List<Particle> list = mapIterator.next().getValue();
|
||||||
|
@ -40,7 +40,7 @@ public class ParticleMaster {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderParticles(ThirdPersonCamera camera) {
|
public static void renderParticles(Camera camera) {
|
||||||
particleRenderer.render(particles, camera);
|
particleRenderer.render(particles, camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.joml.Vector4f;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL13;
|
import org.lwjgl.opengl.GL13;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.elements.GuiTexture;
|
import io.github.hydos.ginger.engine.elements.GuiTexture;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Entity;
|
import io.github.hydos.ginger.engine.elements.objects.Entity;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Light;
|
import io.github.hydos.ginger.engine.elements.objects.Light;
|
||||||
|
@ -53,7 +53,7 @@ public class MasterRenderer {
|
||||||
public static final float NEAR_PLANE = 0.1f;
|
public static final float NEAR_PLANE = 0.1f;
|
||||||
private static final float FAR_PLANE = 1000f;
|
private static final float FAR_PLANE = 1000f;
|
||||||
|
|
||||||
public MasterRenderer(ThirdPersonCamera camera) {
|
public MasterRenderer(Camera camera) {
|
||||||
createProjectionMatrix();
|
createProjectionMatrix();
|
||||||
entityShader = new StaticShader();
|
entityShader = new StaticShader();
|
||||||
entityRenderer = new EntityRenderer(entityShader, projectionMatrix);
|
entityRenderer = new EntityRenderer(entityShader, projectionMatrix);
|
||||||
|
@ -86,7 +86,7 @@ public class MasterRenderer {
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, shadowMapRenderer.getShadowMap());
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, shadowMapRenderer.getShadowMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderScene(List<Entity> entities, List<Entity> normalEntities, List<Terrain> terrains, List<Light> lights, ThirdPersonCamera camera, Vector4f clipPlane) {
|
public void renderScene(List<Entity> entities, List<Entity> normalEntities, List<Terrain> terrains, List<Light> lights, Camera camera, Vector4f clipPlane) {
|
||||||
prepare();
|
prepare();
|
||||||
renderEntities(entities, camera, lights);
|
renderEntities(entities, camera, lights);
|
||||||
renderNormalEntities(normalEntities, lights, camera, clipPlane);
|
renderNormalEntities(normalEntities, lights, camera, clipPlane);
|
||||||
|
@ -96,7 +96,7 @@ public class MasterRenderer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderNormalEntities(List<Entity> normalEntities, List<Light> lights, ThirdPersonCamera camera, Vector4f clipPlane) {
|
private void renderNormalEntities(List<Entity> normalEntities, List<Light> lights, Camera camera, Vector4f clipPlane) {
|
||||||
for(Entity entity: normalEntities) {
|
for(Entity entity: normalEntities) {
|
||||||
processEntityWithNormal(entity);
|
processEntityWithNormal(entity);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ public class MasterRenderer {
|
||||||
guiRenderer.render(guis);
|
guiRenderer.render(guis);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderTerrains(List<Terrain> terrains, List<Light> lights, ThirdPersonCamera camera) {
|
private void renderTerrains(List<Terrain> terrains, List<Light> lights, Camera camera) {
|
||||||
terrainShader.start();
|
terrainShader.start();
|
||||||
terrainShader.loadSkyColour(Window.getColour());
|
terrainShader.loadSkyColour(Window.getColour());
|
||||||
terrainShader.loadLights(lights);
|
terrainShader.loadLights(lights);
|
||||||
|
@ -116,7 +116,7 @@ public class MasterRenderer {
|
||||||
terrainShader.stop();
|
terrainShader.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderEntities(List<Entity> entities, ThirdPersonCamera camera, List<Light> lights) {
|
private void renderEntities(List<Entity> entities, Camera camera, List<Light> lights) {
|
||||||
for(Entity entity: entities) {
|
for(Entity entity: entities) {
|
||||||
processEntity(entity);
|
processEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL13;
|
||||||
import org.lwjgl.opengl.GL20;
|
import org.lwjgl.opengl.GL20;
|
||||||
import org.lwjgl.opengl.GL30;
|
import org.lwjgl.opengl.GL30;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Entity;
|
import io.github.hydos.ginger.engine.elements.objects.Entity;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Light;
|
import io.github.hydos.ginger.engine.elements.objects.Light;
|
||||||
import io.github.hydos.ginger.engine.io.Window;
|
import io.github.hydos.ginger.engine.io.Window;
|
||||||
|
@ -33,7 +33,7 @@ public class NormalMappingRenderer {
|
||||||
shader.stop();
|
shader.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Map<TexturedModel, List<Entity>> entities, Vector4f clipPlane, List<Light> lights, ThirdPersonCamera camera) {
|
public void render(Map<TexturedModel, List<Entity>> entities, Vector4f clipPlane, List<Light> lights, Camera camera) {
|
||||||
shader.start();
|
shader.start();
|
||||||
prepare(clipPlane, lights, camera);
|
prepare(clipPlane, lights, camera);
|
||||||
for (TexturedModel model : entities.keySet()) {
|
for (TexturedModel model : entities.keySet()) {
|
||||||
|
@ -87,7 +87,7 @@ public class NormalMappingRenderer {
|
||||||
shader.loadOffset(0, 0);
|
shader.loadOffset(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepare(Vector4f clipPlane, List<Light> lights, ThirdPersonCamera camera) {
|
private void prepare(Vector4f clipPlane, List<Light> lights, Camera camera) {
|
||||||
shader.loadClipPlane(clipPlane);
|
shader.loadClipPlane(clipPlane);
|
||||||
//need to be public variables in MasterRenderer
|
//need to be public variables in MasterRenderer
|
||||||
shader.loadSkyColour(Window.getColour());
|
shader.loadSkyColour(Window.getColour());
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.lwjgl.opengl.GL20;
|
||||||
import org.lwjgl.opengl.GL30;
|
import org.lwjgl.opengl.GL30;
|
||||||
import org.lwjgl.opengl.GL31;
|
import org.lwjgl.opengl.GL31;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.math.Maths;
|
import io.github.hydos.ginger.engine.math.Maths;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
||||||
|
@ -50,7 +50,7 @@ public class ParticleRenderer {
|
||||||
shader.stop();
|
shader.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Map<ParticleTexture, List<Particle>> particles, ThirdPersonCamera camera){
|
public void render(Map<ParticleTexture, List<Particle>> particles, Camera camera){
|
||||||
Matrix4f viewMatrix = Maths.createViewMatrix(camera);
|
Matrix4f viewMatrix = Maths.createViewMatrix(camera);
|
||||||
prepare();
|
prepare();
|
||||||
for(ParticleTexture texture : particles.keySet()) {
|
for(ParticleTexture texture : particles.keySet()) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.lwjgl.opengl.GL13;
|
||||||
import org.lwjgl.opengl.GL20;
|
import org.lwjgl.opengl.GL20;
|
||||||
import org.lwjgl.opengl.GL30;
|
import org.lwjgl.opengl.GL30;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
import io.github.hydos.ginger.engine.render.models.RawModel;
|
import io.github.hydos.ginger.engine.render.models.RawModel;
|
||||||
import io.github.hydos.ginger.engine.render.shaders.SkyboxShader;
|
import io.github.hydos.ginger.engine.render.shaders.SkyboxShader;
|
||||||
|
@ -75,7 +75,7 @@ public class SkyboxRenderer {
|
||||||
shader.stop();
|
shader.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(ThirdPersonCamera camera) {
|
public void render(Camera camera) {
|
||||||
shader.start();
|
shader.start();
|
||||||
shader.loadViewMatrix(camera);
|
shader.loadViewMatrix(camera);
|
||||||
GL30.glBindVertexArray(cube.getVaoID());
|
GL30.glBindVertexArray(cube.getVaoID());
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.github.hydos.ginger.engine.render.shaders;
|
package io.github.hydos.ginger.engine.render.shaders;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.math.Maths;
|
import io.github.hydos.ginger.engine.math.Maths;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class SkyboxShader extends ShaderProgram{
|
||||||
super.loadMatrix(location_projectionMatrix, matrix);
|
super.loadMatrix(location_projectionMatrix, matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadViewMatrix(ThirdPersonCamera camera){
|
public void loadViewMatrix(Camera camera){
|
||||||
Matrix4f matrix = Maths.createViewMatrix(camera);
|
Matrix4f matrix = Maths.createViewMatrix(camera);
|
||||||
matrix.m30 = 0;
|
matrix.m30 = 0;
|
||||||
matrix.m31 = 0;
|
matrix.m31 = 0;
|
||||||
|
|
|
@ -2,7 +2,7 @@ package io.github.hydos.ginger.engine.render.shaders;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Light;
|
import io.github.hydos.ginger.engine.elements.objects.Light;
|
||||||
import io.github.hydos.ginger.engine.math.Maths;
|
import io.github.hydos.ginger.engine.math.Maths;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
|
@ -65,7 +65,7 @@ public class StaticShader extends ShaderProgram{
|
||||||
super.loadMatrix(location_projectionMatrix, matrix);
|
super.loadMatrix(location_projectionMatrix, matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadViewMatrix(ThirdPersonCamera camera) {
|
public void loadViewMatrix(Camera camera) {
|
||||||
Matrix4f matrix = Maths.createViewMatrix(camera);
|
Matrix4f matrix = Maths.createViewMatrix(camera);
|
||||||
super.loadMatrix(location_viewMatrix, matrix);
|
super.loadMatrix(location_viewMatrix, matrix);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package io.github.hydos.ginger.engine.render.shaders;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Light;
|
import io.github.hydos.ginger.engine.elements.objects.Light;
|
||||||
import io.github.hydos.ginger.engine.math.Maths;
|
import io.github.hydos.ginger.engine.math.Maths;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
|
@ -83,7 +83,7 @@ public class TerrainShader extends ShaderProgram{
|
||||||
super.loadMatrix(location_projectionMatrix, matrix);
|
super.loadMatrix(location_projectionMatrix, matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadViewMatrix(ThirdPersonCamera camera) {
|
public void loadViewMatrix(Camera camera) {
|
||||||
Matrix4f matrix = Maths.createViewMatrix(camera);
|
Matrix4f matrix = Maths.createViewMatrix(camera);
|
||||||
super.loadMatrix(location_viewMatrix, matrix);
|
super.loadMatrix(location_viewMatrix, matrix);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package io.github.hydos.ginger.engine.render.tools;
|
||||||
|
|
||||||
import org.joml.Vector4f;
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.io.Window;
|
import io.github.hydos.ginger.engine.io.Window;
|
||||||
import io.github.hydos.ginger.engine.math.Maths;
|
import io.github.hydos.ginger.engine.math.Maths;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
|
@ -19,12 +19,12 @@ public class MousePicker {
|
||||||
|
|
||||||
private Matrix4f projectionMatrix;
|
private Matrix4f projectionMatrix;
|
||||||
private Matrix4f viewMatrix;
|
private Matrix4f viewMatrix;
|
||||||
private ThirdPersonCamera camera;
|
private Camera camera;
|
||||||
|
|
||||||
private Terrain terrain;
|
private Terrain terrain;
|
||||||
private Vector3f currentTerrainPoint;
|
private Vector3f currentTerrainPoint;
|
||||||
|
|
||||||
public MousePicker(ThirdPersonCamera cam, Matrix4f projection, Terrain terrain) {
|
public MousePicker(Camera cam, Matrix4f projection, Terrain terrain) {
|
||||||
camera = cam;
|
camera = cam;
|
||||||
projectionMatrix = projection;
|
projectionMatrix = projection;
|
||||||
viewMatrix = Maths.createViewMatrix(camera);
|
viewMatrix = Maths.createViewMatrix(camera);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package io.github.hydos.ginger.engine.shadow;
|
||||||
|
|
||||||
import org.joml.Vector4f;
|
import org.joml.Vector4f;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.io.Window;
|
import io.github.hydos.ginger.engine.io.Window;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
import io.github.hydos.ginger.engine.math.vectors.Vector3f;
|
||||||
|
@ -31,7 +31,7 @@ public class ShadowBox {
|
||||||
private float minY, maxY;
|
private float minY, maxY;
|
||||||
private float minZ, maxZ;
|
private float minZ, maxZ;
|
||||||
private Matrix4f lightViewMatrix;
|
private Matrix4f lightViewMatrix;
|
||||||
private ThirdPersonCamera cam;
|
private Camera cam;
|
||||||
|
|
||||||
private float farHeight, farWidth, nearHeight, nearWidth;
|
private float farHeight, farWidth, nearHeight, nearWidth;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class ShadowBox {
|
||||||
* @param camera
|
* @param camera
|
||||||
* - the in-game camera.
|
* - the in-game camera.
|
||||||
*/
|
*/
|
||||||
protected ShadowBox(Matrix4f lightViewMatrix, ThirdPersonCamera camera) {
|
protected ShadowBox(Matrix4f lightViewMatrix, Camera camera) {
|
||||||
this.lightViewMatrix = lightViewMatrix;
|
this.lightViewMatrix = lightViewMatrix;
|
||||||
this.cam = camera;
|
this.cam = camera;
|
||||||
calculateWidthsAndHeights();
|
calculateWidthsAndHeights();
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
|
import io.github.hydos.ginger.engine.cameras.Camera;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Entity;
|
import io.github.hydos.ginger.engine.elements.objects.Entity;
|
||||||
import io.github.hydos.ginger.engine.elements.objects.Light;
|
import io.github.hydos.ginger.engine.elements.objects.Light;
|
||||||
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
import io.github.hydos.ginger.engine.math.matrixes.Matrix4f;
|
||||||
|
@ -44,7 +44,7 @@ public class ShadowMapMasterRenderer {
|
||||||
* @param camera
|
* @param camera
|
||||||
* - the camera being used in the scene.
|
* - the camera being used in the scene.
|
||||||
*/
|
*/
|
||||||
public ShadowMapMasterRenderer(ThirdPersonCamera camera) {
|
public ShadowMapMasterRenderer(Camera camera) {
|
||||||
shader = new ShadowShader();
|
shader = new ShadowShader();
|
||||||
shadowBox = new ShadowBox(lightViewMatrix, camera);
|
shadowBox = new ShadowBox(lightViewMatrix, camera);
|
||||||
shadowFbo = new ShadowFrameBuffer(SHADOW_MAP_SIZE, SHADOW_MAP_SIZE);
|
shadowFbo = new ShadowFrameBuffer(SHADOW_MAP_SIZE, SHADOW_MAP_SIZE);
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue