Class RenderManager
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionRenderManager(Renderer renderer) Creates a high-level rendering interface over the low-level rendering interface.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddForcedMatParam(MatParamOverride override) Adds a forced material parameter to use when rendering geometries.voidApplies the ViewPort's Camera and FrameBuffer in preparation for rendering.voidclearQueue(ViewPort vp) Clears the queue of the given ViewPort.createMainView(String viewName, Camera cam) Creates a new main ViewPort, to display the given camera's content.createPostView(String viewName, Camera cam) Creates a new post ViewPort, to display the given camera's content.createPreView(String viewName, Camera cam) Creates a new pre ViewPort, to display the given camera's content.voidflushQueue(ViewPort vp) Flushes the ViewPort'srender queueby rendering each of its visible buckets.<T extends PipelineContext>
 TgetContext(Class<T> type) Gets the pipeline context registered under the class.Returns the camera currently used for rendering.Gets the default pipeline context registered under.invalid referencePipelineContext#getClass()Gets the forced material.Gets the forced material parameters applied to rendered geometries.Returns the forced render state previously set withsetForcedRenderState(com.jme3.material.RenderState).Returns the forced technique name set.Returns the current LightFilter.getMainView(String viewName) Returns the main ViewPort with the given name.Returns a read-only list of all main ViewPorts.<T extends PipelineContext>
 TgetOrCreateContext(Class<T> type, Function<RenderManager, T> function) Gets the pipeline context registered under the class or creates and registers a new context from the function.<T extends PipelineContext>
 TgetOrCreateContext(Class<T> type, Supplier<T> supplier) Gets the pipeline context registered under the class or creates and registers a new context from the supplier.booleanReturns true if the draw buffer target id is passed to the shader.Gets the default pipeline used when a ViewPort does not have a pipeline already assigned to it.getPostView(String viewName) Returns the post ViewPort with the given name.Returns a read-only list of all post ViewPorts.Returns the preferred light mode.getPreView(String viewName) Returns the pre ViewPort with the given name.Returns a read-only list of all pre ViewPorts.Gets the application profiler.The renderer implementation used for rendering operations.Returns the render filter that the RenderManager is currently usingintReturns the number of lights used for each pass when the light mode is single pass.booleanTrue if the translucent bucket should automatically be rendered by the RenderManager.voidnotifyRescale(float x, float y) Internal use only.voidnotifyReshape(int w, int h) Internal use only.voidpreloadScene(Spatial scene) Preloads a scene for rendering.<T extends PipelineContext>
 voidregisterContext(Class<T> type, T context) Registers the pipeline context under the class.voidremoveForcedMatParam(MatParamOverride override) Removes a forced material parameter previously added.booleanremoveMainView(ViewPort view) Removes the specified main ViewPort.booleanremoveMainView(String viewName) Removes the main ViewPort with the specified name.booleanremovePostView(ViewPort view) Removes the specified post ViewPort.booleanremovePostView(String viewName) Removes the post ViewPort with the specified name.booleanremovePreView(ViewPort view) Removes the specified pre ViewPort.booleanremovePreView(String viewName) Removes the pre ViewPort with the specified name.voidrender(float tpf, boolean mainFrameBufferActive) Called by the application to render any ViewPorts added to this RenderManager.voidrenderGeometry(Geometry geom) Renders the given geometry.voidrenderGeometry(Geometry geom, LightList lightList) voidRenders the given GeometryList.voidrenderScene(Spatial scene, ViewPort vp) Flattens the given scene graph into the ViewPort's RenderQueue, checking for culling as the call goes down the graph recursively.voidRenders thetranslucent queueon the viewPort.voidrenderViewPort(ViewPort vp, float tpf) Renders theViewPortusing the ViewPort'sRenderPipeline.voidrenderViewPortQueues(ViewPort vp, boolean flush) Renders the given viewport queues.voidDraws the viewport but without notifyingscene processorsof any rendering events.voidsetAlphaToCoverage(boolean value) Enables or disables alpha-to-coverage.voidsetAppProfiler(AppProfiler prof) Sets an AppProfiler hook that will be called back for specific steps within a single update frame.voidSets the camera to use for rendering.voidSets the material to use to render all future objects.voidsetForcedRenderState(RenderState forcedRenderState) Sets the render state to use for all future objects.voidsetForcedTechnique(String forcedTechnique) Sets the forced technique to use when rendering geometries.voidsetHandleTranslucentBucket(boolean handleTranslucentBucket) Enables or disables rendering of thetranslucent bucketby the RenderManager.voidsetLightFilter(LightFilter lightFilter) Sets the light filter to use when rendering lit Geometries.voidsetPassDrawBufferTargetIdToShaders(boolean v) Enable or disable passing the draw buffer target id to the shaders.voidsetPipeline(RenderPipeline pipeline) Sets the default pipeline used when a ViewPort does not have a pipeline already assigned to it.voidsetPreferredLightMode(TechniqueDef.LightMode preferredLightMode) Defines what light mode will be selected when a technique offers several light modes.voidsetRenderFilter(Predicate<Geometry> filter) Set a render filter.voidsetSinglePassLightBatchSize(int singlePassLightBatchSize) Sets the number of lights to use for each pass when the light mode is single pass.voidSets the timer that should be used to query the time basedUniformBindings for material world parameters.voidsetWorldMatrix(Matrix4f mat) Internal use only.voidupdateUniformBindings(Shader shader) Internal use only.
