OmegaEngine API  1.0.3
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Package Functions | Package Attributes | Properties | Events | List of all members
OmegaEngine.Engine Class Reference

Provides central control for 3D rendering, sound management, asset caching, etc. More...

Inheritance diagram for OmegaEngine.Engine:
OmegaEngine.EngineElement

Public Member Functions

 Engine (Control target, EngineConfig config)
 Initializes the Engine and its components. More...
 
void Screenshot (string filename)
 Saves the current screen at it's current resolution More...
 
void Screenshot (string filename, int width, int height)
 Saves the current screen at a scaled resolution as JPG More...
 
void Screenshot (string filename, Size size)
 Saves the current screen at a scaled resolution More...
 
void Debug ()
 Displays a debug interface for the engine, allowing easy manipulation of Views, Renderable, etc. More...
 
void DebugClose ()
 Closes the windows displayed by Debug More...
 
void Render ()
 Renders all Views. Tracks elapsed game time automatically. More...
 
void Render (double elapsedGameTime, bool noPresent=false)
 Renders all Views. Uses external game time tracking. More...
 
- Public Member Functions inherited from OmegaEngine.EngineElement
void Dispose ()
 

Public Attributes

ICollection< ViewViews => _views
 A list of all views to be rendered by the engine More...
 
- Public Attributes inherited from OmegaEngine.EngineElement
bool IsEngineSet => _engine != null
 true if the Engine has been set. More...
 

Static Public Attributes

static Version Version => Assembly.GetExecutingAssembly().GetName().Version
 The version number of the engine. More...
 

Protected Member Functions

override void OnDispose ()
 Hook that is called when the object needs to dispose its internal resources. 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...
 
virtual void OnEngineSet ()
 Hook that is calld when Engine is set for the first time. More...
 

Package Functions

void QueueReset (IResetable o)
 Queues an object for resetting at the beginning of the next frame. More...
 
void SetupTextureFiltering ()
 Apply texture filtering modes to Device. More...
 
TerrainShader GetTerrainShader (bool lighting, int textureMask)
 Generates a shader for a specific set of enabled textures. Results are cached internally. More...
 

Package Attributes

readonly HashSet< WaterViewSourceWaterViewSources = new HashSet<WaterViewSource>()
 A list of possible Views usable for rendering Water More...
 
readonly Mesh SimpleSphere
 
readonly Mesh SimpleBox
 

Properties

DirectSound AudioDevice [get, set]
 The DirectSound device More...
 
MusicManager Music [get, set]
 Controls the playback of music (theme-selection, cross-fading, etc.) More...
 
static CultureInfo ResourceCulture [get, set]
 The culture used for loading the assembly resources. More...
 
Control Target [get]
 The System.Windows.Forms.Control the engine draws onto. More...
 
EngineConfig Config [get, set]
 The settings the engine was initialized with. More...
 
EngineCapabilities Capabilities [get]
 Methods for determining the rendering capabilities of the graphics hardware. More...
 
EngineEffects Effects [get, set]
 Turn specific rendering effects in the engine on or off. More...
 
EngineState State [get]
 Used by Renderable implementations to manipulate the graphics render state. Should not be manipulated manually. More...
 
EnginePerformance Performance [get]
 Tracks the performance/speed of the engine. More...
 
CacheManager Cache [get]
 The central cache used for all graphics and sound assets. More...
 
double LastFrameGameTime [get, set]
 How many seconds of game time have elapsed since the last frame started drawing. More...
 
double TotalGameTime [get, set]
 How many seconds of game time have elapsed in total. More...
 
Device Device [get, set]
 The Direct3D device. Use State instead of manipulating this directly when possible. More...
 
bool NeedsReset [get, set]
 The engine will be reset on the next Render() call More...
 
PresentParameters PresentParams [get, set]
 The PresentParameters auto-generated from Config More...
 
Surface BackBuffer [get, set]
 The BackBuffer the D3D Device renders onto More...
 
Viewport RenderViewport [get, set]
 The viewport for the render target More...
 
