C# Class Axiom.Core.Root

The Engine class is the main container of all the subsystems. This includes the RenderSystem, various ResourceManagers, etc.
Inheritance: IDisposable
显示文件 Open project: WolfgangSt/axiom Class Usage Examples

Public Methods

Method Description
AddMovableObjectFactory ( MovableObjectFactory fact, bool overrideExisting ) : void

Register a new MovableObjectFactory which will create new MovableObject instances of a particular type, as identified by the Type property.

Plugin creators can create subclasses of MovableObjectFactory which construct custom subclasses of MovableObject for insertion in the scene. This is the primary way that plugins can make custom objects available.

AddSceneManagerFactory ( SceneManagerFactory factory ) : void

Registers a new SceneManagerFactory, a factory object for creating instances of specific SceneManagers.

Plugins should call this to register as new SceneManager providers.

ConvertColor ( ColorEx color ) : int

Asks the current API to convert an instance of ColorEx to a 4 byte packed int value the way it would expect it.

CreateRenderWindow ( string name, int width, int height, bool isFullScreen ) : Axiom.Graphics.RenderWindow

Overloaded method.

CreateRenderWindow ( string name, int width, int height, bool isFullscreen, NamedParameterList miscParams ) : Axiom.Graphics.RenderWindow

A collection of addition render system specific options.

CreateSceneManager ( SceneType sceneType ) : SceneManager

Creates a SceneManager instance based on scene type support.

Creates an instance of a SceneManager which supports the scene types identified in the parameter. If more than one type of SceneManager has been registered as handling that combination of scene types, in instance of the last one registered is returned.

CreateSceneManager ( SceneType sceneType, string instanceName ) : SceneManager

Creates a SceneManager instance based on scene type support.

Creates an instance of a SceneManager which supports the scene types identified in the parameter. If more than one type of SceneManager has been registered as handling that combination of scene types, in instance of the last one registered is returned.

CreateSceneManager ( string typeName ) : SceneManager

Creates a SceneManager instance of a given type.

You can use this method to create a SceneManager instance of a given specific type. You may know this type already, or you may have discovered it by looking at the results from Root.GetSceneManagerMetaData.

CreateSceneManager ( string typeName, string instanceName ) : SceneManager

Creates a SceneManager instance of a given type.

You can use this method to create a SceneManager instance of a given specific type. You may know this type already, or you may have discovered it by looking at the results from Root.GetSceneManagerMetaData.

DestroySceneManager ( SceneManager instance ) : void

Destroys an instance of a SceneManager.

DetachRenderTarget ( RenderTarget target ) : void

Dispose ( ) : void

Called to shutdown the engine and dispose of all it's resources.

GetMovableObjectFactory ( string typeName ) : MovableObjectFactory

Get a MovableObjectFactory for the given type.

GetSceneManager ( string instanceName ) : SceneManager

Gets an existing SceneManager instance that has already been created, identified by the instance name.

GetSceneManagerMetaData ( string typeName ) : SceneManagerMetaData

Gets more information about a given type of SceneManager.

The metadata returned tells you a few things about a given type of SceneManager, which can be created using a factory that has been registered already.

HasMovableObjectFactory ( string typeName ) : bool

Checks whether a factory is registered for a given MovableObject type

Initialize ( bool autoCreateWindow ) : Axiom.Graphics.RenderWindow

Initializes the renderer.

This method can only be called after a renderer has been selected with Root.RenderSystem, and it will initialize the selected rendering system ready for use.

Initialize ( bool autoCreateWindow, string windowTitle ) : Axiom.Graphics.RenderWindow

Initializes the renderer.

This method can only be called after a renderer has been selected with Root.RenderSystem, and it will initialize the selected rendering system ready for use.

NextMovableObjectTypeFlag ( ) : uint

Allocate and retrieve the next MovableObject type flag.

This is done automatically if MovableObjectFactory.RequestTypeFlags returns true; don't call this manually unless you're sure you need to.

OnFrameEnded ( ) : bool

Method for raising frame ended events.

This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you should call this method to ensure that FrameEvent handlers are notified of frame events; processes like texture animation and particle systems rely on this.

This method calculates the frame timing information for you based on the elapsed time. If you want to specify elapsed times yourself you should call the other version of this method which takes event details as a parameter.

OnFrameEnded ( FrameEventArgs e ) : bool

Method for raising frame ended events.

This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you should call this method to ensure that FrameEvent handlers are notified of frame events; processes like texture animation and particle systems rely on this.

This method takes an event object as a parameter, so you can specify the times yourself. If you are happy for the engine to automatically calculate the frame time for you, then call the other version of this method with no parameters.

OnFrameRenderingQueued ( ) : bool

