Class SceneRendererForward
Use a Scene Renderer to traverse a scene hierarchy (made out of scene nodes and s) in order to have each visited element contribute to the result rendered against a given render context.
Inheritance
Inherited Members
Namespace: Fusee.Engine.Core
Assembly: Fusee.Engine.Core.dll
Syntax
public class SceneRendererForward : Visitor<SceneNode, SceneComponent>
Constructors
SceneRendererForward(SceneContainer, RenderLayers)
Creates a new instance of type SceneRendererForward. This scene renderer is used for forward rendering.
Declaration
public SceneRendererForward(SceneContainer sc, RenderLayers renderLayer = RenderLayers.All)
Parameters
Type | Name | Description |
---|---|---|
SceneContainer | sc | The Fusee.Engine.Core.Scene containing the scene that is rendered. |
RenderLayers | renderLayer |
Fields
_animation
Manages animations.
Declaration
protected Animation _animation
Field Value
Type | Description |
---|---|
Animation |
_boneMap
Caches SceneNodes and their model matrices. Used when visiting a Bone.
Declaration
protected Dictionary<SceneNode, float4x4> _boneMap
Field Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<SceneNode, float4x4> |
_rc
The RenderContext, used to render the scene. This will be ignored if cameras are used.
Declaration
protected RenderContext _rc
Field Value
Type | Description |
---|---|
RenderContext |
_sc
The SceneContainer, containing the scene that gets rendered.
Declaration
protected SceneContainer _sc
Field Value
Type | Description |
---|---|
SceneContainer |
_state
Holds the status of the model matrices and other information we need while traversing up and down the scene graph.
Declaration
protected RendererState _state
Field Value
Type | Description |
---|---|
RendererState |
CurrentInstanceData
Returns currently visited InstanceData during a traversal.
Declaration
protected InstanceData CurrentInstanceData
Field Value
Type | Description |
---|---|
InstanceData |
DoFrumstumCulling
Enables or disables Frustum Culling. If we render with one or more cameras this value will be overwritten by FrustumCullingOn.
Declaration
public bool DoFrumstumCulling
Field Value
Type | Description |
---|---|
System.Boolean |
Properties
RenderLayer
The RenderLayer this renderer should render.
Declaration
public RenderLayers RenderLayer { get; set; }
Property Value
Type | Description |
---|---|
RenderLayers |
SC
The SceneContainer, containing the scene that gets rendered.
Declaration
public SceneContainer SC { get; }
Property Value
Type | Description |
---|---|
SceneContainer |
Methods
AccumulateLight()
Viserates the Light and caches them in a dedicated field.
Declaration
protected void AccumulateLight()
AddWeightToMesh(Mesh, Weight)
Adds bone indices and bone weights from a Weight to a mesh.
Declaration
protected void AddWeightToMesh(Mesh mesh, Weight wc)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | |
Weight | wc |
Animate()
Handles animations.
Declaration
public void Animate()
InitAnimations(SceneContainer)
Initializes animations, given as Animation.
Declaration
public void InitAnimations(SceneContainer sc)
Parameters
Type | Name | Description |
---|---|---|
SceneContainer | sc | The Scene, containing the Animations. |
InitState()
Sets the initial values in the RendererState.
Declaration
protected override void InitState()
Overrides
NotifyCameraChanges(Camera)
Updates the camera in each registered IRendererModule.
Declaration
protected void NotifyCameraChanges(Camera cam)
Parameters
Type | Name | Description |
---|---|---|
Camera | cam |
NotifyStateChanges()
Updates the state in each registered IRendererModule.
Declaration
protected void NotifyStateChanges()
PopState()
Pops from the RenderState and sets the Model and View matrices in the RenderContext.
Declaration
protected override void PopState()
Overrides
PushState()
Pushes into the RenderState.
Declaration
protected override void PushState()
Overrides
Render(RenderContext)
Renders the scene.
Declaration
public virtual void Render(RenderContext rc)
Parameters
Type | Name | Description |
---|---|---|
RenderContext | rc |
RenderBone(Bone)
Renders the Bone.
Declaration
public void RenderBone(Bone bone)
Parameters
Type | Name | Description |
---|---|---|
Bone | bone | The bone. |
RenderCanvasTransform(CanvasTransform)
Sets the state of the model matrices and UiRects.
Declaration
public void RenderCanvasTransform(CanvasTransform ctc)
Parameters
Type | Name | Description |
---|---|---|
CanvasTransform | ctc | The CanvasTransform. |
RenderEffect(Effect)
If a ShaderEffect is visited the ShaderEffect of the RendererState is updated and the effect is set in the RenderContext.
Declaration
public void RenderEffect(Effect effect)
Parameters
Type | Name | Description |
---|---|---|
Effect | effect | The Effect |
RenderInstances(InstanceData)
Sets CurrentInstanceData.
Declaration
public void RenderInstances(InstanceData instanceData)
Parameters
Type | Name | Description |
---|---|---|
InstanceData | instanceData |
RenderMesh(GpuMesh)
If a Mesh is visited the shader parameters for all lights in the scene are updated and the geometry is passed to be pushed through the rendering pipeline.
Declaration
public void RenderMesh(GpuMesh mesh)
Parameters
Type | Name | Description |
---|---|---|
GpuMesh | mesh | The Mesh. |
RenderMesh(Mesh)
If a Mesh is visited and it has a Weight the BoneIndices and BoneWeights get set, the shader parameters for all lights in the scene are updated and the geometry is passed to be pushed through the rendering pipeline.
Declaration
public void RenderMesh(Mesh mesh)
Parameters
Type | Name | Description |
---|---|---|
Mesh | mesh | The Mesh. |
RenderRectTransform(RectTransform)
If a RectTransform is visited the model matrix and MinMaxRect get updated in the RendererState.
Declaration
public void RenderRectTransform(RectTransform rtc)
Parameters
Type | Name | Description |
---|---|---|
RectTransform | rtc | The XForm. |
RenderRenderLayer(RenderLayer)
Renders the RenderLayer.
Declaration
public void RenderRenderLayer(RenderLayer renderLayer)
Parameters
Type | Name | Description |
---|---|---|
RenderLayer | renderLayer |
RenderTransform(Transform)
If a Transform is visited the model matrix of the RenderContext and RendererState is updated. It additionally updates the view matrix of the RenderContext.
Declaration
public void RenderTransform(Transform transform)
Parameters
Type | Name | Description |
---|---|---|
Transform | transform | The Transform. |
RenderWeight(Weight)
Renders the weight.
Declaration
public void RenderWeight(Weight weight)
Parameters
Type | Name | Description |
---|---|---|
Weight | weight |
RenderXForm(XForm)
If a XForm is visited the model matrix gets updated in the RendererState and set in the RenderContext.
Declaration
public void RenderXForm(XForm xfc)
Parameters
Type | Name | Description |
---|---|---|
XForm | xfc | The XForm. |
RenderXFormText(XFormText)
If a XFormText is visited the model matrix gets updated in the RendererState and set in the RenderContext.
Declaration
public void RenderXFormText(XFormText xfc)
Parameters
Type | Name | Description |
---|---|---|
XFormText | xfc | The XFormText. |
SetContext(RenderContext)
Sets the render context for the given scene.
Declaration
public virtual void SetContext(RenderContext rc)
Parameters
Type | Name | Description |
---|---|---|
RenderContext | rc |