com.jme3.system
Class NullRenderer

java.lang.Object
  extended by com.jme3.system.NullRenderer
All Implemented Interfaces:
Renderer

public class NullRenderer
extends java.lang.Object
implements Renderer


Constructor Summary
NullRenderer()
           
 
Method Summary
 void applyRenderState(RenderState state)
          Applies the given RenderState, making the necessary GL calls so that the state is applied.
 void cleanup()
          Deletes all previously used Native Objects on this Renderer, and then resets the native objects.
 void clearBuffers(boolean color, boolean depth, boolean stencil)
          Clears certain channels of the currently bound framebuffer.
 void clearClipRect()
          Clears the clipping rectangle set with Renderer.setClipRect(int, int, int, int).
 void copyFrameBuffer(FrameBuffer src, FrameBuffer dst)
          Copies contents from src to dst, scaling if necessary.
 void copyFrameBuffer(FrameBuffer src, FrameBuffer dst, boolean copyDepth)
          Copies contents from src to dst, scaling if necessary.
 void deleteBuffer(VertexBuffer vb)
          Deletes a vertex buffer from the GPU.
 void deleteFrameBuffer(FrameBuffer fb)
          Deletes a framebuffer and all attached renderbuffers
 void deleteImage(Image image)
          Deletes a texture from the GPU.
 void deleteShader(Shader shader)
          Deletes a shader.
 void deleteShaderSource(Shader.ShaderSource source)
          Deletes the provided shader source.
 java.util.EnumSet<Caps> getCaps()
          Get the capabilities of the renderer.
 Statistics getStatistics()
          The statistics allow tracking of how data per frame, such as number of objects rendered, number of triangles, etc.
 void invalidateState()
          Invalidates the current rendering state.
 void onFrame()
          Called when a new frame has been rendered.
 void readFrameBuffer(FrameBuffer fb, java.nio.ByteBuffer byteBuf)
          Reads the pixels currently stored in the specified framebuffer into the given ByteBuffer object.
 void renderMesh(Mesh mesh, int lod, int count)
          Renders count meshes, with the geometry data supplied.
 void resetGLObjects()
          Resets all previously used Native Objects on this Renderer.
 void setAlphaToCoverage(boolean value)
          Sets the alpha to coverage state.
 void setBackgroundColor(ColorRGBA color)
          Sets the background (aka clear) color.
 void setClipRect(int x, int y, int width, int height)
          Specifies a clipping rectangle.
 void setDepthRange(float start, float end)
          Set the range of the depth values for objects.
 void setFrameBuffer(FrameBuffer fb)
          Sets the framebuffer that will be drawn to.
 void setLighting(LightList lights)
          Set lighting state.
 void setMainFrameBufferOverride(FrameBuffer fb)
          Set the framebuffer that will be set instead of the main framebuffer when a call to setFrameBuffer(null) is made.
 void setShader(Shader shader)
          Sets the shader to use for rendering.
 void setTexture(int unit, Texture tex)
          Sets the texture to use for the given texture unit.
 void setViewPort(int x, int y, int width, int height)
          Set the viewport location and resolution on the screen.
 void setViewProjectionMatrices(Matrix4f viewMatrix, Matrix4f projMatrix)
          Sets the view and projection matrices to use.
 void setWorldMatrix(Matrix4f worldMatrix)
          Set the world matrix to use.
 void updateBufferData(VertexBuffer vb)
          Uploads a vertex buffer to the GPU.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullRenderer

public NullRenderer()
Method Detail

getCaps

public java.util.EnumSet<Caps> getCaps()
Description copied from interface: Renderer
Get the capabilities of the renderer.

Specified by:
getCaps in interface Renderer
Returns:
The capabilities of the renderer.

getStatistics

public Statistics getStatistics()
Description copied from interface: Renderer
The statistics allow tracking of how data per frame, such as number of objects rendered, number of triangles, etc. These are updated when the Renderer's methods are used, make sure to call Statistics.clearFrame() at the appropriate time to get accurate info per frame.

