yaarq.sys
Class yrqBasicVisual

java.lang.Object
  |
  +--yaarq.sys.yrqVisual
        |
        +--yaarq.sys.yrqBasicVisual

public class yrqBasicVisual
extends yrqVisual

This class extends the yrqVisual class providing support for textured geometry.

The class enables all basic geometry and texture operations, combining Java3Ds shape3D, geometry and appearance model into one convenient encapsulation

Basic visuals are always added to yrqFrame instances, all their positioning and rotational properties are defined by the frame to which they are added. TODO: Nothing


Field Summary
 
Fields inherited from class yaarq.sys.yrqVisual
COLOR_AMBIENT, COLOR_DIFFUSE, COLOR_EMISSIVE, COLOR_SPECULAR, m_parent, MODE_ADD, MODE_BLEND, MODE_NONE, TEXTURE_DOT3BUMP, TEXTURE_LIGHTMAP, TEXTURE_MATERIAL, TEXTURE_REFLECT
 
Constructor Summary
yrqBasicVisual(javax.media.j3d.Geometry a_geometry, javax.media.j3d.Texture2D a_texMaterial, javax.media.j3d.Texture2D a_texLightMap, javax.media.j3d.Texture2D a_texBumpMap, javax.media.j3d.Texture2D a_texReflection, boolean a_enableLighting, int a_mode, float a_transparency, float a_shininess, float a_brightness)
          Constructs a new basic visual using passed parameters.
 
Method Summary
 javax.media.j3d.Geometry getGeometry()
          This method returns the geometry of the visual
 javax.media.j3d.Texture2D getTexture(int a_type)
          This function returns one of the textures used in the visual.
 int getTransparencyMode()
          Returns the transparency mode of the visual.
 float getTransparencyValue()
          Returns the transparency value for this visual.
 void setBrightness(float a_brightness)
          This method sets the material of the visual to a greyscale level having defined emissivity.
 void setColor(int a_type, javax.vecmath.Color3f a_color)
          This function allows setting a specified color component of the underlying material of the visual.
 void setGeometry(javax.media.j3d.Geometry a_geometry)
          This method sets the geometry of the visual and replaces any previous geometry present in the visual.
 void setShininess(float a_shininess)
          This method sets the material of the visual to a greyscale level having defined shininess, meaning specular and highlight components.
 void setTexture(int a_type, javax.media.j3d.Texture2D a_texture)
          This function sets one of the textures used in the visual.
 void setTextureAnimation(double a_left, double a_top, double a_width, double a_height)
          This function sets a continuous texture animation to the base material texture.
 void setTextureAnimation(int a_clipIndex, int a_clipCountX, int a_clipCountY)
          This function set a clip-based texture animation to the base material texture.
 void setTransparency(float a_alpha, int a_mode)
          Sets the transparency factor for the visual.
 
Methods inherited from class yaarq.sys.yrqVisual
attach, detach, getBaseShape3D, getBumpShape3D, getParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

yrqBasicVisual

public yrqBasicVisual(javax.media.j3d.Geometry a_geometry,
                      javax.media.j3d.Texture2D a_texMaterial,
                      javax.media.j3d.Texture2D a_texLightMap,
                      javax.media.j3d.Texture2D a_texBumpMap,
                      javax.media.j3d.Texture2D a_texReflection,
                      boolean a_enableLighting,
                      int a_mode,
                      float a_transparency,
                      float a_shininess,
                      float a_brightness)
Constructs a new basic visual using passed parameters. All parameters can be changed at runtime. Attach the visual to a frame by adding it to the frames child collection to make it visible in the scene.

Parameters:
a_geometry - The geometry to use in construction of the visual
a_texMaterial - The basic material texture
a_texLightMap - The lightmap texture to multiply with the material texture
a_texBumpMap - The bumpmap to apply
a_texReflection - The reflection map to apply
a_enableLighting - Flag for enabling per-vertex lighting calculation
a_mode - One of the MODE_xxx constants, sets the transparency mode for the visual
a_transparency - The alpha-transparency of the constructed visual, 0-1f
a_shininess - The specular and highlight of the constructed visual, 0-1f
a_brightness - The emissive component of the constructed visual, 0-1f
Method Detail

getGeometry

public javax.media.j3d.Geometry getGeometry()
This method returns the geometry of the visual

Overrides:
getGeometry in class yrqVisual
Returns:
The geometry used by the visual