Method for raising frame rendering queued events.

This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you you may want to call this method too, although nothing in Axiom relies on this particular event. Really if you're running your own rendering loop at this level of detail then you can get the same effect as doing your updates in a OnFrameRenderingQueued event by just calling with the 'swapBuffers' option set to false.

OnFrameRenderingQueued ( FrameEventArgs e ) : bool

Method for raising frame rendering queued events.

This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you you may want to call this method too, although nothing in Axiom relies on this particular event. Really if you're running your own rendering loop at this level of detail then you can get the same effect as doing your updates in a OnFrameRenderingQueued event by just calling with the 'swapBuffers' option set to false.

OnFrameStarted ( ) : bool

Method for raising frame started events.

This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you should call this method to ensure that FrameEvent handlers are notified of frame events; processes like texture animation and particle systems rely on this.

This method calculates the frame timing information for you based on the elapsed time. If you want to specify elapsed times yourself you should call the other version of this method which takes event details as a parameter.

OnFrameStarted ( FrameEventArgs e ) : bool

Method for raising frame started events.

This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you should call this method to ensure that FrameEvent handlers are notified of frame events; processes like texture animation and particle systems rely on this.

This method takes an event object as a parameter, so you can specify the times yourself. If you are happy for the engine to automatically calculate the frame time for you, then call the other version of this method with no parameters.

QueueEndRendering ( ) : void

Requests that the rendering engine shutdown at the beginning of the next frame.

RemoveMovableObjectFactory ( MovableObjectFactory fact ) : void

Removes a previously registered MovableObjectFactory.

All instances of objects created by this factory will be destroyed before removing the factory (by calling back the factories 'DestroyInstance' method). The plugin writer is responsible for actually destroying the factory.

RemoveSceneManagerFactory ( SceneManagerFactory factory ) : void

Unregisters a SceneManagerFactory.

RenderOneFrame ( ) : bool

Renders one frame.

Updates all the render targets automatically and then returns, raising frame events before and after.

Root ( ) : System

Constructor.

This public contructor is intended for the user to decide when the Root object gets instantiated. This is a critical step in preparing the engine for use.

Root ( string logFilename ) : System

Constructor.

This public contructor is intended for the user to decide when the Root object gets instantiated. This is a critical step in preparing the engine for use.

Shutdown ( ) : void

Shuts down the engine and unloads plugins.

StartRendering ( ) : void

Starts the default rendering loop.

UpdateAllRenderTargets ( ) : bool

Internal method used for updating all RenderTarget objects (windows, renderable textures etc) which are set to auto-update.

You don't need to use this method if you're using Axiom's own internal rendering loop (Root.StartRendering). If you're running your own loop you may wish to call it to update all the render targets which are set to auto update (RenderTarget.IsAutoUpdated). You can also update individual RenderTarget instances using their own Update() method.

Private Methods

Method Description
CalculateEventTime ( long time, FrameEventType type ) : float

Internal method for calculating the average time between recently fired events.

CaptureCurrentTime ( ) : long
OneTimePostWindowInit ( ) : void

Internal method for one-time tasks after first window creation.

Method Details

AddMovableObjectFactory() public method

Register a new MovableObjectFactory which will create new MovableObject instances of a particular type, as identified by the Type property.
Plugin creators can create subclasses of MovableObjectFactory which construct custom subclasses of MovableObject for insertion in the scene. This is the primary way that plugins can make custom objects available.
public AddMovableObjectFactory ( MovableObjectFactory fact, bool overrideExisting ) : void
fact MovableObjectFactory /// The factory instance. ///
overrideExisting bool /// Set this to true to override any existing /// factories which are registered for the same type. You should only /// change this if you are very sure you know what you're doing. ///
return void

AddSceneManagerFactory() public method

Registers a new SceneManagerFactory, a factory object for creating instances of specific SceneManagers.
Plugins should call this to register as new SceneManager providers.
public AddSceneManagerFactory ( SceneManagerFactory factory ) : void
factory SceneManagerFactory
return void

ConvertColor() public method

Asks the current API to convert an instance of ColorEx to a 4 byte packed int value the way it would expect it.
public ConvertColor ( ColorEx color ) : int
color ColorEx
return int

CreateRenderWindow() public method

Overloaded method.
public CreateRenderWindow ( string name, int width, int height, bool isFullScreen ) : Axiom.Graphics.RenderWindow
name string
width int
height int
isFullScreen bool
return Axiom.Graphics.RenderWindow

CreateRenderWindow() public method

A collection of addition render system specific options.
public CreateRenderWindow ( string name, int width, int height, bool isFullscreen, NamedParameterList miscParams ) : Axiom.Graphics.RenderWindow
name string
width int
height int
isFullscreen bool
miscParams NamedParameterList
return Axiom.Graphics.RenderWindow