- 
Constructor Details- 
RenderManagerCreates a high-level rendering interface over the low-level rendering interface.- Parameters:
- renderer- (alias created)
 
 
- 
- 
Method Details- 
getPipelineGets the default pipeline used when a ViewPort does not have a pipeline already assigned to it.- Returns:
 
- 
setPipelineSets the default pipeline used when a ViewPort does not have a pipeline already assigned to it.default= ForwardPipeline- Parameters:
- pipeline- default pipeline (not null)
 
- 
getDefaultContextGets the default pipeline context registered under.invalid referencePipelineContext#getClass()- Returns:
 
- 
getContextGets the pipeline context registered under the class.- Type Parameters:
- T-
- Parameters:
- type-
- Returns:
- registered context or null
 
- 
getOrCreateContextGets the pipeline context registered under the class or creates and registers a new context from the supplier.- Type Parameters:
- T-
- Parameters:
- type-
- supplier- interface for creating a new context if necessary
- Returns:
- registered or newly created context
 
- 
getOrCreateContextpublic <T extends PipelineContext> T getOrCreateContext(Class<T> type, Function<RenderManager, T> function) Gets the pipeline context registered under the class or creates and registers a new context from the function.- Type Parameters:
- T-
- Parameters:
- type-
- function- interface for creating a new context if necessary
- Returns:
- registered or newly created context
 
- 
registerContextRegisters the pipeline context under the class.If another context is already registered under the class, that context will be replaced by the given context. - Type Parameters:
- T-
- Parameters:
- type- class type to register the context under (not null)
- context- context to register (not null)
 
- 
getProfilerGets the application profiler.- Returns:
 
- 
getPreViewReturns the pre ViewPort with the given name.- Parameters:
- viewName- The name of the pre ViewPort to look up
- Returns:
- The ViewPort, or null if not found.
- See Also:
 
- 
removePreViewRemoves the pre ViewPort with the specified name.- Parameters:
- viewName- The name of the pre ViewPort to remove
- Returns:
- True if the ViewPort was removed successfully.
- See Also:
 
- 
removePreViewRemoves the specified pre ViewPort.- Parameters:
- view- The pre ViewPort to remove
- Returns:
- True if the ViewPort was removed successfully.
- See Also:
 
- 
getMainViewReturns the main ViewPort with the given name.- Parameters:
- viewName- The name of the main ViewPort to look up
- Returns:
- The ViewPort, or null if not found.
- See Also:
 
- 
removeMainViewRemoves the main ViewPort with the specified name.- Parameters:
- viewName- The main ViewPort name to remove
- Returns:
- True if the ViewPort was removed successfully.
- See Also:
 
- 
removeMainViewRemoves the specified main ViewPort.- Parameters:
- view- The main ViewPort to remove
- Returns:
- True if the ViewPort was removed successfully.
- See Also:
 
- 
getPostViewReturns the post ViewPort with the given name.- Parameters:
- viewName- The name of the post ViewPort to look up
- Returns:
- The ViewPort, or null if not found.
- See Also:
 
