Class View
- Namespace
- OmegaEngine.Graphics
- Assembly
- OmegaEngine.dll
public class View : EngineElement, IDisposable
- Inheritance
-
View
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
Constructors
View(Scene, Camera, Rectangle)
Creates a new view for rendering
public View(Scene scene, Camera camera, Rectangle area = default)
Parameters
scene
SceneThe scene containing the PositionableRenderables to be rendered. Will NOT be disposed when Dispose() is called.
camera
Cameraarea
RectangleThe screen area this view should fill (leave empty for fullscreen)
View(Color)
Creates a new view for rendering a plain color fullscreen
public View(Color color)
Parameters
color
ColorThe plain color to render
Fields
BackgroundQuadDirty
Does the background qaud need to be recreated?
protected bool BackgroundQuadDirty
Field Value
RenderTarget
An alternative surface to render onto instead of the back-buffer
protected RenderTarget? RenderTarget
Field Value
Properties
Area
The screen area this view should fill (all zero for fullscreen)
public Rectangle Area { get; set; }
Property Value
AreaCenter
The center point of Area
[Browsable(false)]
public Point AreaCenter { get; }
Property Value
BackgroundColor
The background color and fog color of this scene - Empty for no background, may use alpha-channel if FullAlpha is not set
public Color BackgroundColor { get; set; }
Property Value
Camera
The camera describing how to look at the scene
[Browsable(false)]
public Camera Camera { get; set; }
Property Value
ChildViews
A list of TextureViews that are to be OmegaEngine.Graphics.View.Render()ed before this View. Usually only OmegaEngine.Graphics.View.Render()ed if a PositionableRenderable in Positionables has it listed in RequiredViews.
[Browsable(false)]
public ICollection<TextureView> ChildViews { get; }
Property Value
Remarks
Will be disposed when Dispose() is called.
FloatingModels
A list of FloatingModels to be overlayed on top of the Scene. Use this for UI-like elements, e.g. axis-arrows.
[Browsable(false)]
public ICollection<FloatingModel> FloatingModels { get; }
Property Value
Remarks
Will be disposed when Dispose() is called.
Fog
Automatically apply a fog using BackgroundColor and the Cameras clip planes
public virtual bool Fog { get; set; }
Property Value
FullAlpha
The level of transparency from 0 (solid) to 255 (invisible) for the complete scene
public virtual int FullAlpha { get; set; }
Property Value
InvertCull
Cull clockwise instead of counter-clockwise?
public bool InvertCull { get; set; }
Property Value
Lighting
Is lighting used in OmegaEngine.Graphics.View.RenderScene()?
public virtual bool Lighting { get; set; }
Property Value
Name
Text value to make it easier to identify a particular view
public string Name { get; set; }
Property Value
PostShaders
A list of post-processing shaders to be applied after rendering the scene
[Browsable(false)]
public ICollection<PostShader> PostShaders { get; }
Property Value
Remarks
Will be disposed when Dispose() is called.
RenderedInLastFrame
Was this view rendered in the this frame?
public bool RenderedInLastFrame { get; }
Property Value
Remarks
Used to debug culling methods
Scene
The scene containing the PositionableRenderables to be rendered.
[Browsable(false)]
public Scene Scene { get; }
Property Value
Remarks
Will NOT be disposed when Dispose() is called.
TextureRenderTarget
Does this View render to a texture RenderTarget? Only true
for TextureViews.
protected virtual bool TextureRenderTarget { get; }
Property Value
Visible
Shall the scene be rendered?
public bool Visible { get; set; }
Property Value
Methods
ApplyPostShaders(bool)
Applies PostShaders to the output
protected virtual void ApplyPostShaders(bool sceneOnBackBuffer)
Parameters
sceneOnBackBuffer
boolIs the scene currently on the backbuffer?
If this isfalse
, it is in RenderTarget.
IsToRender(PositionableRenderable)
Checks if a PositionableRenderable is supposed to be rendered in this type of View
protected virtual bool IsToRender(PositionableRenderable body)
Parameters
body
PositionableRenderableThe PositionableRenderable to check
Returns
- bool
true
if the PositionableRenderable is supposed to be rendered
OnDispose()
Hook that is called when the object needs to dispose its internal resources.
protected override void OnDispose()
OnEngineSet()
Hook that is called when Engine is set for the first time.
protected override void OnEngineSet()
Pick(Point, out DoubleVector3)
Pick an PositionableRenderable in 3D-space using the mouse
public PositionableRenderable Pick(Point location, out DoubleVector3 position)
Parameters
location
PointThe screen space location to start the ray from (usually mouse coordinates)
position
DoubleVector3Returns the position of the vertex closest to the intersection in entity space
Returns
- PositionableRenderable
The picked PositionableRenderable or
null
.
PickingRay(Point)
Generates a 3D picking ray.
public Ray PickingRay(Point location)
Parameters
location
PointThe screen space location to start the ray from (usually mouse coordinates)
Returns
- Ray
A ray in world space starting at the Camera position moving towards the specified
location
.
PrepareRenderTarget()
Prepares a RenderTarget texture if there is none yet - call as often as you want
protected void PrepareRenderTarget()
RenderBackground()
Renders the back of the Scene
protected virtual void RenderBackground()
RenderBody(PositionableRenderable)
Renders a PositionableRenderable from the Scene
protected virtual void RenderBody(PositionableRenderable body)
Parameters
body
PositionableRenderableThe PositionableRenderable to render
SetupGlow(float, float)
Creates a glow-map of this view and adds it to ChildViews
public void SetupGlow(float blurStrength = 3, float glowStrength = 1.5)
Parameters
blurStrength
floatHow strongly to blur the glow map - values between 0 and 10
glowStrength
floatA factor by which the blurred glow color is multiplied - values between 0 and 100
Remarks
Calling this method multiple times will have no effect
SetupShadow(LightSource)
Creates a shadow-map for a LightSource in the Scene
public void SetupShadow(LightSource light)
Parameters
light
LightSourceThe LightSource to create the shadow-map for
ShaderToRenderTarget(PostShader)
Updates the RenderTarget using a PostShader
protected void ShaderToRenderTarget(PostShader shader)
Parameters
shader
PostShaderThe PostShader to apply
SwingCameraTo(Camera, float)
Switches from the current camera view to a new view using a cinematic effect
public void SwingCameraTo(Camera target, float duration = 1)
Parameters
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Events
PreRender
Occurs immediately before the Scene begins rendering. ChildViews will have been rendered already.
public event Action<Camera> PreRender