ModelRenderer
Description
- Derived from
-
Disposable abstract
IBeginEnd
The ModelRenderer class performs 3D rendering of IModel objects.
When IBeginEnd.Begin is called, the following properties are reset to their default value:
The calls to IBeginEnd.Begin and IBeginEnd.End must not be nested.
Public / Constructors
ModelRenderer
Creates a new instance of ModelRenderer.
- RenderException
-
If a graphics subsystem error has occurred.
Public / Methods
FlushQueue
Flushes the given render queues.
Render work is only submitted to the GPU when this method is called.
FlushState
Flushes the remembered render state and ends the render effect.
Call this method when before using other render effects between calls to IBeginEnd.Begin and IBeginEnd.End.
Render
Renders the given 3D model.
The following properties are used for rendering the model:
-
Instances:
The instance range to use for rendering instanced geometry (see IModelGeometry.InstanceBuffer). This property is ignored for geometry that is not instanced. -
TransformPush:
The top-most transformation matrix is applied last, just before the coordinate system origin is applied. -
Pose:
Can be used to modify the model hierarchy without changing model properties.
Calling this method merely buffers render jobs for model geometry. Actual render work for the GPU is only submitted when the FlushQueue method is called, the IBeginEnd.End method does implicitly perform a flush.
Public / Attributes
Debug
The material debug mode to use for models during rendering.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
Defaults to 0
.
Fade
The fade range to apply to models during rendering.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
Models will start to become visible at RangeF.Start and will have become invisible again at RangeF.End.
This fade range is overridden by IModel.FadeIn and IModel.FadeOut, if present.
Set to RangeF.Zero to disable fading.
Defaults to RangeF.Zero.
FadeOffset
A custom offset factor for fade ranges.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
The fade offset is added to camera distance values, before applying the fade ranges.
Defaults to 0
.
Flags
The model renderer flags.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
The default value is ModelRendererFlags.None.
Frustum
Optional frustum to use for discarding invisible model parts.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
Defaults to null
.
Instances
The range of model geometry instances to draw.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
Will be ignored if model geometry is not instanced.
Defaults to RangeI.Zero.
Mode
The render mode to use.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
Defaults to ModelRendererMode.Default.
ParametersCamera
Returns the camera parameters.
When IBeginEnd.Begin is called, the following camera parameters are copied and used for viewport and distance culling:
Render effect parameters are taken into account when the render queues are flushed, see FlushQueue.
ParametersLighting
Returns the lighting parameters.
Render effect parameters are taken into account when the render queues are flushed, see FlushQueue.
ParametersShadow
Returns the shadow-mapping parameters.
Render effect parameters are taken into account when the render queues are flushed, see FlushQueue.
Pose
The model pose container that is used for rendering.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
Defaults to null
.
Statistics
Returns statistics for the current IBeginEnd.Begin/IBeginEnd.End cycle.
Statistic values are accumulated until StatisticsClear is called.
Unit
The unit of measure of world-space coordinates.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
The world-space and model-space units (see IModel.Unit) are used to compute a proper scaling factor for rendering.
Defaults to UnitOfMeasure.Metre.
Viewport
Optional viewport to use for computing screen-space sizes, based on world-space sizes.
The depth offset for rendering surface layers is (see IModelPart.Layer) is computed so that it spans the world-space size that corresponds to roughly one screen pixels.
Distance culling computes the screen-space size of the bounding sphere of each model and skips the model if it would be too small on the screen.
The value of this property is taken into account on each call to Render, modifying it will not affect earlier calls.
Defaults to null
.