- 
removePostViewRemoves the post ViewPort with the specified name.- Parameters:
- viewName- The post ViewPort name to remove
- Returns:
- True if the ViewPort was removed successfully.
- See Also:
 
- 
removePostViewRemoves the specified post ViewPort.- Parameters:
- view- The post ViewPort to remove
- Returns:
- True if the ViewPort was removed successfully.
- See Also:
 
- 
getPreViewsReturns a read-only list of all pre ViewPorts.- Returns:
- a read-only list of all pre ViewPorts
- See Also:
 
- 
getMainViewsReturns a read-only list of all main ViewPorts.- Returns:
- a read-only list of all main ViewPorts
- See Also:
 
- 
getPostViewsReturns a read-only list of all post ViewPorts.- Returns:
- a read-only list of all post ViewPorts
- See Also:
 
- 
createPreViewCreates a new pre ViewPort, to display the given camera's content.The view will be processed before the main and post viewports. - Parameters:
- viewName- the desired viewport name
- cam- the Camera to use for rendering (alias created)
- Returns:
- a new instance
 
- 
createMainViewCreates a new main ViewPort, to display the given camera's content.The view will be processed before the post viewports but after the pre viewports. - Parameters:
- viewName- the desired viewport name
- cam- the Camera to use for rendering (alias created)
- Returns:
- a new instance
 
- 
createPostViewCreates a new post ViewPort, to display the given camera's content.The view will be processed after the pre and main viewports. - Parameters:
- viewName- the desired viewport name
- cam- the Camera to use for rendering (alias created)
- Returns:
- a new instance
 
- 
notifyReshapepublic void notifyReshape(int w, int h) Internal use only. Updates the resolution of all on-screen cameras to match the given width and height.- Parameters:
- w- the new width (in pixels)
- h- the new height (in pixels)
 
- 
notifyRescalepublic void notifyRescale(float x, float y) Internal use only. Updates the scale of all on-screen ViewPorts- Parameters:
- x- the new horizontal scale
- y- the new vertical scale
 
- 
setForcedMaterialSets the material to use to render all future objects. This overrides the material set on the geometry and renders with the provided material instead. Use null to clear the material and return renderer to normal functionality.- Parameters:
- mat- The forced material to set, or null to return to normal
 
- 
getForcedMaterialGets the forced material.- Returns:
 
- 
getForcedRenderStateReturns the forced render state previously set withsetForcedRenderState(com.jme3.material.RenderState).- Returns:
- the forced render state
 
- 
setForcedRenderStateSets the render state to use for all future objects. This overrides the render state set on the material and instead forces this render state to be applied for all future materials rendered. Set to null to return to normal functionality.- Parameters:
- forcedRenderState- The forced render state to set, or null to return to normal
 
- 
setTimerSets the timer that should be used to query the time basedUniformBindings for material world parameters.- Parameters:
- timer- The timer to query time world parameters
 
- 
setAppProfilerSets an AppProfiler hook that will be called back for specific steps within a single update frame. Value defaults to null.- Parameters:
- prof- the AppProfiler to use (alias created, default=null)
 
- 
getForcedTechniqueReturns the forced technique name set.- Returns:
- the forced technique name set.
- See Also:
 
- 
setForcedTechniqueSets the forced technique to use when rendering geometries.If the specified technique name is available on the geometry's material, then it is used, otherwise, the forced materialis used. If a forced material is not set and the forced technique name cannot be found on the material, the geometry will not be rendered.- Parameters:
- forcedTechnique- The forced technique name to use, set to null to return to normal functionality.
- See Also:
 
- 
addForcedMatParamAdds a forced material parameter to use when rendering geometries.The provided parameter takes precedence over parameters set on the material or any overrides that exist in the scene graph that have the same name. - Parameters:
- override- The override to add
- See Also:
 
- 
removeForcedMatParamRemoves a forced material parameter previously added.- Parameters:
- override- The override to remove.
- See Also:
 
- 
getForcedMatParamsGets the forced material parameters applied to rendered geometries.Forced parameters can be added via addForcedMatParam(com.jme3.material.MatParamOverride)or removed viaremoveForcedMatParam(com.jme3.material.MatParamOverride).- Returns:
- The forced material parameters.
 