Specified by:
getStatistics in interface Renderer

invalidateState

public void invalidateState()
Description copied from interface: Renderer
Invalidates the current rendering state. Should be called after the GL state was changed manually or through an external library.

Specified by:
invalidateState in interface Renderer

clearBuffers

public void clearBuffers(boolean color,
                         boolean depth,
                         boolean stencil)
Description copied from interface: Renderer
Clears certain channels of the currently bound framebuffer.

Specified by:
clearBuffers in interface Renderer
Parameters:
color - True if to clear colors (RGBA)
depth - True if to clear depth/z
stencil - True if to clear stencil buffer (if available, otherwise ignored)

setBackgroundColor

public void setBackgroundColor(ColorRGBA color)
Description copied from interface: Renderer
Sets the background (aka clear) color.

Specified by:
setBackgroundColor in interface Renderer
Parameters:
color - The background color to set

applyRenderState

public void applyRenderState(RenderState state)
Description copied from interface: Renderer
Applies the given RenderState, making the necessary GL calls so that the state is applied.

Specified by:
applyRenderState in interface Renderer

setDepthRange

public void setDepthRange(float start,
                          float end)
Description copied from interface: Renderer
Set the range of the depth values for objects. All rendered objects will have their depth clamped to this range.

Specified by:
setDepthRange in interface Renderer
Parameters:
start - The range start
end - The range end

onFrame

public void onFrame()
Description copied from interface: Renderer
Called when a new frame has been rendered.

Specified by:
onFrame in interface Renderer

setWorldMatrix

public void setWorldMatrix(Matrix4f worldMatrix)
Description copied from interface: Renderer
Set the world matrix to use. Does nothing if the Renderer is shader based.

Specified by:
setWorldMatrix in interface Renderer
Parameters:
worldMatrix - World matrix to use.

setViewProjectionMatrices

public void setViewProjectionMatrices(Matrix4f viewMatrix,
                                      Matrix4f projMatrix)
Description copied from interface: Renderer
Sets the view and projection matrices to use. Does nothing if the Renderer is shader based.

Specified by:
setViewProjectionMatrices in interface Renderer
Parameters:
viewMatrix - The view matrix to use.
projMatrix - The projection matrix to use.

setViewPort

public void setViewPort(int x,
                        int y,
                        int width,
                        int height)
Description copied from interface: Renderer
Set the viewport location and resolution on the screen.

Specified by:
setViewPort in interface Renderer
Parameters:
x - The x coordinate of the viewport
y - The y coordinate of the viewport
width - Width of the viewport
height - Height of the viewport

setClipRect

public void setClipRect(int x,
                        int y,
                        int width,
                        int height)
Description copied from interface: Renderer
Specifies a clipping rectangle. For all future rendering commands, no pixels will be allowed to be rendered outside of the clip rectangle.

Specified by:
setClipRect in interface Renderer
Parameters:
x - The x coordinate of the clip rect
y - The y coordinate of the clip rect
width - Width of the clip rect
height - Height of the clip rect

clearClipRect

public void clearClipRect()
Description copied from interface: Renderer
Clears the clipping rectangle set with Renderer.setClipRect(int, int, int, int).

Specified by:
clearClipRect in interface Renderer

setLighting

public void setLighting(LightList lights)
Description copied from interface: Renderer
Set lighting state. Does nothing if the renderer is shader based. The lights should be provided in world space. Specify null to disable lighting.

Specified by:
setLighting in interface Renderer
Parameters:
lights - The light list to set.

setShader

public void setShader(Shader shader)
Description copied from interface: Renderer
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.

Specified by:
setShader in interface Renderer
Parameters:
shader - The shader to use for rendering.

deleteShader

public void deleteShader(Shader shader)
Description copied from interface: Renderer
Deletes a shader. This method also deletes the attached shader sources.

