yaarq.sys
Class yrqRepository

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

public class yrqRepository
extends java.lang.Object

This class serves as a repository for all ressources used during an engine session. It provides functionallity for loading and managing textures, images, sounds and geometry. For each of the object types that can be stored in the repository, various loading options allow to do adjust the objects to the needs of the 3D world to be build.

Applications should fill the repository during the engineLoadCallback callback function. All necessary internal objects have been allocated at that time, while no rendering is being done during this call. Typically, applications would start a thread displaying some kind of loader screen, then fill the repository by using the load calls, and terminate the loader screen afterwards, doing all this within the engineLoadCallback. Applications can store frames not immediately needed in the eninge within the repository. Only root frames can be attached and detached during runtime, so applications need to make sure that frames retrieved from the repository are only added to the engine, using the addFrame method, at runtime.

TODO: Provide more options for geometry, Implement support for visuals, complete documentation


Field Summary
static int OPTION_GEOMETRY_DEFAULT
          Mesh load option: Use default settings
static int OPTION_IMAGE_DEFAULT
          Image load option: Use default settings.
static int OPTION_SOUND_BUFFER
          Sound load option: Use buffer (looping)
static int OPTION_SOUND_DEFAULT
          Sound load option: Use default settings
static int OPTION_TEXTURE_ALPHABLEND
          Texture load option: Generate an alphachannel by averaging the rgb color values in the texture
static int OPTION_TEXTURE_ALPHAMASK
          Texture load option: Generate an alphachannel for masking if r, g and b <8 then alpha will be set to translucent else alpha will be fully opaque