- 
setAlphaToCoveragepublic void setAlphaToCoverage(boolean value) Enables or disables alpha-to-coverage.When alpha to coverage is enabled and the renderer implementation supports it, then alpha blending will be replaced with alpha dissolve if multi-sampling is also set on the renderer. This feature allows avoiding of alpha blending artifacts due to lack of triangle-level back-to-front sorting. - Parameters:
- value- True to enable alpha-to-coverage, false otherwise.
 
- 
isHandleTranslucentBucketpublic boolean isHandleTranslucentBucket()True if the translucent bucket should automatically be rendered by the RenderManager.- Returns:
- true if the translucent bucket is rendered
- See Also:
 
- 
setHandleTranslucentBucketpublic void setHandleTranslucentBucket(boolean handleTranslucentBucket) Enables or disables rendering of thetranslucent bucketby the RenderManager. The default is enabled.- Parameters:
- handleTranslucentBucket- true to render the translucent bucket
 
- 
setWorldMatrixInternal use only. Sets the world matrix to use for future rendering. This has no effect unless objects are rendered manually usingMaterial.render(com.jme3.scene.Geometry, com.jme3.renderer.RenderManager). UsingrenderGeometry(com.jme3.scene.Geometry)will override this value.- Parameters:
- mat- The world matrix to set
 
- 
updateUniformBindingsInternal use only. Updates the given list of uniforms withuniform bindingsbased on the current world state.- Parameters:
- shader- (not null)
 
- 
renderGeometryRenders the given geometry.First the proper world matrix is set, if the geometry's ignore transformfeature is enabled, the identity world matrix is used, otherwise, the geometry'sworld transform matrixis used.Once the world matrix is applied, the proper material is chosen for rendering. If a forced materialis set on this RenderManager, then it is used for rendering the geometry, otherwise, thegeometry's materialis used.If a forced techniqueis set on this RenderManager, then it is selected automatically on the geometry's material and is used for rendering. Otherwise, one of thedefault techniquesis used.If a forced render stateis set on this RenderManager, then it is used for rendering the material, and the material's own render state is ignored. Otherwise, the material's render state is used as intended.- Parameters:
- geom- The geometry to render
- See Also:
 
- 
renderGeometry- Parameters:
- geom-
- lightList-
 
- 
renderGeometryListRenders the given GeometryList.For every geometry in the list, the renderGeometry(com.jme3.scene.Geometry)method is called.- Parameters:
- gl- The geometry list to render.
- See Also:
 
- 
preloadScenePreloads a scene for rendering.After invocation of this method, the underlying renderer would have uploaded any textures, shaders and meshes used by the given scene to the video driver. Using this method is useful when wishing to avoid the initial pause when rendering a scene for the first time. Note that it is not guaranteed that the underlying renderer will actually choose to upload the data to the GPU so some pause is still to be expected. - Parameters:
- scene- The scene to preload
 
- 
renderSceneFlattens the given scene graph into the ViewPort's RenderQueue, checking for culling as the call goes down the graph recursively.First, the scene is checked for culling based on the Spatialscull hint, if the camera frustum contains the scene, then this method is recursively called on its children.When the scene's leaves or geometriesare reached, they are each enqueued into theViewPort's render queue.In addition to enqueuing the visible geometries, this method also scenes which cast or receive shadows, by putting them into the RenderQueue's shadow queue. Each Spatial which has itsshadow modeset to not off, will be put into the appropriate shadow queue, note that this process does not check for frustum culling on anyshadow casters, as they don't have to be in the eye camera frustum to cast shadows on objects that are inside it.
- 
getCurrentCameraReturns the camera currently used for rendering.The camera can be set with setCamera(com.jme3.renderer.Camera, boolean).- Returns:
- the camera currently used for rendering.
 
- 
getRendererThe renderer implementation used for rendering operations.- Returns:
- The renderer implementation
- See Also:
 
- 
flushQueueFlushes the ViewPort'srender queueby rendering each of its visible buckets. By default, the queues will be cleared automatically after rendering, so there's no need to clear them manually.- Parameters:
- vp- The ViewPort of which the queue will be flushed
- See Also:
 
- 
clearQueueClears the queue of the given ViewPort. Simply callsRenderQueue.clear()on the ViewPort'srender queue.- Parameters:
- vp- The ViewPort of which the queue will be cleared.
- See Also:
 
