Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.rico.engine.geometry
Class MeshContainer

    java.lang.Object
      de.rico.engine.geometry.MeshContainer

    public class MeshContainer

extends java.lang.Object

This class is a container for meshes. If a mesh get added to the container it gets sorted by its alpha value to allow correct blending.

Author:
  Frank Bruns

Constructor Summary
`MeshContainer()` Creates a new mesh container.

Method Summary
`void` | `add(AbstractMesh mesh)` Adds a mesh to the container.
`void` | `draw(javax.media.opengl.GL gl)` Draws the meshes in the container.
`void` | `drawGeometryBoundsToDepthBuffer(javax.media.opengl.GL gl)` This method draws the geometrys bounding volumes to the depth buffer.
`void` | `drawTransparent(javax.media.opengl.GL gl, float transparency)` Draws the meshes of the container with a global transparency value.
`void` | `drawWithShadowMap(javax.media.opengl.GL gl, PositionalLight light, int shadowTexSize, float fov, float range)` Deprecated. I don't recommend to use it, because it is pretty experimental
`void` | `drawWithShadowMatrix(javax.media.opengl.GL gl, PositionalLightIface light)` Draws the scene with shadow matrix shadows of the meshes in the container.
`java.util.List<BoundingSphere>` | `getBoundingSpheres()` Returns the bounding spheres of the meshes in the container that have a bounding sphere assigned to.
`AbstractMesh` | `getMeshByName(java.lang.String name)` Returns the mesh with the specified name.
`java.util.List<AbstractMesh>` | `getMeshes()` Returns the meshes of the mesh container
`void` | `remove(AbstractMesh mesh)` Removes the specified mesh from the container
`void` | `sortByAlpha()` Sorts the meshes in the mesh container by their tranparency value, i.e.
`void` | `sortByViewingDistance()` Sorts the meshes in the container according to their center points distance to the viewer (camera).
`void` | `update(long elapsedTime)` Updates the meshes in the container

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MeshContainer

    public MeshContainer()

  Creates a new mesh container. If a mesh get added to the container it gets sorted by its alpha value to allow correct blending.

Method Detail

### add

    public void add(AbstractMesh mesh)

  Adds a mesh to the container.

  Parameters:
    `mesh` - the mesh to add to the container

### remove

    public void remove(AbstractMesh mesh)

  Removes the specified mesh from the container

  Parameters:
    `mesh` - mesh to remove from the container

### getMeshes

    public java.util.List<AbstractMesh> getMeshes()

  Returns the meshes of the mesh container

  Returns:
    meshes of the mesh container

### getMeshByName

    public AbstractMesh getMeshByName(java.lang.String name)

  Returns the mesh with the specified name. If there are several meshes with the same name this method returns the first mesh which is found. If no mesh with the specified name is found it returns `null`.

  Parameters:
    `name` - name of the mesh to retrieve
  Returns:
    mesh with the specified name (first occurence!)

### getBoundingSpheres

    public java.util.List<BoundingSphere> getBoundingSpheres()

  Returns the bounding spheres of the meshes in the container that have a bounding sphere assigned to.

  Returns:
    available bounding spheres of the meshes

### sortByAlpha

    public void sortByAlpha()

  Sorts the meshes in the mesh container by their tranparency value, i.e. their (diffuse) material alpha value. This is important for correct display of transparent objects

### sortByViewingDistance

    public void sortByViewingDistance()

  Sorts the meshes in the container according to their center points distance to the viewer (camera).

### update

    public void update(long elapsedTime)

  Updates the meshes in the container

  Parameters:
    `elapsedTime` - time between two frames

### drawGeometryBoundsToDepthBuffer

    public void drawGeometryBoundsToDepthBuffer(javax.media.opengl.GL gl)

  This method draws the geometrys bounding volumes to the depth buffer. This can be used to init the depth buffer for occlusion culling. Everything that is not needed for drawing gets temporarily disabled.

  Parameters:
    `gl` -

### draw

    public void draw(javax.media.opengl.GL gl)

  Draws the meshes in the container.

  Parameters:
    `gl` -

### drawTransparent

    public void drawTransparent(javax.media.opengl.GL gl,
                                float transparency)

  Draws the meshes of the container with a global transparency value.

  Parameters:
    `gl` -
    `transparency` - transparency value [0..1]

### drawWithShadowMatrix

    public void drawWithShadowMatrix(javax.media.opengl.GL gl,
                                     PositionalLightIface light)

  Draws the scene with shadow matrix shadows of the meshes in the container. The shadow of a mesh can only be drawn, if it has a bounding volume assigned to it.

  Parameters:
    `gl` -
    `light` - reference light for drawing the shadows

### drawWithShadowMap

    @Deprecated
    public void drawWithShadowMap(javax.media.opengl.GL gl,
                                             PositionalLight light,
                                             int shadowTexSize,
                                             float fov,
                                             float range)

  Deprecated. I don't recommend to use it, because it is pretty experimental

  Draws the scene with shadow map shadowing technique. Note: right now transparent objects are not drawn correctly, when using this shadow technique

  Parameters:
    `gl` -
    `light` - reference light
    `shadowTexSize` - size of the shadow map texture (e.g. 512)
    `fov` - field of view of the shadow map
    `range` - range of the shadow (how far to cast the shadow?)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD