simogl.level
Class Terrain

java.lang.Object
  extended by simogl.geometry.AbstractMesh
      extended by simogl.geometry.MeshDL
          extended by simogl.level.Terrain

public class Terrain
extends MeshDL

This class represents a world's terrain, that is generated from a height map file.

Author:
Frank Bruns

Constructor Summary
Terrain(javax.media.opengl.GL gl, java.io.File file, int mapSize, int resFactor)
          Creates a new height map of the specified file with the specified height map rendering resolution factor.
 
Method Summary
 int getResolution()
          Returns the resolution factor of the terrain.
 
Methods inherited from class simogl.geometry.MeshDL
createDisplayList, deleteMesh, draw, getMeshID, setMeshID, specializedDraw
 
Methods inherited from class simogl.geometry.AbstractMesh
addFace, disableRenderOptions, drawShadow, enableRenderOptions, getBoundingBox, getFaces, getMaterial, getPosition, getPositionX, getPositionY, getPositionZ, getRoationX, getRoationY, getRoationZ, getRotation, getTexture, isTransparent, performTransformations, rotate, rotateAxxisX, rotateAxxisY, rotateAxxisZ, scale, setDrawShadow, setEnabledFaceCulling, setMaterial, setPosition, setPosition, setPositionX, setPositionY, setPositionZ, setTexture, setTransparent, showBoundingBox, showWireFrame
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Terrain

public Terrain(javax.media.opengl.GL gl,
               java.io.File file,
               int mapSize,
               int resFactor)
Creates a new height map of the specified file with the specified height map rendering resolution factor. The smaller the value for the resolution factor, the more precisely the height map image is being processed, resulting in a terrain with more triangles, i.e. a smoother look.
Note: Please only use image files with a power of 2 resolution and confirm that image height and width are both equal.
Furthermore, please avoid very small values like 1,2,3 or 4 as resFactor. They have a remarkably negative effect on performance and can cause an out of memory exception, too. A good value to start with would be 16 or 32.

Parameters:
gl -
file - file that contains the height map data
mapSize - pixel width/height of the height map image
resFactor - height map rendering resolution factor
Method Detail

getResolution

public int getResolution()
Returns the resolution factor of the terrain. This factor is equal to the lenght of triangle edges in the terrain mesh.

Returns:
terrain resolution factor