getTexture

public javax.media.j3d.Texture2D getTexture(int a_type)
This function returns one of the textures used in the visual. Which texture to return is defined by one of the TEXTURE_XXX constants to be passed for the type parameter.

Overrides:
getTexture in class yrqVisual
Parameters:
a_type - The type of the texture to return. One of the TEXTURE_xxx constants
Returns:
The texture

getTransparencyMode

public int getTransparencyMode()
Returns the transparency mode of the visual. One of the MODE_xxx constants.

Overrides:
getTransparencyMode in class yrqVisual
Returns:
Global transparency value of the visual

getTransparencyValue

public float getTransparencyValue()
Returns the transparency value for this visual. Usage of this value is dependend on the transparency mode set for the visual.

Overrides:
getTransparencyValue in class yrqVisual
Returns:
Global transparency value of the visual

setBrightness

public void setBrightness(float a_brightness)
This method sets the material of the visual to a greyscale level having defined emissivity. Lighting is disabled. The method is provided for convenience, to allow setting fully textured visuals not needing any material color to a given level of emissive light.

The values set by the convenience methods setBrightness and setShininess are only valid until the next call to setColor. Setting individual color components of the visual overrides previous settings.

Overrides:
setBrightness in class yrqVisual
Parameters:
a_brightness - The brightness of the visual, 0-1f

setColor

public void setColor(int a_type,
                     javax.vecmath.Color3f a_color)
This function allows setting a specified color component of the underlying material of the visual. Pass one of the COLOR_xxx constants and a color value to set material color. This overrides settings for emissive and shininess until the next call to that methods.

Overrides:
setColor in class yrqVisual
Parameters:
a_type - Type of color to set. Must be one of the COLOR_xxx constants
a_color - The color to set

setGeometry

public void setGeometry(javax.media.j3d.Geometry a_geometry)
This method sets the geometry of the visual and replaces any previous geometry present in the visual.

Overrides:
setGeometry in class yrqVisual

setShininess

public void setShininess(float a_shininess)
This method sets the material of the visual to a greyscale level having defined shininess, meaning specular and highlight components. Lighting is enabled. The method is provided for convenience, to allow setting fully textured visuals not needing any material color to a given level of emissive light.

The values set by the convenience methods setBrightness and setShininess are only valid until the next call to setColor. Setting individual color components of the visual overrides previous settings.

Overrides:
setShininess in class yrqVisual
Parameters:
a_shininess - The shininess of the visual, 0-1f

setTexture

public void setTexture(int a_type,
                       javax.media.j3d.Texture2D a_texture)
This function sets one of the textures used in the visual. Which texture to set is defined by one of the TEXTURE_XXX constants to be passed for the type parameter. All texturing states are adjusted automatically when this function is called.

Overrides:
setTexture in class yrqVisual
Parameters:
a_type - The type of the texture to set. One of the TEXTURE_xxx constants
a_texture - The texture to set

setTextureAnimation

public void setTextureAnimation(double a_left,
                                double a_top,
                                double a_width,
                                double a_height)
This function sets a continuous texture animation to the base material texture. Use it to set the base material texture to any position in a (0,1) normalized frame of reference.

Overrides:
setTextureAnimation in class yrqVisual
Parameters:
a_left - Left clip position, normalized (0-1)
a_top - Top clip position, normalized (0-1)
a_width - Width of clip to use, normalized (0-1)
a_height - Height of clip to use, normalized (0-1)

setTextureAnimation

public void setTextureAnimation(int a_clipIndex,
                                int a_clipCountX,
                                int a_clipCountY)
This function set a clip-based texture animation to the base material texture. Use it to set the base material texture to a clip indexed by the index parameter in a rectangular tiling clip starting top/left in the texture, having the provided number of clips in the x (left) and y(top) direction.

Overrides:
setTextureAnimation in class yrqVisual
Parameters:
a_clipIndex - Index of the clip within the texture
a_clipCountX - Number of clips in X direction
a_clipCountY - Number of clips in Y direction

setTransparency

public void setTransparency(float a_alpha,
                            int a_mode)
Sets the transparency factor for the visual. Transparency can be additive, blended or disabled, pass one of the MODE_xxx constants as the mode parameter to switch modes.

Overrides:
setTransparency in class yrqVisual
Parameters:
a_alpha - Global transparency factor for this visual
a_mode - Transparency mode for this visual