Size RenderSize [get, set]
 The size of the render target More...
 
bool Anisotropic [get, set]
 Use anisotropic texture filtering More...
 
string ShaderDir [get, set]
 The base directory where shader files are stored More...
 
GeneralShader DefaultShader [get, set]
 A shader used for default lighting More...
 
WaterShader SimpleWaterShader [get]
 A shader used for simple water (no reflection or refraction) More...
 
int FadeLevel [get, set]
 The level of scene fading from 0 (fully visible) to 255 (invisible). More...
 
bool FadeExtra [get, set]
 Is Engine.ExtraRender faded along with 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, set]
 Indicates whether this object has been disposed and can therefore no longer be used. More...
 

Events

Action PreRender
 Occurs once for every frame before rendering. More...
 
Action ExtraRender
 Allows the integration of external render processes at the end of the Engine's presentation scheme. More...
 
Action PostRender
 Occurs once for every frame after rendering More...
 
Action DeviceLost
 Occurs after the Device was lost. This usually happens when switching to or from fullscreen mode. More...
 
Action DeviceReset
 Occurs after the Device was reset. This needs to be done to continue using it after DeviceLost. More...
 

Detailed Description

Provides central control for 3D rendering, sound management, asset caching, etc.

Constructor & Destructor Documentation

OmegaEngine.Engine.Engine ( Control  target,
EngineConfig  config 
)
inline

Initializes the Engine and its components.

Parameters
targetThe System.Windows.Forms.Control the engine should draw onto.
configSettings for initializing the engine.
Exceptions
NotSupportedExceptionThe graphics card does not meet the engine's minimum requirements.
Direct3D9NotFoundExceptionThrow if required DirectX version is missing.
Direct3DX9NotFoundExceptionThrow if required DirectX version is missing.
Direct3D9Exceptioninternal errors occurred while intiliazing the graphics card.
SlimDX.DirectSound.DirectSoundExceptioninternal errors occurred while intiliazing the sound card.

Member Function Documentation

void OmegaEngine.Engine.Debug ( )
inline

Displays a debug interface for the engine, allowing easy manipulation of Views, Renderable, etc.

void OmegaEngine.Engine.DebugClose ( )
inline

Closes the windows displayed by Debug

TerrainShader OmegaEngine.Engine.GetTerrainShader ( bool  lighting,
int  textureMask 
)
inlinepackage

Generates a shader for a specific set of enabled textures. Results are cached internally.

Parameters
lightingGet a shader with lighting enabled?
textureMaskA bitmask that indicates which textures are enabled.
override void OmegaEngine.Engine.OnDispose ( )
inlineprotectedvirtual

Hook that is called when the object needs to dispose its internal resources.

Reimplemented from OmegaEngine.EngineElement.

void OmegaEngine.Engine.QueueReset ( IResetable  o)
inlinepackage

Queues an object for resetting at the beginning of the next frame.

Parameters
oThe entity to be reset.
void OmegaEngine.Engine.Render ( )
inline

Renders all Views. Tracks elapsed game time automatically.

void OmegaEngine.Engine.Render ( double  elapsedGameTime,
bool  noPresent = false 
)
inline

Renders all Views. Uses external game time tracking.

Parameters
elapsedGameTimeHow many seconds of game time have elapsed since the last frame was drawn.
noPresenttrue to supress actually displaying the render output at the end.
void OmegaEngine.Engine.Screenshot ( string  filename)
inline

Saves the current screen at it's current resolution

Parameters
filenameThe file name to save the screenshot too
void OmegaEngine.Engine.Screenshot ( string  filename,
int  width,
int  height 
)
inline

Saves the current screen at a scaled resolution as JPG

Parameters
filenameThe file name to save the screenshot too
widthThe width to scale the resolution down too
heightThe height to scale the resolution down too
void OmegaEngine.Engine.Screenshot ( string  filename,
Size  size 
)
inline

Saves the current screen at a scaled resolution

Parameters
filenameThe file name to save the screenshot too
sizeThe size to scale the resolution down too
void OmegaEngine.Engine.SetupTextureFiltering ( )
inlinepackage