static int OPTION_TEXTURE_BUMPMAP
          Texture load option: Process the texture into a dot3 bumpmap after loading This includes rescaling texture values and filtering the map by replacing each pixel value (x/y) with ((x+1)-(x))/((y+1)-(y)
static int OPTION_TEXTURE_DEFAULT
          Texture load option: Use default settings
static int OPTION_TEXTURE_LIGHTMAP
          Texture load option: Process the texture into a lightmap by averaging all rgb values in the image into a single alpha channel
 
Constructor Summary
yrqRepository(yrqEngine a_engine)
          Constructs a new repository instance.
 
Method Summary
 void addFrame(java.lang.String a_name, yrqFrame a_frame)
          This method adds a frame to the repository under a given name.
 void addGeometry(java.lang.String a_name, java.lang.String a_file, int a_options)
          This method adds a geomtry to the repository under a given name, loading it from the given file and processing it according to the options provided.
 void addImage(java.lang.String a_name, java.lang.String a_file, int a_options)
          This method adds an image to the repository under a given name, loading it from the given file and processing it according to the options provided.
 void addSound(java.lang.String a_name, java.lang.String a_file, int a_options)
          This method adds a sound to the repository under a given name, loading it from the given file and processing it according to the options provided.
 void addTexture(java.lang.String a_name, java.lang.String a_file, int a_options)
          This method adds a texture to the repository under a given name, loading it from the given file and processing it according to the options provided.
 yrqFrame getFrame(java.lang.String a_name)
          This function retrieves a frame stored in the repository by name
 javax.media.j3d.Geometry getGeometry(java.lang.String a_name)
          This function retrieves a geometry stored in the repository by name
 java.awt.image.BufferedImage getImage(java.lang.String a_name)
          This function retrieves an image stored in the repository by name
 javax.media.j3d.MediaContainer getSound(java.lang.String a_name)
          This function retrieves a sound stored in the repository by name
 javax.media.j3d.Texture2D getTexture(java.lang.String a_name)
          This function retrieves a texture stored in the repository by name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTION_GEOMETRY_DEFAULT

public static final int OPTION_GEOMETRY_DEFAULT
Mesh load option: Use default settings

See Also:
Constant Field Values

OPTION_IMAGE_DEFAULT

public static final int OPTION_IMAGE_DEFAULT
Image load option: Use default settings.

See Also:
Constant Field Values

OPTION_SOUND_BUFFER

public static final int OPTION_SOUND_BUFFER
Sound load option: Use buffer (looping)

See Also:
Constant Field Values

OPTION_SOUND_DEFAULT

public static final int OPTION_SOUND_DEFAULT
Sound load option: Use default settings

See Also:
Constant Field Values

OPTION_TEXTURE_ALPHABLEND

public static final int OPTION_TEXTURE_ALPHABLEND
Texture load option: Generate an alphachannel by averaging the rgb color values in the texture

See Also:
Constant Field Values

OPTION_TEXTURE_ALPHAMASK

public static final int OPTION_TEXTURE_ALPHAMASK
Texture load option: Generate an alphachannel for masking if r, g and b <8 then alpha will be set to translucent else alpha will be fully opaque

See Also:
Constant Field Values

OPTION_TEXTURE_BUMPMAP

public static final int OPTION_TEXTURE_BUMPMAP
Texture load option: Process the texture into a dot3 bumpmap after loading This includes rescaling texture values and filtering the map by replacing each pixel value (x/y) with ((x+1)-(x))/((y+1)-(y)

See Also:
Constant Field Values

OPTION_TEXTURE_DEFAULT

public static final int OPTION_TEXTURE_DEFAULT
Texture load option: Use default settings

See Also:
Constant Field Values

OPTION_TEXTURE_LIGHTMAP

public static final int OPTION_TEXTURE_LIGHTMAP
Texture load option: Process the texture into a lightmap by averaging all rgb values in the image into a single alpha channel

See Also:
Constant Field Values
Constructor Detail

yrqRepository

public yrqRepository(yrqEngine a_engine)
Constructs a new repository instance. Applications should not create instances of the repository, the engine automatically create an instance at initialisation.

Parameters:
a_engine - The class instance owning this instance
Method Detail

addFrame

public void addFrame(java.lang.String a_name,
                     yrqFrame a_frame)
This method adds a frame to the repository under a given name.

Parameters:
a_name - The name of the object within the repository, must be unique
a_frame - The frame to add

addGeometry

public void addGeometry(java.lang.String a_name,
                        java.lang.String a_file,
                        int a_options)
This method adds a geomtry to the repository under a given name, loading it from the given file and processing it according to the options provided.

Parameters:
a_name - The name of the object within the repository, must be unique
a_file - The file, with path relative to application, from which to load the object
a_options - Options for loading this object, one of the OPTION_MESH_xxx constants

addImage

public void addImage(java.lang.String a_name,
                     java.lang.String a_file,
                     int a_options)
This method adds an image to the repository under a given name, loading it from the given file and processing it according to the options provided.

This method is currently not implemented

Parameters:
a_name - The name of the object within the repository, must be unique
a_file - The file, with path relative to application, from which to load the object
a_options - Options for loading this object, one of the OPTION_IMAGE_xxx constants

addSound

public void addSound(java.lang.String a_name,
                     java.lang.String a_file,
                     int a_options)
This method adds a sound to the repository under a given name, loading it from the given file and processing it according to the options provided.

Parameters:
a_name - The name of the object within the repository, must be unique
a_file - The file, with path relative to application, from which to load the object
a_options - Options for loading this object, one of the OPTION_SOUND_xxx constants

addTexture

public void addTexture(java.lang.String a_name,
                       java.lang.String a_file,
                       int a_options)
This method adds a texture to the repository under a given name, loading it from the given file and processing it according to the options provided.

Parameters:
a_name - The name of the object within the repository, must be unique
a_file - The file, with path relative to application, from which to load the object
a_options - Options for loading this object, one of the OPTION_TEXTURE_xxx constants

getFrame

public yrqFrame getFrame(java.lang.String a_name)
This function retrieves a frame stored in the repository by name

Parameters:
a_name - The name of the object within the repository
Returns:
The associated object or null if the name was invalid

getGeometry

public javax.media.j3d.Geometry getGeometry(java.lang.String a_name)
This function retrieves a geometry stored in the repository by name

Parameters:
a_name - The name of the object within the repository
Returns:
The associated object or null if the name was invalid

getImage

public java.awt.image.BufferedImage getImage(java.lang.String a_name)
This function retrieves an image stored in the repository by name

Parameters:
a_name - The name of the object within the repository
Returns:
The associated object or null if the name was invalid

getSound

public javax.media.j3d.MediaContainer getSound(java.lang.String a_name)
This function retrieves a sound stored in the repository by name

Parameters:
a_name - The name of the object within the repository
Returns:
The associated object or null if the name was invalid

getTexture

public javax.media.j3d.Texture2D getTexture(java.lang.String a_name)
This function retrieves a texture stored in the repository by name

Parameters:
a_name - The name of the object within the repository
Returns:
The associated object or null if the name was invalid