private void renderDepthMap(Window window, Camera camera, Scene scene) { if (scene.isRenderShadows()) { // Setup view port to match the texture size glBindFramebuffer(GL_FRAMEBUFFER, shadowMap.getDepthMapFBO()); glViewport(0, 0, ShadowMap.SHADOW_MAP_WIDTH, ShadowMap.SHADOW_MAP_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT); depthShaderProgram.bind(); DirectionalLight light = scene.getSceneLight().getDirectionalLight(); Vector3f lightDirection = light.getDirection(); float lightAngleX = (float) Math.toDegrees(Math.acos(lightDirection.z)); float lightAngleY = (float) Math.toDegrees(Math.asin(lightDirection.x)); float lightAngleZ = 0; Matrix4f lightViewMatrix = transformation.updateLightViewMatrix(new Vector3f(lightDirection).mul(light.getShadowPosMult()), new Vector3f(lightAngleX, lightAngleY, lightAngleZ)); DirectionalLight.OrthoCoords orthCoords = light.getOrthoCoords(); Matrix4f orthoProjMatrix = transformation.updateOrthoProjectionMatrix(orthCoords.left, orthCoords.right, orthCoords.bottom, orthCoords.top, orthCoords.near, orthCoords.far); depthShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); renderNonInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); renderInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); // Unbind depthShaderProgram.unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } }
private void renderDepthMap(Window window, Camera camera, Scene scene) { if (scene.isRenderShadows()) { // Setup view port to match the texture size glBindFramebuffer(GL_FRAMEBUFFER, shadowMap.getDepthMapFBO()); glViewport(0, 0, ShadowMap.SHADOW_MAP_WIDTH, ShadowMap.SHADOW_MAP_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT); depthShaderProgram.bind(); DirectionalLight light = scene.getSceneLight().getDirectionalLight(); Vector3f lightDirection = light.getDirection(); float lightAngleX = (float) Math.toDegrees(Math.acos(lightDirection.z)); float lightAngleY = (float) Math.toDegrees(Math.asin(lightDirection.x)); float lightAngleZ = 0; Matrix4f lightViewMatrix = transformation.updateLightViewMatrix(new Vector3f(lightDirection).mul(light.getShadowPosMult()), new Vector3f(lightAngleX, lightAngleY, lightAngleZ)); DirectionalLight.OrthoCoords orthCoords = light.getOrthoCoords(); Matrix4f orthoProjMatrix = transformation.updateOrthoProjectionMatrix(orthCoords.left, orthCoords.right, orthCoords.bottom, orthCoords.top, orthCoords.near, orthCoords.far); depthShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); renderNonInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); renderInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); // Unbind depthShaderProgram.unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } }
private void renderDepthMap(Window window, Camera camera, Scene scene) { if (scene.isRenderShadows()) { // Setup view port to match the texture size glBindFramebuffer(GL_FRAMEBUFFER, shadowMap.getDepthMapFBO()); glViewport(0, 0, ShadowMap.SHADOW_MAP_WIDTH, ShadowMap.SHADOW_MAP_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT); depthShaderProgram.bind(); DirectionalLight light = scene.getSceneLight().getDirectionalLight(); Vector3f lightDirection = light.getDirection(); float lightAngleX = (float) Math.toDegrees(Math.acos(lightDirection.z)); float lightAngleY = (float) Math.toDegrees(Math.asin(lightDirection.x)); float lightAngleZ = 0; Matrix4f lightViewMatrix = transformation.updateLightViewMatrix(new Vector3f(lightDirection).mul(light.getShadowPosMult()), new Vector3f(lightAngleX, lightAngleY, lightAngleZ)); DirectionalLight.OrthoCoords orthCoords = light.getOrthoCoords(); Matrix4f orthoProjMatrix = transformation.updateOrthoProjectionMatrix(orthCoords.left, orthCoords.right, orthCoords.bottom, orthCoords.top, orthCoords.near, orthCoords.far); depthShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); renderNonInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); renderInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); // Unbind depthShaderProgram.unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } }
private void renderDepthMap(Window window, Camera camera, Scene scene) { if (scene.isRenderShadows()) { // Setup view port to match the texture size glBindFramebuffer(GL_FRAMEBUFFER, shadowMap.getDepthMapFBO()); glViewport(0, 0, ShadowMap.SHADOW_MAP_WIDTH, ShadowMap.SHADOW_MAP_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT); depthShaderProgram.bind(); DirectionalLight light = scene.getSceneLight().getDirectionalLight(); Vector3f lightDirection = light.getDirection(); float lightAngleX = (float) Math.toDegrees(Math.acos(lightDirection.z)); float lightAngleY = (float) Math.toDegrees(Math.asin(lightDirection.x)); float lightAngleZ = 0; Matrix4f lightViewMatrix = transformation.updateLightViewMatrix(new Vector3f(lightDirection).mul(light.getShadowPosMult()), new Vector3f(lightAngleX, lightAngleY, lightAngleZ)); DirectionalLight.OrthoCoords orthCoords = light.getOrthoCoords(); Matrix4f orthoProjMatrix = transformation.updateOrthoProjectionMatrix(orthCoords.left, orthCoords.right, orthCoords.bottom, orthCoords.top, orthCoords.near, orthCoords.far); depthShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); renderNonInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); renderInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); // Unbind depthShaderProgram.unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } }
private void renderDepthMap(Window window, Camera camera, Scene scene) { if (scene.isRenderShadows()) { // Setup view port to match the texture size glBindFramebuffer(GL_FRAMEBUFFER, shadowMap.getDepthMapFBO()); glViewport(0, 0, ShadowMap.SHADOW_MAP_WIDTH, ShadowMap.SHADOW_MAP_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT); depthShaderProgram.bind(); DirectionalLight light = scene.getSceneLight().getDirectionalLight(); Vector3f lightDirection = light.getDirection(); float lightAngleX = (float) Math.toDegrees(Math.acos(lightDirection.z)); float lightAngleY = (float) Math.toDegrees(Math.asin(lightDirection.x)); float lightAngleZ = 0; Matrix4f lightViewMatrix = transformation.updateLightViewMatrix(new Vector3f(lightDirection).mul(light.getShadowPosMult()), new Vector3f(lightAngleX, lightAngleY, lightAngleZ)); DirectionalLight.OrthoCoords orthCoords = light.getOrthoCoords(); Matrix4f orthoProjMatrix = transformation.updateOrthoProjectionMatrix(orthCoords.left, orthCoords.right, orthCoords.bottom, orthCoords.top, orthCoords.near, orthCoords.far); depthShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); renderNonInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); renderInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); // Unbind depthShaderProgram.unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } }
private void renderDepthMap(Window window, Camera camera, Scene scene) { if (scene.isRenderShadows()) { // Setup view port to match the texture size glBindFramebuffer(GL_FRAMEBUFFER, shadowMap.getDepthMapFBO()); glViewport(0, 0, ShadowMap.SHADOW_MAP_WIDTH, ShadowMap.SHADOW_MAP_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT); depthShaderProgram.bind(); DirectionalLight light = scene.getSceneLight().getDirectionalLight(); Vector3f lightDirection = light.getDirection(); float lightAngleX = (float) Math.toDegrees(Math.acos(lightDirection.z)); float lightAngleY = (float) Math.toDegrees(Math.asin(lightDirection.x)); float lightAngleZ = 0; Matrix4f lightViewMatrix = transformation.updateLightViewMatrix(new Vector3f(lightDirection).mul(light.getShadowPosMult()), new Vector3f(lightAngleX, lightAngleY, lightAngleZ)); DirectionalLight.OrthoCoords orthCoords = light.getOrthoCoords(); Matrix4f orthoProjMatrix = transformation.updateOrthoProjectionMatrix(orthCoords.left, orthCoords.right, orthCoords.bottom, orthCoords.top, orthCoords.near, orthCoords.far); depthShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); renderNonInstancedMeshes(scene, true, depthShaderProgram, null, lightViewMatrix); renderInstancedMeshes(scene, true, depthShaderProgram, null, lightViewMatrix); // Unbind depthShaderProgram.unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } }
private void renderDepthMap(Window window, Camera camera, Scene scene) { if (scene.isRenderShadows()) { // Setup view port to match the texture size glBindFramebuffer(GL_FRAMEBUFFER, shadowMap.getDepthMapFBO()); glViewport(0, 0, ShadowMap.SHADOW_MAP_WIDTH, ShadowMap.SHADOW_MAP_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT); depthShaderProgram.bind(); DirectionalLight light = scene.getSceneLight().getDirectionalLight(); Vector3f lightDirection = light.getDirection(); float lightAngleX = (float) Math.toDegrees(Math.acos(lightDirection.z)); float lightAngleY = (float) Math.toDegrees(Math.asin(lightDirection.x)); float lightAngleZ = 0; Matrix4f lightViewMatrix = transformation.updateLightViewMatrix(new Vector3f(lightDirection).mul(light.getShadowPosMult()), new Vector3f(lightAngleX, lightAngleY, lightAngleZ)); DirectionalLight.OrthoCoords orthCoords = light.getOrthoCoords(); Matrix4f orthoProjMatrix = transformation.updateOrthoProjectionMatrix(orthCoords.left, orthCoords.right, orthCoords.bottom, orthCoords.top, orthCoords.near, orthCoords.far); depthShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); renderNonInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); renderInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); // Unbind depthShaderProgram.unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } }
private void renderDepthMap(Window window, Camera camera, Scene scene) { if (scene.isRenderShadows()) { // Setup view port to match the texture size glBindFramebuffer(GL_FRAMEBUFFER, shadowMap.getDepthMapFBO()); glViewport(0, 0, ShadowMap.SHADOW_MAP_WIDTH, ShadowMap.SHADOW_MAP_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT); depthShaderProgram.bind(); DirectionalLight light = scene.getSceneLight().getDirectionalLight(); Vector3f lightDirection = light.getDirection(); float lightAngleX = (float) Math.toDegrees(Math.acos(lightDirection.z)); float lightAngleY = (float) Math.toDegrees(Math.asin(lightDirection.x)); float lightAngleZ = 0; Matrix4f lightViewMatrix = transformation.updateLightViewMatrix(new Vector3f(lightDirection).mul(light.getShadowPosMult()), new Vector3f(lightAngleX, lightAngleY, lightAngleZ)); DirectionalLight.OrthoCoords orthCoords = light.getOrthoCoords(); Matrix4f orthoProjMatrix = transformation.updateOrthoProjectionMatrix(orthCoords.left, orthCoords.right, orthCoords.bottom, orthCoords.top, orthCoords.near, orthCoords.far); depthShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); renderNonInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); renderInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); // Unbind depthShaderProgram.unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } }
private void renderDepthMap(Window window, Camera camera, Scene scene) { if (scene.isRenderShadows()) { // Setup view port to match the texture size glBindFramebuffer(GL_FRAMEBUFFER, shadowMap.getDepthMapFBO()); glViewport(0, 0, ShadowMap.SHADOW_MAP_WIDTH, ShadowMap.SHADOW_MAP_HEIGHT); glClear(GL_DEPTH_BUFFER_BIT); depthShaderProgram.bind(); DirectionalLight light = scene.getSceneLight().getDirectionalLight(); Vector3f lightDirection = light.getDirection(); float lightAngleX = (float) Math.toDegrees(Math.acos(lightDirection.z)); float lightAngleY = (float) Math.toDegrees(Math.asin(lightDirection.x)); float lightAngleZ = 0; Matrix4f lightViewMatrix = transformation.updateLightViewMatrix(new Vector3f(lightDirection).mul(light.getShadowPosMult()), new Vector3f(lightAngleX, lightAngleY, lightAngleZ)); DirectionalLight.OrthoCoords orthCoords = light.getOrthoCoords(); Matrix4f orthoProjMatrix = transformation.updateOrthoProjectionMatrix(orthCoords.left, orthCoords.right, orthCoords.bottom, orthCoords.top, orthCoords.near, orthCoords.far); depthShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); renderNonInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); renderInstancedMeshes(scene, depthShaderProgram, null, lightViewMatrix); // Unbind depthShaderProgram.unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f viewMatrix = camera.getViewMatrix(); Matrix4f projectionMatrix = window.getProjectionMatrix(); sceneShaderProgram.setUniform("viewMatrix", viewMatrix); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); List<ShadowCascade> shadowCascades = shadowRenderer.getShadowCascades(); for (int i = 0; i < ShadowRenderer.NUM_CASCADES; i++) { ShadowCascade shadowCascade = shadowCascades.get(i); sceneShaderProgram.setUniform("orthoProjectionMatrix", shadowCascade.getOrthoProjMatrix(), i); sceneShaderProgram.setUniform("cascadeFarPlanes", ShadowRenderer.CASCADE_SPLITS[i], i); sceneShaderProgram.setUniform("lightViewMatrix", shadowCascade.getLightViewMatrix(), i); } SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); int start = 2; for (int i = 0; i < ShadowRenderer.NUM_CASCADES; i++) { sceneShaderProgram.setUniform("shadowMap_" + i, start + i); } sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene); renderInstancedMeshes(scene, viewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f viewMatrix = camera.getViewMatrix(); Matrix4f projectionMatrix = window.getProjectionMatrix(); sceneShaderProgram.setUniform("viewMatrix", viewMatrix); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); List<ShadowCascade> shadowCascades = shadowRenderer.getShadowCascades(); for (int i = 0; i < ShadowRenderer.NUM_CASCADES; i++) { ShadowCascade shadowCascade = shadowCascades.get(i); sceneShaderProgram.setUniform("orthoProjectionMatrix", shadowCascade.getOrthoProjMatrix(), i); sceneShaderProgram.setUniform("cascadeFarPlanes", ShadowRenderer.CASCADE_SPLITS[i], i); sceneShaderProgram.setUniform("lightViewMatrix", shadowCascade.getLightViewMatrix(), i); } SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); int start = 2; for (int i = 0; i < ShadowRenderer.NUM_CASCADES; i++) { sceneShaderProgram.setUniform("shadowMap_" + i, start + i); } sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene); renderInstancedMeshes(scene, viewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f projectionMatrix = transformation.getProjectionMatrix(); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix(); sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); Matrix4f lightViewMatrix = transformation.getLightViewMatrix(); Matrix4f viewMatrix = camera.getViewMatrix(); SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); sceneShaderProgram.setUniform("shadowMap", 2); sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); renderInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f projectionMatrix = window.getProjectionMatrix(); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix(); sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); Matrix4f lightViewMatrix = transformation.getLightViewMatrix(); Matrix4f viewMatrix = camera.getViewMatrix(); SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); sceneShaderProgram.setUniform("shadowMap", 2); sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); renderInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f projectionMatrix = transformation.getProjectionMatrix(); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix(); sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); Matrix4f lightViewMatrix = transformation.getLightViewMatrix(); Matrix4f viewMatrix = transformation.getViewMatrix(); SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); sceneShaderProgram.setUniform("shadowMap", 2); sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene, false, sceneShaderProgram, viewMatrix, lightViewMatrix); renderInstancedMeshes(scene, false, sceneShaderProgram, viewMatrix, lightViewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f projectionMatrix = transformation.getProjectionMatrix(); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix(); sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); Matrix4f lightViewMatrix = transformation.getLightViewMatrix(); Matrix4f viewMatrix = transformation.getViewMatrix(); SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); sceneShaderProgram.setUniform("shadowMap", 2); sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); renderInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f projectionMatrix = window.getProjectionMatrix(); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix(); sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); Matrix4f lightViewMatrix = transformation.getLightViewMatrix(); Matrix4f viewMatrix = camera.getViewMatrix(); SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); sceneShaderProgram.setUniform("shadowMap", 2); sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); renderInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f projectionMatrix = transformation.getProjectionMatrix(); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix(); sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); Matrix4f lightViewMatrix = transformation.getLightViewMatrix(); Matrix4f viewMatrix = transformation.getViewMatrix(); SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); sceneShaderProgram.setUniform("shadowMap", 2); sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); renderInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f projectionMatrix = transformation.getProjectionMatrix(); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix(); sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); Matrix4f lightViewMatrix = transformation.getLightViewMatrix(); Matrix4f viewMatrix = transformation.getViewMatrix(); SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); sceneShaderProgram.setUniform("shadowMap", 2); sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); renderInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f projectionMatrix = window.getProjectionMatrix(); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix(); sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); Matrix4f lightViewMatrix = transformation.getLightViewMatrix(); Matrix4f viewMatrix = camera.getViewMatrix(); SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); sceneShaderProgram.setUniform("shadowMap", 2); sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); renderInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); sceneShaderProgram.unbind(); }
public void renderScene(Window window, Camera camera, Scene scene) { sceneShaderProgram.bind(); Matrix4f projectionMatrix = window.getProjectionMatrix(); sceneShaderProgram.setUniform("projectionMatrix", projectionMatrix); Matrix4f orthoProjMatrix = transformation.getOrthoProjectionMatrix(); sceneShaderProgram.setUniform("orthoProjectionMatrix", orthoProjMatrix); Matrix4f lightViewMatrix = transformation.getLightViewMatrix(); Matrix4f viewMatrix = camera.getViewMatrix(); SceneLight sceneLight = scene.getSceneLight(); renderLights(viewMatrix, sceneLight); sceneShaderProgram.setUniform("fog", scene.getFog()); sceneShaderProgram.setUniform("texture_sampler", 0); sceneShaderProgram.setUniform("normalMap", 1); sceneShaderProgram.setUniform("shadowMap", 2); sceneShaderProgram.setUniform("renderShadow", scene.isRenderShadows() ? 1 : 0); renderNonInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); renderInstancedMeshes(scene, sceneShaderProgram, viewMatrix, lightViewMatrix); sceneShaderProgram.unbind(); }