Class PositionableRenderable
- Namespace
- OmegaEngine.Graphics.Renderables
- Assembly
- OmegaEngine.dll
An object that can be OmegaEngine.Graphics.Renderables.PositionableRenderable.Render(OmegaEngine.Graphics.RenderContext)ed at a specific Position in a Scene.
public abstract class PositionableRenderable : Renderable, IDisposable, IPositionable
- Inheritance
-
objectPositionableRenderable
- Implements
- Derived
- Inherited Members
Constructors
PositionableRenderable()
Creates a new positionable renderable.
protected PositionableRenderable()
Properties
Billboard
How this PositionableRenderable shall be rotated towards the camera
public BillboardMode Billboard { get; set; }
Property Value
BoundingBox
An axis-aligned box that completely encompasses the body (in entity space, even before apply PreTransform).
[Browsable(false)]
public BoundingBox? BoundingBox { get; protected set; }
Property Value
- BoundingBox?
BoundingSphere
A sphere that completely encompasses the body (in entity space, even before apply PreTransform).
[Browsable(false)]
public BoundingSphere? BoundingSphere { get; protected set; }
Property Value
- BoundingSphere?
Children
The PositionableRenderables placed in this one's local coordinate system.
[Browsable(false)]
public ICollection<PositionableRenderable> Children { get; }
Property Value
Remarks
A renderable lives in exactly one collection at a time: either this or Positionables. Adding it here removes it from its previous collection and keeps its local Position, Rotation, Scale and PreTransform, i.e. its world position changes.
Setting Visible to false hides the entire subtree. A View skips the entire subtree if SubtreeBoundingSphere or SubtreeBoundingBox is outside its view frustum.
Will be disposed when Dispose() is called.
DrawBoundingBox
Shall the bounding box used to cull this object be drawn/visualized? (used for debugging)
public bool DrawBoundingBox { get; set; }
Property Value
DrawBoundingSphere
Shall the bounding sphere used to cull this object be drawn/visualized? (used for debugging)
public bool DrawBoundingSphere { get; set; }
Property Value
MinScreenSizeDistance
The renderable never appears smaller on screen than it does at this distance from the Camera, keeping distant objects visible.
public float? MinScreenSizeDistance { get; set; }
Property Value
Remarks
While closer than this distance the renderable renders at its natural size; farther away it is scaled up to preserve its apparent size (angular diameter) at this distance.
The scaling is applied on top of Scale and is reflected in the bounding bodies used for culling. Combine with DistanceCompressionStart for very large, very distant objects.
PhysicalWorldTransform
The world transformation matrix for this entity, composed purely from the hierarchy's transforms.
protected Matrix PhysicalWorldTransform { get; }
Property Value
- Matrix
Remarks
Unlike WorldTransformCached this carries no billboarding, distance compression or minimum screen size scaling. Its translation is still relative to the floating origin.
Pickable
Shall this PositionableRenderable be pickable with the mouse?
public bool Pickable { get; set; }
Property Value
Position
The body's position: absolute world space for a root, an offset in the parent's coordinate system for an element of another body's Children.
public DoubleVector3 Position { get; set; }
Property Value
- See Also
PreTransform
A transformation matrix that is to be applied before the normal world transform occurs - useful for correcting off-center meshes
[Browsable(false)]
public Matrix PreTransform { get; set; }
Property Value
- Matrix
RenderIn
In what kind of Views shall this body be rendered?
public ViewType RenderIn { get; set; }
Property Value
RequiredViews
A list of Views that must be rendered before this PositionableRenderable can be rendered
[Browsable(false)]
public ICollection<View> RequiredViews { get; }
Property Value
Rotation
The body's rotation quaternion
[Browsable(false)]
public Quaternion Rotation { get; set; }
Property Value
- Quaternion
Scale
Scaling to be performed before rendering
public Vector3 Scale { get; set; }
Property Value
- Vector3
Remarks
Inherited by Children; non-uniform scaling combined with a rotated child produces shear.
ShadowCaster
Shall this PositionableRenderable cast shadows on other objects?
public bool ShadowCaster { get; set; }
Property Value
ShadowReceiver
Shall this PositionableRenderable receive shadows from other objects?
public bool ShadowReceiver { get; set; }
Property Value
SubtreeBoundingBox
An axis-aligned box that completely encompasses this body and all its Children (in floating world space, used for culling whole subtrees).
[Browsable(false)]
public BoundingBox? SubtreeBoundingBox { get; }
Property Value
- BoundingBox?
Remarks
null if the subtree cannot be culled as a whole, e.g. because it contains a body without bounding bodies or with MinScreenSizeDistance.
Unlike WorldBoundingBox this is independent of any Camera: Billboarded leaves are covered by a box enclosing every possible rotation and DistanceCompressionStart is not applied.
SubtreeBoundingSphere
A sphere that completely encompasses this body and all its Children (in floating world space, used for culling whole subtrees).
[Browsable(false)]
public BoundingSphere? SubtreeBoundingSphere { get; }
Property Value
- BoundingSphere?
Remarks
null if the subtree cannot be culled as a whole, e.g. because it contains a body without bounding bodies or with MinScreenSizeDistance.
Unlike WorldBoundingSphere this is independent of any Camera: Billboarded leaves are covered by a sphere enclosing every possible rotation and DistanceCompressionStart is not applied.
SurfaceEffect
What kinds of surface effects (e.g. lighting) to apply to this PositionableRenderable
public SurfaceEffect SurfaceEffect { get; set; }
Property Value
SurfaceShader
The SurfaceShader to apply to the surface of this PositionableRenderable
public SurfaceShader? SurfaceShader { get; set; }
Property Value
Remarks
Will NOT be disposed when Dispose() is called.
- See Also
WorldBoundingBox
An axis-aligned box that completely encompasses the body (in floating world space, used for culling tests).
[Browsable(false)]
public BoundingBox? WorldBoundingBox { get; }
Property Value
- BoundingBox?
WorldBoundingSphere
A sphere that completely encompasses the body (in floating world space, used for culling tests).
[Browsable(false)]
public BoundingSphere? WorldBoundingSphere { get; }
Property Value
- BoundingSphere?
WorldPosition
The body's absolute position in world space, resolved through the hierarchy in double precision.
[Browsable(false)]
public DoubleVector3 WorldPosition { get; }
Property Value
Remarks
WorldTransformCached
protected Matrix WorldTransformCached { get; }
Property Value
- Matrix
WorldTransformWithoutDistanceCompressionCached
protected Matrix WorldTransformWithoutDistanceCompressionCached { get; }
Property Value
- Matrix
Methods
EnsureWorldTransform()
Ensures all cached transformation matrices and related values are up-to-date.
protected void EnsureWorldTransform()
GetWorldBoundingSphereOrPosition()
Returns the WorldBoundingSphere or, if that is not available, a sphere with the floating world position and zero radius.
protected BoundingSphere GetWorldBoundingSphereOrPosition()
Returns
- BoundingSphere
Intersects(Ray, out DoubleVector3)
Determine whether this PositionableRenderable is intersected by a ray.
public bool Intersects(Ray ray, out DoubleVector3 position)
Parameters
rayRayA ray in world space along which to check for intersections.
positionDoubleVector3Returns the position of the intersection in entity space.
Returns
- bool
trueif this PositionableRenderable was intersected by theray.
- See Also
Intersects(Ray, out float)
Determine whether this PositionableRenderable is intersected by a ray.
public virtual bool Intersects(Ray ray, out float distance)
Parameters
rayRayA ray in world space along which to check for intersections.
distancefloatReturns the distance along the
rayat which the intersection took place.
Returns
- bool
trueif this PositionableRenderable was intersected by theray.
- See Also
IntersectsBounding(Ray)
Determine whether WorldBoundingBox and WorldBoundingSphere (if defined) are intersected by a ray.
protected virtual bool IntersectsBounding(Ray ray)
Parameters
rayRayA ray in world space along which to check for intersections.
Returns
- bool
trueif the bounding bodies were undefined or intersected by theray.
MarkLocalTransformDirty()
Invalidates all cached transforms of this body and makes its descendants observe the change.
protected void MarkLocalTransformDirty()
Remarks
Called by every mutation of the local transform factors and by every reparenting.
OnEngineSet()
Hook that is called when Engine is set for the first time.
protected override void OnEngineSet()
RecalcWorldTransform()
Hook for recalculating renderable-specific values derived from the transformation matrices.
protected virtual void RecalcWorldTransform()
Remarks
Called by EnsureWorldTransform() after the matrices have been updated.
SetScale(float)
Scales this PositionableRenderable symmetrically
public void SetScale(float factor)
Parameters
factorfloatThe factor by which to scale
Events
PreVisibilityCheck
Triggered before checking the entity for visibility. Will be triggered multiple times if the entity is rendered in multiple views.
public event Action? PreVisibilityCheck