Package com.ardor3d.renderer
Interface TextureRenderer
- All Known Implementing Classes:
AbstractFBOTextureRenderer
,AbstractPbufferTextureRenderer
,JoglPbufferTextureRenderer
,JoglTextureRenderer
public interface TextureRenderer
TextureRenderer
defines an abstract class that handles rendering a scene to a buffer and copying it to a
texture. Creation of this object is usually handled via a TextureRendererFactory. Note that currently, only Texture2D
is supported by Pbuffer versions of this class. Texture2D and TextureCubeMap are supported in FBO mode.-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Any wrapping up and cleaning up of TextureRenderer information is performed here.void
void
Clear all enforced states on this texture renderer.void
copyToTexture
(Texture tex, int x, int y, int width, int height, int xoffset, int yoffset) copyToTexture
copies the current frame buffer contents to the given Texture.void
enforceState
(RenderState state) Enforce a particular state whenever this texture renderer is used.void
getBackgroundColor
retrieves the color used for the window background.getCamera
retrieves the camera this renderer is using.int
int
getWidth()
void
void
NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.void
void
NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.void
NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.void
NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.void
setBackgroundColor
sets the color of window.void
setMultipleTargets
(boolean multi) Set up this textureRenderer for use with multiple targets.void
setupTexture
(Texture tex) setupTexture
initializes a Texture object for use with TextureRenderer.
-
Method Details
-
getCamera
Camera getCamera()getCamera
retrieves the camera this renderer is using.- Returns:
- the camera this renderer is using.
-
render
- Parameters:
scene
- the scene to render.tex
- the Texture to render to. This should be a Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.clear
- which buffers to clear before rendering, if any.- See Also:
-
render
NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.- Parameters:
scene
- the scene to render.texs
- a list of Textures to render to. These should be of type Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.clear
- which buffers to clear before rendering, if any.- See Also:
-
render
- Parameters:
spat
- the scene to render.tex
- the Texture to render to. This should be a Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.clear
- which buffers to clear before rendering, if any.- See Also:
-
render
NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.- Parameters:
spat
- the scene to render.texs
- a list of Textures to render to. These should be of type Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.clear
- which buffers to clear before rendering, if any.- See Also:
-
render
NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.- Parameters:
spats
- an array of Spatials to render.tex
- the Texture to render to. This should be a Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.clear
- which buffers to clear before rendering, if any.- See Also:
-
render
NOTE: If more than one texture is given, copy-texture is used regardless of card capabilities to decrease render time.- Parameters:
spats
- an array of Spatials to render.texs
- a list of Textures to render to. These should be of type Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.clear
- which buffers to clear before rendering, if any.- See Also:
-
setBackgroundColor
setBackgroundColor
sets the color of window. This color will be shown for any pixel that is not set via typical rendering operations.- Parameters:
c
- the color to set the background to.
-
getBackgroundColor
ReadOnlyColorRGBA getBackgroundColor()getBackgroundColor
retrieves the color used for the window background.- Returns:
- the background color that is currently set to the background.
-
setupTexture
setupTexture
initializes a Texture object for use with TextureRenderer. Generates a valid gl texture id for this texture and sets up data storage for it. The texture will be equal to the texture renderer's size. Note that the texture renderer's size is not necessarily what is specified in the constructor.- Parameters:
tex
- The texture to setup for use in Texture Rendering. This should be of type Texture2D or TextureCubeMap.
-
copyToTexture
copyToTexture
copies the current frame buffer contents to the given Texture. What is copied is based on the rttFormat of the texture object when it was setup. Note that the contents are copied with no scaling applied, so the texture must be big enough such that xoffset + width <= texture's width and yoffset + height <= texture's height.- Parameters:
tex
- The Texture to copy into. This should be a Texture2D or TextureCubeMap. If the latter, its currentRTTFace will determine which cube face is drawn to.x
- the x offset into the framebuffery
- the y offset into the framebufferwidth
- the width of the rectangle to read from the framebuffer and copy 1:1 to the textureheight
- the width of the rectangle to read from the framebuffer and copy 1:1 to the texturexoffset
- the x offset into the texture to draw atyoffset
- the y offset into the texture to draw at
-
cleanup
void cleanup()Any wrapping up and cleaning up of TextureRenderer information is performed here. -
setMultipleTargets
void setMultipleTargets(boolean multi) Set up this textureRenderer for use with multiple targets. If you are going to use this texture renderer to render to more than one texture, call this with true.- Parameters:
multi
- true if you plan to use this texture renderer to render different content to more than one texture.
-
getWidth
int getWidth() -
getHeight
int getHeight() -
enforceState
Enforce a particular state whenever this texture renderer is used. In other words, the given state will override any state of the same type set on a scene object rendered with this texture renderer.- Parameters:
state
- state to enforce
-
enforceStates
-
clearEnforcedState
- Parameters:
type
- state type to clear
-
clearEnforcedStates
void clearEnforcedStates()Clear all enforced states on this texture renderer.
-