CreateSceneManager() public method

Creates a SceneManager instance based on scene type support.
Creates an instance of a SceneManager which supports the scene types identified in the parameter. If more than one type of SceneManager has been registered as handling that combination of scene types, in instance of the last one registered is returned.
public CreateSceneManager ( SceneType sceneType ) : SceneManager
sceneType SceneType A mask containing one or more flags.
return SceneManager

CreateSceneManager() public method

Creates a SceneManager instance based on scene type support.
Creates an instance of a SceneManager which supports the scene types identified in the parameter. If more than one type of SceneManager has been registered as handling that combination of scene types, in instance of the last one registered is returned.
public CreateSceneManager ( SceneType sceneType, string instanceName ) : SceneManager
sceneType SceneType A mask containing one or more flags.
instanceName string /// Optional name to given the new instance that is /// created. If you leave this blank, an auto name will be assigned. ///
return SceneManager

CreateSceneManager() public method

Creates a SceneManager instance of a given type.
You can use this method to create a SceneManager instance of a given specific type. You may know this type already, or you may have discovered it by looking at the results from Root.GetSceneManagerMetaData.
public CreateSceneManager ( string typeName ) : SceneManager
typeName string String identifying a unique SceneManager type.
return SceneManager

CreateSceneManager() public method

Creates a SceneManager instance of a given type.
You can use this method to create a SceneManager instance of a given specific type. You may know this type already, or you may have discovered it by looking at the results from Root.GetSceneManagerMetaData.
public CreateSceneManager ( string typeName, string instanceName ) : SceneManager
typeName string String identifying a unique SceneManager type.
instanceName string /// Optional name to given the new instance that is created. /// If you leave this blank, an auto name will be assigned. ///
return SceneManager

DestroySceneManager() public method

Destroys an instance of a SceneManager.
public DestroySceneManager ( SceneManager instance ) : void
instance SceneManager
return void

DetachRenderTarget() public method

public DetachRenderTarget ( RenderTarget target ) : void
target Axiom.Graphics.RenderTarget
return void

Dispose() public method

Called to shutdown the engine and dispose of all it's resources.
public Dispose ( ) : void
return void

GetMovableObjectFactory() public method

Get a MovableObjectFactory for the given type.
public GetMovableObjectFactory ( string typeName ) : MovableObjectFactory
typeName string /// The factory type to obtain. ///
return MovableObjectFactory

GetSceneManager() public method

Gets an existing SceneManager instance that has already been created, identified by the instance name.
public GetSceneManager ( string instanceName ) : SceneManager
instanceName string The name of the instance to retrieve.
return SceneManager

GetSceneManagerMetaData() public method

Gets more information about a given type of SceneManager.
The metadata returned tells you a few things about a given type of SceneManager, which can be created using a factory that has been registered already.
public GetSceneManagerMetaData ( string typeName ) : SceneManagerMetaData
typeName string /// The type name of the SceneManager you want to enquire on. /// If you don't know the typeName already, you can iterate over the /// metadata for all types using getMetaDataIterator. ///
return SceneManagerMetaData

HasMovableObjectFactory() public method

Checks whether a factory is registered for a given MovableObject type
public HasMovableObjectFactory ( string typeName ) : bool
typeName string /// The factory type to check for. ///
return bool

Initialize() public method

Initializes the renderer.
This method can only be called after a renderer has been selected with Root.RenderSystem, and it will initialize the selected rendering system ready for use.
public Initialize ( bool autoCreateWindow ) : Axiom.Graphics.RenderWindow
autoCreateWindow bool /// If true, a rendering window will automatically be created. The window will be /// created based on the options currently set on the render system. ///
return Axiom.Graphics.RenderWindow

Initialize() public method

Initializes the renderer.
This method can only be called after a renderer has been selected with Root.RenderSystem, and it will initialize the selected rendering system ready for use.
public Initialize ( bool autoCreateWindow, string windowTitle ) : Axiom.Graphics.RenderWindow
autoCreateWindow bool /// If true, a rendering window will automatically be created The window will be /// created based on the options currently set on the render system. ///
windowTitle string Title to use by the window.
return Axiom.Graphics.RenderWindow

NextMovableObjectTypeFlag() public method

Allocate and retrieve the next MovableObject type flag.
This is done automatically if MovableObjectFactory.RequestTypeFlags returns true; don't call this manually unless you're sure you need to.
public NextMovableObjectTypeFlag ( ) : uint
return uint

OnFrameEnded() public method

Method for raising frame ended events.
This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you should call this method to ensure that FrameEvent handlers are notified of frame events; processes like texture animation and particle systems rely on this.

