OmegaEngine API  1.0.3
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Properties | Events | List of all members
OmegaEngine.Graphics.View Class Reference

Controls the rendering of a OmegaEngine.Graphics.Scene using a Cameras.Camera. More...

Inheritance diagram for OmegaEngine.Graphics.View:
OmegaEngine.EngineElement OmegaEngine.IResetable OmegaEngine.Graphics.TextureView OmegaEngine.Graphics.LazyView OmegaEngine.Graphics.SupportView OmegaEngine.Graphics.SpecialView OmegaEngine.Graphics.WaterView OmegaEngine.Graphics.GlowView OmegaEngine.Graphics.ShadowView

Public Member Functions

override string ToString ()
 
 View (Scene scene, Camera camera, Rectangle area=new Rectangle())
 Creates a new view for rendering More...
 
 View (Color color)
 Creates a new view for rendering a plain color fullscreen More...
 
Ray PickingRay (Point location)
 Generates a 3D picking ray. More...
 
PositionableRenderable Pick (Point location, out DoubleVector3 position)
 Pick an PositionableRenderable in 3D-space using the mouse More...
 
void SwingCameraTo (Camera target, float duration=1)
 Switches from the current camera view to a new view using a cinematic effect More...
 
void SetupGlow (float blurStrength=3, float glowStrength=1.5f)
 Creates a glow-map of this view and adds it to ChildViews More...
 
void SetupShadow (LightSource light)
 Creates a shadow-map for a LightSource in the Scene More...
 
- Public Member Functions inherited from OmegaEngine.EngineElement
void Dispose ()
 

Public Attributes

Point AreaCenter
 The center point of Area More...
 
ICollection< TextureViewChildViews => _childViews
 A list of TextureViews that are to be Rendered before this View. Usually only Rendered if a PositionableRenderable in OmegaEngine.Graphics.Scene.Positionables has it listed in PositionableRenderable.RequiredViews. More...
 
ICollection< FloatingModelFloatingModels => _floatingModels
 A list of FloatingModels to be overlayed on top of the Scene. Use this for UI-like elements, e.g. axis-arrows. More...
 
ICollection< PostShaderPostShaders => _postShaders
 A list of post-processing shaders to be applied after rendering the scene More...
 
- Public Attributes inherited from OmegaEngine.EngineElement
bool IsEngineSet => _engine != null
 true if the Engine has been set. More...
 

Protected Member Functions

override void OnEngineSet ()
 Hook that is calld when Engine is set for the first time.
 
override void OnDispose ()
 Hook that is called when the object needs to dispose its internal resources.
 
virtual bool IsToRender (PositionableRenderable body)
 Checks if a PositionableRenderable is supposed to be rendered in this type of View More...
 
virtual void ApplyPostShaders (bool sceneOnBackBuffer)
 Applies PostShaders to the output More...
 
void PrepareRenderTarget ()
 Prepares a OmegaEngine.Graphics.RenderTarget texture if there is none yet - call as often as you want More...
 
void ShaderToRenderTarget (PostShader shader)
 Updates the OmegaEngine.Graphics.RenderTarget using a PostShader More...
 
virtual void RenderBackground ()
 Renders the back of the Scene More...
 
virtual void RenderBody (PositionableRenderable body)
 Renders a PositionableRenderable from the Scene More...
 
- Protected Member Functions inherited from OmegaEngine.EngineElement
void RegisterChild (EngineElement element, bool autoDispose=true)
 Registers a child EngineElement for automatic Engine setting and Dispose calling. More...
 
void UnregisterChild (EngineElement element)
 Unregisters a child EngineElement (opposite of RegisterChild). More...
 

Protected Attributes

bool BackgroundQuadDirty = true
 Does the background qaud need to be recreated? More...
 
RenderTarget RenderTarget
 An alternative surface to render onto instead of the back-buffer More...
 
virtual bool TextureRenderTarget => false
 Does this View render to a texture RenderTarget? Only true for TextureViews. More...
 

Properties

bool RenderedInLastFrame [get]
 Was this view rendered in the this frame? More...
 
string Name [get, set]
 Text value to make it easier to identify a particular view More...
 
Rectangle Area [get, set]
 The screen area this view should fill (all zero for fullscreen) More...
 
bool Visible = true [get, set]
 Shall the scene be rendered? More...
 
bool InvertCull [get, set]
 Cull clockwise instead of counter-clockwise? More...
 
virtual int FullAlpha [get, set]
 The level of transparency from 0 (solid) to 255 (invisible) for the complete scene More...
 