Apply texture filtering modes to Device.

Member Data Documentation

Version OmegaEngine.Engine.Version => Assembly.GetExecutingAssembly().GetName().Version
static

The version number of the engine.

ICollection<View> OmegaEngine.Engine.Views => _views

A list of all views to be rendered by the engine

Will be disposed when EngineElement.Dispose is called.

readonly HashSet<WaterViewSource> OmegaEngine.Engine.WaterViewSources = new HashSet<WaterViewSource>()
package

A list of possible Views usable for rendering Water

See Also
WaterViewSource.FromEngine

Property Documentation

bool OmegaEngine.Engine.Anisotropic
getset

Use anisotropic texture filtering

See Also
EngineCapabilities.Anisotropic
DirectSound OmegaEngine.Engine.AudioDevice
getset

The DirectSound device

Surface OmegaEngine.Engine.BackBuffer
getsetpackage

The BackBuffer the D3D Device renders onto

CacheManager OmegaEngine.Engine.Cache
get

The central cache used for all graphics and sound assets.

EngineCapabilities OmegaEngine.Engine.Capabilities
get

Methods for determining the rendering capabilities of the graphics hardware.

EngineConfig OmegaEngine.Engine.Config
getset

The settings the engine was initialized with.

Changing this will cause the engine to reset on the next Render() call

GeneralShader OmegaEngine.Engine.DefaultShader
getset

A shader used for default lighting

Device OmegaEngine.Engine.Device
getset

The Direct3D device. Use State instead of manipulating this directly when possible.

EngineEffects OmegaEngine.Engine.Effects
getset

Turn specific rendering effects in the engine on or off.

bool OmegaEngine.Engine.FadeExtra
getset

Is Engine.ExtraRender faded along with the scene?

int OmegaEngine.Engine.FadeLevel
getset

The level of scene fading from 0 (fully visible) to 255 (invisible).

double OmegaEngine.Engine.LastFrameGameTime
getset

How many seconds of game time have elapsed since the last frame started drawing.

MusicManager OmegaEngine.Engine.Music
getset

Controls the playback of music (theme-selection, cross-fading, etc.)

bool OmegaEngine.Engine.NeedsReset
getset

The engine will be reset on the next Render() call

Do not try to add new assets while this is true!

Just run Render() to fix the problem.

EnginePerformance OmegaEngine.Engine.Performance
get

Tracks the performance/speed of the engine.

PresentParameters OmegaEngine.Engine.PresentParams
getsetpackage

The PresentParameters auto-generated from Config

Size OmegaEngine.Engine.RenderSize
getset

The size of the render target

Viewport OmegaEngine.Engine.RenderViewport
getset

The viewport for the render target

CultureInfo OmegaEngine.Engine.ResourceCulture
staticgetset

The culture used for loading the assembly resources.

string OmegaEngine.Engine.ShaderDir
getset

The base directory where shader files are stored

WaterShader OmegaEngine.Engine.SimpleWaterShader
getpackage

A shader used for simple water (no reflection or refraction)

EngineState OmegaEngine.Engine.State
get

Used by Renderable implementations to manipulate the graphics render state. Should not be manipulated manually.

Control OmegaEngine.Engine.Target
get

The System.Windows.Forms.Control the engine draws onto.

double OmegaEngine.Engine.TotalGameTime
getset

How many seconds of game time have elapsed in total.

Event Documentation

Action OmegaEngine.Engine.DeviceLost

Occurs after the Device was lost. This usually happens when switching to or from fullscreen mode.

Action OmegaEngine.Engine.DeviceReset

Occurs after the Device was reset. This needs to be done to continue using it after DeviceLost.

Action OmegaEngine.Engine.ExtraRender

Allows the integration of external render processes at the end of the Engine's presentation scheme.

Action OmegaEngine.Engine.PostRender

Occurs once for every frame after rendering

Action OmegaEngine.Engine.PreRender

Occurs once for every frame before rendering.


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