This method calculates the frame timing information for you based on the elapsed time. If you want to specify elapsed times yourself you should call the other version of this method which takes event details as a parameter.

public OnFrameEnded ( ) : bool
return bool

OnFrameEnded() public method

Method for raising frame ended events.
This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you should call this method to ensure that FrameEvent handlers are notified of frame events; processes like texture animation and particle systems rely on this.

This method takes an event object as a parameter, so you can specify the times yourself. If you are happy for the engine to automatically calculate the frame time for you, then call the other version of this method with no parameters.

public OnFrameEnded ( FrameEventArgs e ) : bool
e FrameEventArgs /// Event object which includes all the timing information which must already be /// calculated. RequestShutdown should be checked after each call, because that means /// an event handler is requesting that shudown begin for one reason or another. ///
return bool

OnFrameRenderingQueued() public method

Method for raising frame rendering queued events.
This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you you may want to call this method too, although nothing in Axiom relies on this particular event. Really if you're running your own rendering loop at this level of detail then you can get the same effect as doing your updates in a OnFrameRenderingQueued event by just calling with the 'swapBuffers' option set to false.
public OnFrameRenderingQueued ( ) : bool
return bool

OnFrameRenderingQueued() public method

Method for raising frame rendering queued events.
This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you you may want to call this method too, although nothing in Axiom relies on this particular event. Really if you're running your own rendering loop at this level of detail then you can get the same effect as doing your updates in a OnFrameRenderingQueued event by just calling with the 'swapBuffers' option set to false.
public OnFrameRenderingQueued ( FrameEventArgs e ) : bool
e FrameEventArgs
return bool

OnFrameStarted() public method

Method for raising frame started events.
This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you should call this method to ensure that FrameEvent handlers are notified of frame events; processes like texture animation and particle systems rely on this.

This method calculates the frame timing information for you based on the elapsed time. If you want to specify elapsed times yourself you should call the other version of this method which takes event details as a parameter.

public OnFrameStarted ( ) : bool
return bool

OnFrameStarted() public method

Method for raising frame started events.
This method is only for internal use when you use the built-in rendering loop (Root.StartRendering). However, if you run your own rendering loop then you should call this method to ensure that FrameEvent handlers are notified of frame events; processes like texture animation and particle systems rely on this.

This method takes an event object as a parameter, so you can specify the times yourself. If you are happy for the engine to automatically calculate the frame time for you, then call the other version of this method with no parameters.

public OnFrameStarted ( FrameEventArgs e ) : bool
e FrameEventArgs /// Event object which includes all the timing information which must already be /// calculated. RequestShutdown should be checked after each call, because that means /// an event handler is requesting that shudown begin for one reason or another. ///
return bool

QueueEndRendering() public method

Requests that the rendering engine shutdown at the beginning of the next frame.
public QueueEndRendering ( ) : void
return void

RemoveMovableObjectFactory() public method

Removes a previously registered MovableObjectFactory.
All instances of objects created by this factory will be destroyed before removing the factory (by calling back the factories 'DestroyInstance' method). The plugin writer is responsible for actually destroying the factory.
public RemoveMovableObjectFactory ( MovableObjectFactory fact ) : void
fact MovableObjectFactory The instance to remove.
return void

RemoveSceneManagerFactory() public method

Unregisters a SceneManagerFactory.
public RemoveSceneManagerFactory ( SceneManagerFactory factory ) : void
factory SceneManagerFactory
return void

RenderOneFrame() public method

Renders one frame.
Updates all the render targets automatically and then returns, raising frame events before and after.
public RenderOneFrame ( ) : bool
return bool

Root() public method

Constructor.
This public contructor is intended for the user to decide when the Root object gets instantiated. This is a critical step in preparing the engine for use.
public Root ( ) : System
return System

Root() public method

Constructor.
This public contructor is intended for the user to decide when the Root object gets instantiated. This is a critical step in preparing the engine for use.
public Root ( string logFilename ) : System
logFilename string Name of the default log file.
return System

Shutdown() public method

Shuts down the engine and unloads plugins.
public Shutdown ( ) : void
return void

StartRendering() public method

Starts the default rendering loop.
public StartRendering ( ) : void
return void

UpdateAllRenderTargets() public method

Internal method used for updating all RenderTarget objects (windows, renderable textures etc) which are set to auto-update.
You don't need to use this method if you're using Axiom's own internal rendering loop (Root.StartRendering). If you're running your own loop you may wish to call it to update all the render targets which are set to auto update (RenderTarget.IsAutoUpdated). You can also update individual RenderTarget instances using their own Update() method.
public UpdateAllRenderTargets ( ) : bool
return bool