|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Renderer
The Renderer
is responsible for taking rendering commands and
executing them on the underlying video hardware.
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 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. |
Method Detail |
---|
java.util.EnumSet<Caps> getCaps()
Statistics getStatistics()
Statistics.clearFrame()
at the appropriate time
to get accurate info per frame.
void invalidateState()
void clearBuffers(boolean color, boolean depth, boolean stencil)
color
- True if to clear colors (RGBA)depth
- True if to clear depth/zstencil
- True if to clear stencil buffer (if available, otherwise
ignored)void setBackgroundColor(ColorRGBA color)
color
- The background color to setvoid applyRenderState(RenderState state)
RenderState
, making the necessary
GL calls so that the state is applied.
void setDepthRange(float start, float end)
start
- The range startend
- The range endvoid onFrame()
void setWorldMatrix(Matrix4f worldMatrix)
worldMatrix
- World matrix to use.void setViewProjectionMatrices(Matrix4f viewMatrix, Matrix4f projMatrix)
viewMatrix
- The view matrix to use.projMatrix
- The projection matrix to use.void setViewPort(int x, int y, int width, int height)
x
- The x coordinate of the viewporty
- The y coordinate of the viewportwidth
- Width of the viewportheight
- Height of the viewportvoid setClipRect(int x, int y, int width, int height)
x
- The x coordinate of the clip recty
- The y coordinate of the clip rectwidth
- Width of the clip rectheight
- Height of the clip rectvoid clearClipRect()
setClipRect(int, int, int, int)
.
void setLighting(LightList lights)
null
to disable lighting.
lights
- The light list to set.void setShader(Shader shader)
shader
- The shader to use for rendering.void deleteShader(Shader shader)
shader
- Shader to delete.void deleteShaderSource(Shader.ShaderSource source)
source
- The ShaderSource to delete.void copyFrameBuffer(FrameBuffer src, FrameBuffer dst)
void copyFrameBuffer(FrameBuffer src, FrameBuffer dst, boolean copyDepth)
void setFrameBuffer(FrameBuffer fb)
void setMainFrameBufferOverride(FrameBuffer fb)
fb
- void readFrameBuffer(FrameBuffer fb, java.nio.ByteBuffer byteBuf)
fb
- The framebuffer to read frombyteBuf
- The bytebuffer to transfer color data tovoid deleteFrameBuffer(FrameBuffer fb)
void setTexture(int unit, Texture tex)
void deleteImage(Image image)
void updateBufferData(VertexBuffer vb)
vb
- The vertex buffer to uploadvoid deleteBuffer(VertexBuffer vb)
vb
- The vertex buffer to deletevoid renderMesh(Mesh mesh, int lod, int count)
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.
mesh
- The mesh to renderlod
- The LOD level to use, see Mesh.setLodLevels(com.jme3.scene.VertexBuffer[])
.count
- Number of mesh instances to rendervoid resetGLObjects()
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.
NativeObject.resetObject()
void cleanup()
Native Objects
on this Renderer, and
then resets the native objects.
resetGLObjects()
,
NativeObject#deleteObject(com.jme3.renderer.Renderer)
void setAlphaToCoverage(boolean value)
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |