Extra update
parent
116e83bc1d
commit
c448d21a8e
|
@ -20,10 +20,7 @@ public class MasterRenderer {
|
|||
|
||||
private StaticShader entityShader;
|
||||
private EntityRenderer entityRenderer;
|
||||
|
||||
private TerrainShader terrainShader;
|
||||
private TerrainRenderer terrainRenderer;
|
||||
|
||||
|
||||
private GuiShader guiShader;
|
||||
private GuiRenderer guiRenderer;
|
||||
|
||||
|
@ -53,10 +50,7 @@ public class MasterRenderer {
|
|||
guiRenderer = new GuiRenderer(guiShader);
|
||||
|
||||
normalRenderer = new NormalMappingRenderer(projectionMatrix);
|
||||
|
||||
terrainShader = new TerrainShader();
|
||||
terrainRenderer = new TerrainRenderer(terrainShader, projectionMatrix);
|
||||
|
||||
|
||||
shadowMapRenderer = new ShadowMapMasterRenderer(camera);
|
||||
|
||||
}
|
||||
|
@ -73,7 +67,8 @@ public class MasterRenderer {
|
|||
public void prepare() {
|
||||
GL13.glActiveTexture(GL13.GL_TEXTURE5);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, shadowMapRenderer.getShadowMap());
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||
}
|
||||
|
||||
public void renderScene(List<RenderObject> entities, List<RenderObject> normalEntities, List<Terrain> terrains, List<Light> lights, Camera camera, Vector4f clipPlane) {
|
||||
|
@ -97,13 +92,7 @@ public class MasterRenderer {
|
|||
guiRenderer.render(guis);
|
||||
}
|
||||
|
||||
private void renderTerrains(List<Terrain> terrains, List<Light> lights, Camera camera) {
|
||||
terrainShader.start();
|
||||
terrainShader.loadSkyColour(Window.getColour());
|
||||
terrainShader.loadLights(lights);
|
||||
terrainShader.loadViewMatrix(camera);
|
||||
terrainRenderer.render(terrains, shadowMapRenderer.getToShadowMapSpaceMatrix());
|
||||
terrainShader.stop();
|
||||
private void renderTerrains(List<Terrain> terrains, List<Light> lights, Camera camera) {
|
||||
}
|
||||
|
||||
private void renderEntities(List<RenderObject> entities, Camera camera, List<Light> lights) {
|
||||
|
@ -158,7 +147,6 @@ public class MasterRenderer {
|
|||
|
||||
public void cleanUp() {
|
||||
entityShader.cleanUp();
|
||||
terrainShader.cleanUp();
|
||||
guiRenderer.cleanUp();
|
||||
shadowMapRenderer.cleanUp();
|
||||
normalRenderer.cleanUp();
|
||||
|
|
|
@ -180,8 +180,8 @@ public class Loader {
|
|||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 10240, 9729.0f);
|
||||
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, texture.getWidth(), texture.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, texture.getImage());
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, -1f);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||
if(Window.glContext.GL_EXT_texture_filter_anisotropic) {//TODO: add option to use or disable
|
||||
float amount = Math.min(4f, GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT, amount);
|
||||
|
@ -199,8 +199,8 @@ public class Loader {
|
|||
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, texture.getWidth(), texture.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, texture.getImage());
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
|
||||
GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
|
||||
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, -0f);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||
return textureID;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue