yaarq.sys
Class yrqEngine

java.lang.Object
  |
  +--yaarq.sys.yrqEngine

public final class yrqEngine
extends java.lang.Object

This class is the main class of the Yaarq engine. It provides support for instantiating and accessing all subclasses, for intialisation of the Java3D environment and the scene graph, and it allows applications to interact with it through a number of callback functions.

The engine class is self-contained, to use it applications just have to declare a new instance of it passing themselves as the parenting instance. All other operations will be done by the engine via the callback functions defined in the yrqApplication interface.

TODO: Nothing


Constructor Summary
yrqEngine(yrqApplication a_application)
          Creates an instance of the engine.
 
Method Summary
 void addFrame(java.lang.String a_name, yrqFrame a_frame)
          This function adds a new root frame to the engines map of frames.
 void clearFrames()
          This method clears all frames from the frame hierarchy, detaching them in the process.
 yrqApplication getApplication()
          This function retrieves the yrqApplication instance encapsuling the engine for purpose of callback issuing by subordinate classes.
 yrqCanvas getCanvas()
          This function returns the canvas instance used by the engine
 java.awt.Component getComponent()
          Returns the component the engine is attached to.
 yrqEnviron getEnviron()
          This function retrieves the environ subclass instance used by the engine to manage environmental effects.
 yrqFrame getFrame(java.lang.String a_name)
          This function retrieves one of the frames stored in the engines internal frame map by its name.
 long getFrameCount()
          This function retrieves the current absolute number of frames which have elapsed since starting the engine.
 long getFrameRate()
          This function retrieves the current fps rate which is measured in the internal frame-based update loop of the yrqEngine instance.
 yrqRepository getRepository()
          This function retrieves the repository subclass instance used by the engine to keep low-level objects like textures and sounds.
 javax.media.j3d.BranchGroup getRoot()
          This function retrieves the root branch group of the engine, to which all other sub-instance branch groups are childed
 yrqViewport getViewport()
          This function returns the viewport instance used by the engine
 void removeFrame(java.lang.String a_name)
          This function removes a frame from the engines internal map of root frames by name.
 void removeFrame(yrqFrame a_frame)
          This function removes a frame from the engines internal map of root frames by reference.
 void update()
          This method is an implementation of the yrqUpdatable interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

yrqEngine

public yrqEngine(yrqApplication a_application)
Creates an instance of the engine. Only one instance is needed by an application. The application instantiating the engine does not need to remember a reference to it, the engine will callback the application.

Parameters:
a_application - The application which wishes to instantiate the class
Method Detail

addFrame

public void addFrame(java.lang.String a_name,
                     yrqFrame a_frame)
This function adds a new root frame to the engines map of frames. Root frames are immediately attached to the engine root. Objects consisting of a frame hierarchy are built from a root frame on, which is added to the engine to enable the whole object.

Parameters:
a_name - The name under which to add the frame
a_frame - The frame instance to add.

clearFrames

public void clearFrames()
This method clears all frames from the frame hierarchy, detaching them in the process.


getApplication

public yrqApplication getApplication()
This function retrieves the yrqApplication instance encapsuling the engine for purpose of callback issuing by subordinate classes.

Returns:
The yrqApplication instance associated with this engine instance

getCanvas

public yrqCanvas getCanvas()
This function returns the canvas instance used by the engine

Returns:
the engines canvas instance

getComponent

public java.awt.Component getComponent()
Returns the component the engine is attached to. Filled through a single component request to the application at init time.

Returns:
Component the engine is rendering into

getEnviron

public yrqEnviron getEnviron()
This function retrieves the environ subclass instance used by the engine to manage environmental effects.

Returns:
The instance of the environ class
See Also:
yrqEnviron

getFrame

public yrqFrame getFrame(java.lang.String a_name)
This function retrieves one of the frames stored in the engines internal frame map by its name.

Parameters:
a_name - The name of the frame
Returns:
The desired frame or null if no frame is found under the given name

getFrameCount

public long getFrameCount()
This function retrieves the current absolute number of frames which have elapsed since starting the engine.

Returns:
The current absolute framecount

getFrameRate

public long getFrameRate()
This function retrieves the current fps rate which is measured in the internal frame-based update loop of the yrqEngine instance.

Returns:
The current frame-rate per second value

getRepository

public yrqRepository getRepository()
This function retrieves the repository subclass instance used by the engine to keep low-level objects like textures and sounds.

Returns:
The repository used by the engine
See Also:
yrqRepository

getRoot

public javax.media.j3d.BranchGroup getRoot()
This function retrieves the root branch group of the engine, to which all other sub-instance branch groups are childed

Returns:
The root branch group of the engine instance

getViewport

public yrqViewport getViewport()
This function returns the viewport instance used by the engine

Returns:
the engines viewport instance

removeFrame

public void removeFrame(java.lang.String a_name)
This function removes a frame from the engines internal map of root frames by name. The frame is automatically detached from the scene graph.

Parameters:
a_name - the name of the frame to be removed.

removeFrame

public void removeFrame(yrqFrame a_frame)
This function removes a frame from the engines internal map of root frames by reference. The frame is automatically detached from the scene graph.

Parameters:
a_frame - the frame to be removed.

update

public void update()
This method is an implementation of the yrqUpdatable interface. The yrqEngine instance creates a yrqUpdater instance which calls this method before every frame. All subclass instances needing constant updating are updated from this method. In addition, a callback to the application is issued.

See Also:
yrqUpdatable, yrqApplication