Custom Pipelines

Custom pipelines are used to control how objects are passed to the GPU for rendering. To make a custom pipeline you need to make a class that implements the RenderPipeline interface.

public class CustomPipeline implements RenderPipeline {

    @Override
    public void init(ShaderManager manager, Transformation transformation, FrustumCullingFilter frustumFilter, ShadowMap shadowMap) {

    }

    @Override
    public void render(Scene scene) {

    }

    @Override
    public void renderDepthMap(Scene scene, Shader depthMap, Matrix4f lightViewMatrix) {

    }

}

Initialization

@Override
public void init(ShaderManager manager, Transformation transformation, FrustumCullingFilter frustumFilter, ShadowMap shadowMap) {

}

The init method is ran when the pipeline is initalized. Constant information is passed here and is expected to be stored in fields. Argument Overview: ShaderManager - The shader manager is used to obtain the shader from. Transformation - This class contains the transformation methods. FrustumCullingFilter - This class is to test for frustum culling. ShadowMap - This class is the map of shadows in the visible scene.

Rendering

@Override
public void render(Scene scene) {

}

The render method is ran every time a frame needs to be rendered. You will need to bind your shaders and set the required shader uniforms here. (Don't forget to unbind your shader at the end). Argument Overview: Scene - The current scene.

Rendering the Depth Map

@Override
public void renderDepthMap(Scene scene, Shader depthMap, Matrix4f lightViewMatrix) {

}

The renderDepthMap method is ran every frame before the normal render method. This method is used used for shadow calculations. If you do not want your pipeline to do anything with the default lighting system, than this method can be left empty. Argument Overview: Scene - The current scene. Shader - The depthMap shader. Matrix4f The light view matrix.

Last updated