|
|
@ -62,6 +62,9 @@ public interface Renderer { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* The statistics allow tracking of how data |
|
|
|
* The statistics allow tracking of how data |
|
|
|
* per frame, such as number of objects rendered, number of triangles, etc. |
|
|
|
* 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 {@link Statistics#clearFrame() } at the appropriate time |
|
|
|
|
|
|
|
* to get accurate info per frame. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Statistics getStatistics(); |
|
|
|
public Statistics getStatistics(); |
|
|
|
|
|
|
|
|
|
|
@ -72,7 +75,7 @@ public interface Renderer { |
|
|
|
public void invalidateState(); |
|
|
|
public void invalidateState(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Clears certain channels of the current bound framebuffer. |
|
|
|
* Clears certain channels of the currently bound framebuffer. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param color True if to clear colors (RGBA) |
|
|
|
* @param color True if to clear colors (RGBA) |
|
|
|
* @param depth True if to clear depth/z |
|
|
|
* @param depth True if to clear depth/z |
|
|
@ -83,20 +86,23 @@ public interface Renderer { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Sets the background (aka clear) color. |
|
|
|
* Sets the background (aka clear) color. |
|
|
|
* @param color |
|
|
|
* |
|
|
|
|
|
|
|
* @param color The background color to set |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setBackgroundColor(ColorRGBA color); |
|
|
|
public void setBackgroundColor(ColorRGBA color); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Applies the given renderstate, making the neccessary |
|
|
|
* Applies the given {@link RenderState}, making the necessary |
|
|
|
* GL calls so that the state is applied. |
|
|
|
* GL calls so that the state is applied. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void applyRenderState(RenderState state); |
|
|
|
public void applyRenderState(RenderState state); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the range of the depth values for objects. |
|
|
|
* Set the range of the depth values for objects. All rendered |
|
|
|
* @param start |
|
|
|
* objects will have their depth clamped to this range. |
|
|
|
* @param end |
|
|
|
* |
|
|
|
|
|
|
|
* @param start The range start |
|
|
|
|
|
|
|
* @param end The range end |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setDepthRange(float start, float end); |
|
|
|
public void setDepthRange(float start, float end); |
|
|
|
|
|
|
|
|
|
|
@ -106,47 +112,93 @@ public interface Renderer { |
|
|
|
public void onFrame(); |
|
|
|
public void onFrame(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param worldMatrix The world transform to use. This changes |
|
|
|
* Set the world matrix to use. Does nothing if the Renderer is |
|
|
|
* the world matrix given in the shader. |
|
|
|
* shader based. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param worldMatrix World matrix to use. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setWorldMatrix(Matrix4f worldMatrix); |
|
|
|
public void setWorldMatrix(Matrix4f worldMatrix); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Sets the view and projection matrices to use. Does nothing if the Renderer |
|
|
|
|
|
|
|
* is shader based. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param viewMatrix The view matrix to use. |
|
|
|
|
|
|
|
* @param projMatrix The projection matrix to use. |
|
|
|
|
|
|
|
*/ |
|
|
|
public void setViewProjectionMatrices(Matrix4f viewMatrix, Matrix4f projMatrix); |
|
|
|
public void setViewProjectionMatrices(Matrix4f viewMatrix, Matrix4f projMatrix); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set the viewport location and resolution on the screen. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param x The x coordinate of the viewport |
|
|
|
|
|
|
|
* @param y The y coordinate of the viewport |
|
|
|
|
|
|
|
* @param width Width of the viewport |
|
|
|
|
|
|
|
* @param height Height of the viewport |
|
|
|
|
|
|
|
*/ |
|
|
|
public void setViewPort(int x, int y, int width, int height); |
|
|
|
public void setViewPort(int x, int y, int width, int height); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Specifies a clipping rectangle. |
|
|
|
|
|
|
|
* For all future rendering commands, no pixels will be allowed |
|
|
|
|
|
|
|
* to be rendered outside of the clip rectangle. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param x The x coordinate of the clip rect |
|
|
|
|
|
|
|
* @param y The y coordinate of the clip rect |
|
|
|
|
|
|
|
* @param width Width of the clip rect |
|
|
|
|
|
|
|
* @param height Height of the clip rect |
|
|
|
|
|
|
|
*/ |
|
|
|
public void setClipRect(int x, int y, int width, int height); |
|
|
|
public void setClipRect(int x, int y, int width, int height); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Clears the clipping rectangle set with |
|
|
|
|
|
|
|
* {@link #setClipRect(int, int, int, int) }. |
|
|
|
|
|
|
|
*/ |
|
|
|
public void clearClipRect(); |
|
|
|
public void clearClipRect(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set lighting state. |
|
|
|
|
|
|
|
* Does nothing if the renderer is shader based. |
|
|
|
|
|
|
|
* The lights should be provided in world space. |
|
|
|
|
|
|
|
* Specify <code>null</code> to disable lighting. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param lights The light list to set. |
|
|
|
|
|
|
|
*/ |
|
|
|
public void setLighting(LightList lights); |
|
|
|
public void setLighting(LightList lights); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param shader Sets the shader to use for rendering, uploading it |
|
|
|
* Sets the shader to use for rendering. |
|
|
|
* if neccessary. |
|
|
|
* 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); |
|
|
|
public void setShader(Shader shader); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param shader The shader to delete. This method also deletes |
|
|
|
* Deletes a shader. This method also deletes |
|
|
|
* the attached shader sources. |
|
|
|
* the attached shader sources. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param shader Shader to delete. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void deleteShader(Shader shader); |
|
|
|
public void deleteShader(Shader shader); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Deletes the provided shader source. |
|
|
|
* Deletes the provided shader source. |
|
|
|
* @param source |
|
|
|
* |
|
|
|
|
|
|
|
* @param source The ShaderSource to delete. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void deleteShaderSource(ShaderSource source); |
|
|
|
public void deleteShaderSource(ShaderSource source); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Copies contents from src to dst, scaling if neccessary. |
|
|
|
* Copies contents from src to dst, scaling if necessary. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst); |
|
|
|
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Copies contents from src to dst, scaling if neccessary. |
|
|
|
* Copies contents from src to dst, scaling if necessary. |
|
|
|
* set copyDepth to false ton ly copy the color |
|
|
|
* set copyDepth to false to only copy the color buffers. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst, boolean copyDepth); |
|
|
|
public void copyFrameBuffer(FrameBuffer src, FrameBuffer dst, boolean copyDepth); |
|
|
|
|
|
|
|
|
|
|
@ -161,8 +213,9 @@ public interface Renderer { |
|
|
|
* Only color pixels are transferred, the format is BGRA with 8 bits |
|
|
|
* Only color pixels are transferred, the format is BGRA with 8 bits |
|
|
|
* per component. The given byte buffer should have at least |
|
|
|
* per component. The given byte buffer should have at least |
|
|
|
* fb.getWidth() * fb.getHeight() * 4 bytes remaining. |
|
|
|
* fb.getWidth() * fb.getHeight() * 4 bytes remaining. |
|
|
|
* @param fb |
|
|
|
* |
|
|
|
* @param byteBuf |
|
|
|
* @param fb The framebuffer to read from |
|
|
|
|
|
|
|
* @param byteBuf The bytebuffer to transfer color data to |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void readFrameBuffer(FrameBuffer fb, ByteBuffer byteBuf); |
|
|
|
public void readFrameBuffer(FrameBuffer fb, ByteBuffer byteBuf); |
|
|
|
|
|
|
|
|
|
|
@ -202,25 +255,43 @@ public interface Renderer { |
|
|
|
* The int variable gl_InstanceID can be used to access the current |
|
|
|
* The int variable gl_InstanceID can be used to access the current |
|
|
|
* instance of the mesh being rendered inside the vertex shader. |
|
|
|
* instance of the mesh being rendered inside the vertex shader. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param mesh |
|
|
|
* @param mesh The mesh to render |
|
|
|
* @param count |
|
|
|
* @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); |
|
|
|
public void renderMesh(Mesh mesh, int lod, int count); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Called on restart() to reset all GL objects |
|
|
|
* 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(); |
|
|
|
public void resetGLObjects(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Called when the display is restarted to delete |
|
|
|
* Deletes all previously used {@link GLObject}s on this Renderer, and |
|
|
|
* all created GL objects. |
|
|
|
* then resets the GLObjects. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @see #resetGLObjects() |
|
|
|
|
|
|
|
* @see GLObject#deleteObject(com.jme3.renderer.Renderer) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void cleanup(); |
|
|
|
public void cleanup(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* sets alpha to coverage |
|
|
|
* Sets the alpha to coverage state. |
|
|
|
* @param value |
|
|
|
* <p> |
|
|
|
|
|
|
|
* 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. |
|
|
|
|
|
|
|
* </p> |
|
|
|
|
|
|
|
* <p> |
|
|
|
|
|
|
|
* Alpha-to-coverage is useful for rendering transparent objects |
|
|
|
|
|
|
|
* without having to worry about sorting them. |
|
|
|
|
|
|
|
* </p> |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setAlphaToCoverage(boolean value); |
|
|
|
public void setAlphaToCoverage(boolean value); |
|
|
|
} |
|
|
|
} |
|
|
|