Specified by:
deleteShader in interface Renderer
Parameters:
shader - Shader to delete.

deleteShaderSource

public void deleteShaderSource(Shader.ShaderSource source)
Description copied from interface: Renderer
Deletes the provided shader source.

Specified by:
deleteShaderSource in interface Renderer
Parameters:
source - The ShaderSource to delete.

copyFrameBuffer

public void copyFrameBuffer(FrameBuffer src,
                            FrameBuffer dst)
Description copied from interface: Renderer
Copies contents from src to dst, scaling if necessary.

Specified by:
copyFrameBuffer in interface Renderer

copyFrameBuffer

public void copyFrameBuffer(FrameBuffer src,
                            FrameBuffer dst,
                            boolean copyDepth)
Description copied from interface: Renderer
Copies contents from src to dst, scaling if necessary. set copyDepth to false to only copy the color buffers.

Specified by:
copyFrameBuffer in interface Renderer

setMainFrameBufferOverride

public void setMainFrameBufferOverride(FrameBuffer fb)
Description copied from interface: Renderer
Set the framebuffer that will be set instead of the main framebuffer when a call to setFrameBuffer(null) is made.

Specified by:
setMainFrameBufferOverride in interface Renderer

setFrameBuffer

public void setFrameBuffer(FrameBuffer fb)
Description copied from interface: Renderer
Sets the framebuffer that will be drawn to.

Specified by:
setFrameBuffer in interface Renderer

readFrameBuffer

public void readFrameBuffer(FrameBuffer fb,
                            java.nio.ByteBuffer byteBuf)
Description copied from interface: Renderer
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.

Specified by:
readFrameBuffer in interface Renderer
Parameters:
fb - The framebuffer to read from
byteBuf - The bytebuffer to transfer color data to

deleteFrameBuffer

public void deleteFrameBuffer(FrameBuffer fb)
Description copied from interface: Renderer
Deletes a framebuffer and all attached renderbuffers

Specified by:
deleteFrameBuffer in interface Renderer

setTexture

public void setTexture(int unit,
                       Texture tex)
Description copied from interface: Renderer
Sets the texture to use for the given texture unit.

Specified by:
setTexture in interface Renderer

updateBufferData

public void updateBufferData(VertexBuffer vb)
Description copied from interface: Renderer
Uploads a vertex buffer to the GPU.

Specified by:
updateBufferData in interface Renderer
Parameters:
vb - The vertex buffer to upload

deleteBuffer

public void deleteBuffer(VertexBuffer vb)
Description copied from interface: Renderer
Deletes a vertex buffer from the GPU.

Specified by:
deleteBuffer in interface Renderer
Parameters:
vb - The vertex buffer to delete

renderMesh

public void renderMesh(Mesh mesh,
                       int lod,
                       int count)
Description copied from interface: Renderer
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.

Specified by:
renderMesh in interface Renderer
Parameters:
mesh - The mesh to render
lod - The LOD level to use, see Mesh.setLodLevels(com.jme3.scene.VertexBuffer[]).
count - Number of mesh instances to render

resetGLObjects

public void resetGLObjects()
Description copied from interface: Renderer
Resets all previously used Native Objects on this Renderer. The state of the native objects 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.

Specified by:
resetGLObjects in interface Renderer
See Also:
NativeObject.resetObject()

cleanup

public void cleanup()
Description copied from interface: Renderer
Deletes all previously used Native Objects on this Renderer, and then resets the native objects.

Specified by:
cleanup in interface Renderer
See Also:
Renderer.resetGLObjects(), NativeObject#deleteObject(com.jme3.renderer.Renderer)

deleteImage

public void deleteImage(Image image)
Description copied from interface: Renderer
Deletes a texture from the GPU.

Specified by:
deleteImage in interface Renderer

setAlphaToCoverage

public void setAlphaToCoverage(boolean value)
Description copied from interface: Renderer
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.

Specified by:
setAlphaToCoverage in interface Renderer