virtual bool Fog [get, set]
 Automatically apply a fog using BackgroundColor and the Cameras clip planes More...
 
virtual bool Lighting = true [get, set]
 Is lighting used in RenderScene? More...
 
Color BackgroundColor [get, set]
 The background color and fog color of this scene - Color.Empty for no background, may use alpha-channel if FullAlpha is not set More...
 
Scene Scene [get]
 The scene containing the PositionableRenderables to be rendered. More...
 
Camera Camera [get, set]
 The camera describing how to look at the scene More...
 
- Properties inherited from OmegaEngine.EngineElement
Engine Engine [get, set]
 The Engine instance used by this object. Must be set before using the object. May not be changed once it has been set! More...
 
bool IsDisposed [get]
 Indicates whether this object has been disposed and can therefore no longer be used. More...
 

Events

Action< CameraPreRender
 Occurs immediately before the Scene begins rendering. ChildViews will have been rendered already. More...
 

Detailed Description

Controls the rendering of a OmegaEngine.Graphics.Scene using a Cameras.Camera.

Multiple Views can share the same OmegaEngine.Graphics.Scene, but they should all have separate Cameras.Cameras.

Constructor & Destructor Documentation

◆ View() [1/2]

OmegaEngine.Graphics.View.View ( Scene  scene,
Camera  camera,
Rectangle  area = new Rectangle() 
)
inline

Creates a new view for rendering

Parameters
sceneThe scene containing the PositionableRenderables to be rendered. Will NOT be disposed when EngineElement.Dispose is called.
cameraThe Camera to look at the Scene with
areaThe screen area this view should fill (leave empty for fullscreen)

◆ View() [2/2]

OmegaEngine.Graphics.View.View ( Color  color)
inline

Creates a new view for rendering a plain color fullscreen

Parameters
colorThe plain color to render

Member Function Documentation

◆ ApplyPostShaders()

virtual void OmegaEngine.Graphics.View.ApplyPostShaders ( bool  sceneOnBackBuffer)
inlineprotectedvirtual

Applies PostShaders to the output

Parameters
sceneOnBackBufferIs the scene currently on the backbuffer?
If this is false, it is in RenderTarget.

Reimplemented in OmegaEngine.Graphics.TextureView.

◆ IsToRender()

virtual bool OmegaEngine.Graphics.View.IsToRender ( PositionableRenderable  body)
inlineprotectedvirtual

Checks if a PositionableRenderable is supposed to be rendered in this type of View

Parameters
bodyThe PositionableRenderable to check
Returns
true if the PositionableRenderable is supposed to be rendered

Reimplemented in OmegaEngine.Graphics.WaterView, and OmegaEngine.Graphics.SupportView.

◆ Pick()

PositionableRenderable OmegaEngine.Graphics.View.Pick ( Point  location,
out DoubleVector3  position 
)
inline

Pick an PositionableRenderable in 3D-space using the mouse

Parameters
locationThe screen space location to start the ray from (usually mouse coordinates)
positionReturns the position of the vertex closest to the intersection in entity space
Returns
The picked PositionableRenderable or null.

◆ PickingRay()

Ray OmegaEngine.Graphics.View.PickingRay ( Point  location)
inline

Generates a 3D picking ray.

Parameters
locationThe screen space location to start the ray from (usually mouse coordinates)
Returns
A ray in world space starting at the Camera position moving towards the specified location .

◆ PrepareRenderTarget()

void OmegaEngine.Graphics.View.PrepareRenderTarget ( )
inlineprotected

Prepares a OmegaEngine.Graphics.RenderTarget texture if there is none yet - call as often as you want

◆ RenderBackground()

virtual void OmegaEngine.Graphics.View.RenderBackground ( )
inlineprotectedvirtual

Renders the back of the Scene

Reimplemented in OmegaEngine.Graphics.SpecialView.

◆ RenderBody()

virtual void OmegaEngine.Graphics.View.RenderBody ( PositionableRenderable  body)
inlineprotectedvirtual

Renders a PositionableRenderable from the Scene

Parameters
bodyThe PositionableRenderable to render

Reimplemented in OmegaEngine.Graphics.GlowView, and OmegaEngine.Graphics.ShadowView.

◆ SetupGlow()

void OmegaEngine.Graphics.View.SetupGlow ( float  blurStrength = 3,
float  glowStrength = 1.5f 
)
inline

Creates a glow-map of this view and adds it to ChildViews

