Search in sources :

Example 1 with WorldRendererImplementation

use of io.xol.chunkstories.renderer.world.WorldRendererImplementation in project chunkstories by Hugobros3.

the class Camera method setupShader.

@Override
public void setupShader(Shader shader) {
    // Helper function to clean code from messy bits :)
    shader.setUniformMatrix4f("projectionMatrix", projectionMatrix4f);
    shader.setUniformMatrix4f("projectionMatrixInv", projectionMatrix4fInverted);
    shader.setUniformMatrix4f("modelViewMatrix", modelViewMatrix4f);
    shader.setUniformMatrix4f("modelViewMatrixInv", modelViewMatrix4fInverted);
    shader.setUniformMatrix3f("normalMatrix", normalMatrix3f);
    shader.setUniformMatrix3f("normalMatrixInv", normalMatrix3fInverted);
    shader.setUniformMatrix4f("modelViewProjectionMatrix", modelViewProjectionMatrix4f);
    shader.setUniformMatrix4f("modelViewProjectionMatrixInv", modelViewProjectionMatrix4fInverted);
    shader.setUniformMatrix4f("untranslatedMV", untranslatedMVP4f);
    shader.setUniformMatrix4f("untranslatedMVInv", untranslatedMVP4fInv);
    shader.setUniform2f("screenViewportSize", this.viewportWidth, this.viewportHeight);
    shader.setUniform3f("camPos", getCameraPosition());
    shader.setUniform3f("camUp", up);
    // Q: Why isn't this in worldRenderer.setupShaderUniforms ?
    // A: Because aperture is an eye property ! I think.
    WorldRenderer worldRenderer = Client.getInstance().getRenderingInterface().getWorldRenderer();
    if (worldRenderer != null) {
        WorldRendererImplementation wrImplementation = (WorldRendererImplementation) worldRenderer;
        shader.setUniform1f("apertureModifier", wrImplementation.getApertureModifier());
    }
}
Also used : WorldRenderer(io.xol.chunkstories.api.rendering.world.WorldRenderer) WorldRendererImplementation(io.xol.chunkstories.renderer.world.WorldRendererImplementation)

Aggregations

WorldRenderer (io.xol.chunkstories.api.rendering.world.WorldRenderer)1 WorldRendererImplementation (io.xol.chunkstories.renderer.world.WorldRendererImplementation)1