- 
setLightFilterSets the light filter to use when rendering lit Geometries.- Parameters:
- lightFilter- The light filter. Set it to null if you want all lights to be rendered.
- See Also:
 
- 
getLightFilterReturns the current LightFilter.- Returns:
- the current light filter
 
- 
setPreferredLightModeDefines what light mode will be selected when a technique offers several light modes.- Parameters:
- preferredLightMode- The light mode to use.
 
- 
getPreferredLightModeReturns the preferred light mode.- Returns:
- the light mode.
 
- 
getSinglePassLightBatchSizepublic int getSinglePassLightBatchSize()Returns the number of lights used for each pass when the light mode is single pass.- Returns:
- the number of lights.
 
- 
setSinglePassLightBatchSizepublic void setSinglePassLightBatchSize(int singlePassLightBatchSize) Sets the number of lights to use for each pass when the light mode is single pass.- Parameters:
- singlePassLightBatchSize- the number of lights.
 
- 
renderViewPortQueuesRenders the given viewport queues.Changes the depth rangeappropriately as expected by each queue and then callsRenderQueue.renderQueue(com.jme3.renderer.queue.RenderQueue.Bucket, com.jme3.renderer.RenderManager, com.jme3.renderer.Camera, boolean)on the queue. Makes sure to restore the depth range to [0, 1] at the end of the call. Note that thetranslucent bucketis NOT rendered by this method. Instead, the user should callrenderTranslucentQueue(com.jme3.renderer.ViewPort)after this call.- Parameters:
- vp- the viewport of which queue should be rendered
- flush- If true, the queues will be cleared after rendering.
- See Also:
 
- 
renderTranslucentQueueRenders thetranslucent queueon the viewPort.This call does nothing unless setHandleTranslucentBucket(boolean)is set to true. This method clears the translucent queue after rendering it.- Parameters:
- vp- The viewport of which the translucent queue should be rendered.
- See Also:
 
- 
setCameraSets the camera to use for rendering.First, the camera's view port parametersare applied. Then, the camera'sviewandprojectionmatrices are set on the renderer. Iforthoistrue, then instead of using the camera's view and projection matrices, an ortho matrix is computed and used instead of the view projection matrix. The ortho matrix converts from the range (0 ~ Width, 0 ~ Height, -1 ~ +1) to the clip range (-1 ~ +1, -1 ~ +1, -1 ~ +1).- Parameters:
- cam- The camera to set
- ortho- True if to use orthographic projection (for GUI rendering), false if to use the camera's view and projection matrices.
 
- 
renderViewPortRawDraws the viewport but without notifyingscene processorsof any rendering events.- Parameters:
- vp- The ViewPort to render
- See Also:
 
- 
applyViewPortApplies the ViewPort's Camera and FrameBuffer in preparation for rendering.- Parameters:
- vp-
 
- 
renderViewPortRenders theViewPortusing the ViewPort'sRenderPipeline.If the ViewPort's RenderPipeline is null, the pipeline returned by getPipeline()is used instead.If the ViewPort is disabled, no rendering will occur. - Parameters:
- vp- View port to render
- tpf- Time per frame value
 
- 
renderpublic void render(float tpf, boolean mainFrameBufferActive) Called by the application to render any ViewPorts added to this RenderManager.Renders any viewports that were added using the following methods: - Parameters:
- tpf- Time per frame value
- mainFrameBufferActive- true to render viewports with no output FrameBuffer, false to skip them
 
- 
getPassDrawBufferTargetIdToShaderspublic boolean getPassDrawBufferTargetIdToShaders()Returns true if the draw buffer target id is passed to the shader.- Returns:
- True if the draw buffer target id is passed to the shaders.
 
- 
setPassDrawBufferTargetIdToShaderspublic void setPassDrawBufferTargetIdToShaders(boolean v) Enable or disable passing the draw buffer target id to the shaders. This is needed to handle FrameBuffer.setTargetIndex correctly in some backends.- Parameters:
- v- True to enable, false to disable (default is true)
 
- 
setRenderFilterSet a render filter. Every geometry will be tested against this filter before rendering and will only be rendered if the filter returns true.- Parameters:
- filter- the render filter
 
- 
getRenderFilterReturns the render filter that the RenderManager is currently using- Returns:
- the render filter
 
 
-