Parameters
blurStrengthHow strongly to blur the glow map - values between 0 and 10
glowStrengthA factor by which the blurred glow color is multiplied - values between 0 and 100

Calling this method multiple times will have no effect

◆ SetupShadow()

void OmegaEngine.Graphics.View.SetupShadow ( LightSource  light)
inline

Creates a shadow-map for a LightSource in the Scene

Parameters
lightThe LightSource to create the shadow-map for

◆ ShaderToRenderTarget()

void OmegaEngine.Graphics.View.ShaderToRenderTarget ( PostShader  shader)
inlineprotected

Updates the OmegaEngine.Graphics.RenderTarget using a PostShader

Parameters
shaderThe PostShader to apply

◆ SwingCameraTo()

void OmegaEngine.Graphics.View.SwingCameraTo ( Camera  target,
float  duration = 1 
)
inline

Switches from the current camera view to a new view using a cinematic effect

Parameters
targetThe new camera
durationThe complete transition time in seconds

Member Data Documentation

◆ AreaCenter

Point OmegaEngine.Graphics.View.AreaCenter
Initial value:
=> new Point(
_area.Location.X + _area.Size.Width / 2,
_area.Location.Y + _area.Size.Height / 2)

The center point of Area

◆ BackgroundQuadDirty

bool OmegaEngine.Graphics.View.BackgroundQuadDirty = true
protected

Does the background qaud need to be recreated?

◆ ChildViews

ICollection<TextureView> OmegaEngine.Graphics.View.ChildViews => _childViews

A list of TextureViews that are to be Rendered before this View. Usually only Rendered if a PositionableRenderable in OmegaEngine.Graphics.Scene.Positionables has it listed in PositionableRenderable.RequiredViews.

Will be disposed when EngineElement.Dispose is called.

◆ FloatingModels

ICollection<FloatingModel> OmegaEngine.Graphics.View.FloatingModels => _floatingModels

A list of FloatingModels to be overlayed on top of the Scene. Use this for UI-like elements, e.g. axis-arrows.

Will be disposed when EngineElement.Dispose is called.

◆ PostShaders

ICollection<PostShader> OmegaEngine.Graphics.View.PostShaders => _postShaders

A list of post-processing shaders to be applied after rendering the scene

Will be disposed when EngineElement.Dispose is called.

◆ RenderTarget

RenderTarget OmegaEngine.Graphics.View.RenderTarget
protected

An alternative surface to render onto instead of the back-buffer

◆ TextureRenderTarget

virtual bool OmegaEngine.Graphics.View.TextureRenderTarget => false
protected

Does this View render to a texture RenderTarget? Only true for TextureViews.

Property Documentation

◆ Area

Rectangle OmegaEngine.Graphics.View.Area
getset

The screen area this view should fill (all zero for fullscreen)

◆ BackgroundColor

Color OmegaEngine.Graphics.View.BackgroundColor
getset

The background color and fog color of this scene - Color.Empty for no background, may use alpha-channel if FullAlpha is not set

◆ Camera

Camera OmegaEngine.Graphics.View.Camera
getset

The camera describing how to look at the scene

◆ Fog

virtual bool OmegaEngine.Graphics.View.Fog
getset

Automatically apply a fog using BackgroundColor and the Cameras clip planes

◆ FullAlpha

virtual int OmegaEngine.Graphics.View.FullAlpha
getset

The level of transparency from 0 (solid) to 255 (invisible) for the complete scene

◆ InvertCull

bool OmegaEngine.Graphics.View.InvertCull
getset

Cull clockwise instead of counter-clockwise?

◆ Lighting

virtual bool OmegaEngine.Graphics.View.Lighting = true
getset

Is lighting used in RenderScene?

◆ Name

string OmegaEngine.Graphics.View.Name
getset

Text value to make it easier to identify a particular view

◆ RenderedInLastFrame

bool OmegaEngine.Graphics.View.RenderedInLastFrame
get

Was this view rendered in the this frame?

Used to debug culling methods

◆ Scene

Scene OmegaEngine.Graphics.View.Scene
get

The scene containing the PositionableRenderables to be rendered.

Will NOT be disposed when EngineElement.Dispose is called.

◆ Visible

bool OmegaEngine.Graphics.View.Visible = true
getset

Shall the scene be rendered?

Event Documentation

◆ PreRender

Action<Camera> OmegaEngine.Graphics.View.PreRender

Occurs immediately before the Scene begins rendering. ChildViews will have been rendered already.


The documentation for this class was generated from the following files: