Renderer
is responsible for taking rendering commands and
* executing them on the underlying video hardware.
*
* @author Kirill Vainer
*/
public interface Renderer {
/**
* Get the capabilities of the renderer.
* @return The capabilities of the renderer.
*/
public EnumSetnull
to disable lighting.
*
* @param lights The light list to set.
*/
public void setLighting(LightList lights);
/**
* Sets the shader to use for rendering.
* If the shader has not been uploaded yet, it is compiled
* and linked. If it has been uploaded, then the
* uniform data is updated and the shader is set.
*
* @param shader The shader to use for rendering.
*/
public void setShader(Shader shader);
/**
* Deletes a shader. This method also deletes
* the attached shader sources.
*
* @param shader Shader to delete.
*/
public void deleteShader(Shader shader);
/**
* Deletes the provided shader source.
*
* @param source The ShaderSource to delete.
*/
public void deleteShaderSource(ShaderSource source);
/**
* Copies contents from src to dst, scaling if necessary.
*/
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst);
/**
* Copies contents from src to dst, scaling if necessary.
* set copyDepth to false to only copy the color buffers.
*/
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst, boolean copyDepth);
/**
* Sets the framebuffer that will be drawn to.
*/
public void setFrameBuffer(FrameBuffer fb);
/**
* Set the framebuffer that will be set instead of the main framebuffer
* when a call to setFrameBuffer(null) is made.
*
* @param fb
*/
public void setMainFrameBufferOverride(FrameBuffer fb);
/**
* Reads the pixels currently stored in the specified framebuffer
* into the given ByteBuffer object.
* Only color pixels are transferred, the format is BGRA with 8 bits
* per component. The given byte buffer should have at least
* fb.getWidth() * fb.getHeight() * 4 bytes remaining.
*
* @param fb The framebuffer to read from
* @param byteBuf The bytebuffer to transfer color data to
*/
public void readFrameBuffer(FrameBuffer fb, ByteBuffer byteBuf);
/**
* Deletes a framebuffer and all attached renderbuffers
*/
public void deleteFrameBuffer(FrameBuffer fb);
/**
* Sets the texture to use for the given texture unit.
*/
public void setTexture(int unit, Texture tex);
/**
* Deletes a texture from the GPU.
*/
public void deleteImage(Image image);
/**
* Uploads a vertex buffer to the GPU.
*
* @param vb The vertex buffer to upload
*/
public void updateBufferData(VertexBuffer vb);
/**
* Deletes a vertex buffer from the GPU.
* @param vb The vertex buffer to delete
*/
public void deleteBuffer(VertexBuffer vb);
/**
* Renders count
meshes, with the geometry data supplied.
* The shader which is currently set with setShader
is
* responsible for transforming the input verticies into clip space
* and shading it based on the given vertex attributes.
* The int variable gl_InstanceID can be used to access the current
* instance of the mesh being rendered inside the vertex shader.
*
* @param mesh The mesh to render
* @param lod The LOD level to use, see {@link Mesh#setLodLevels(com.jme3.scene.VertexBuffer[]) }.
* @param count Number of mesh instances to render
*/
public void renderMesh(Mesh mesh, int lod, int count);
/**
* Resets all previously used {@link GLObject}s on this Renderer.
* The state of the GLObjects is reset in such way, that using
* them again will cause the renderer to reupload them.
* Call this method when you know the GL context is going to shutdown.
*
* @see GLObject#resetObject()
*/
public void resetGLObjects();
/**
* Deletes all previously used {@link GLObject}s on this Renderer, and
* then resets the GLObjects.
*
* @see #resetGLObjects()
* @see GLObject#deleteObject(com.jme3.renderer.Renderer)
*/
public void cleanup();
/**
* Sets the alpha to coverage state.
* * When alpha coverage and multi-sampling is enabled, * each pixel will contain alpha coverage in all * of its subsamples, which is then combined when * other future alpha-blended objects are rendered. *
** Alpha-to-coverage is useful for rendering transparent objects * without having to worry about sorting them. *
*/ public void setAlphaToCoverage(boolean value); }