Jazz3D API


com.sygem.jazz3d3.primitive
Class Landscape3d

java.lang.Object
  |
  +--com.sygem.jazz3d3.Object3d
        |
        +--com.sygem.jazz3d3.primitive.Landscape3d

public class Landscape3d
extends Object3d

Create a fractal landscape object.

Version:
3.0a
Author:
SyGem Software
See Also:
Object3d

Constructor Summary
Landscape3d(double x, double y, double z)
          Construct a new landscape.
Landscape3d(int seed, double x, double y, double z)
          Construct a new landscape based on a given random seed.
 
Method Summary
 void addColour(double min, int r, int g, int b)
          Assigns a colour to every point above a given height.
 void addRandomValues()
          Adds a random set of values to every point in the landscape.
 void addRandomValues(double min, double max)
          Adds a random set of values to every point in the landscape.
 void forceEdgesToZero()
          All of the edges of the landscape will be set to zero.
 void fractalize()
          Adds another level of randomness to the landscape.
 void generateShape()
          Generates the triangles which actually make up the landscape.
 void setSeed(int seed)
          Set the seed to be used in the random number generator.
 void setSingleSided(boolean sided)
          Allows you to toggle if the faces are single-sided or not.
 void smooth()
          Smooths the landscape.
 
Methods inherited from class com.sygem.jazz3d3.Object3d
addChild, addQuad, addTriangle, addVertex, applyFaceChanges, cleanUp, getCenter, getChildObjects, getCollidable, getCulling, getFace, getFaceColour, getID, getName, getNumberOfFaces, getNumberOfSubFaces, getNumberOfSubVertices, getNumberOfVertices, getRenderer, getShapeArray, getUseVertexUVCoords, getVertex, getVertexArray, getVisible, getWorldVertex, pick, pickClosest, pickFace, prepForDisplay, recreateVertexNormals, rotateLocal, rotateLocal, rotateWorld, rotateWorld, scaleObject, setAllTextures, setAmbientColour, setCollidable, setColour, setCulling, setFaceColour, setFaceColourQuick, setName, setPosition, setRenderer, setShapeArray, setTexture, setTexture, setUseVertexUVCoords, setVertexArray, setVertexTexture, setVisible, translateLocal, translateWorld
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Landscape3d

public Landscape3d(int seed,
                   double x,
                   double y,
                   double z)
Construct a new landscape based on a given random seed.
Parameters:
seed - The seed to use for the random number routine.
x - The x position of the center of the landscape
y - The y position of the center of the landscape
z - The z position of the center of the landscape

Landscape3d

public Landscape3d(double x,
                   double y,
                   double z)
Construct a new landscape. A default seed is used.
Parameters:
x - The x position of the center of the landscape
y - The y position of the center of the landscape
z - The z position of the center of the landscape
Method Detail

fractalize

public final void fractalize()
Adds another level of randomness to the landscape. Each level added doubles the size of the grid representing the landscape.

For example: it goes from a 2x2 grid, to a 4x4 grid, to an 8x8 grid and so on. This can quickly generate a large number of faces, so beware, because the objects will take a long time to draw with a large number of faces.


smooth

public final void smooth()
Smooths the landscape. Attempts to make the landscape less craggy, and smoother. Repeated smooths will iron out every bump!

generateShape

public final void generateShape()
Generates the triangles which actually make up the landscape.

NOTE: If this is not called, then the object will not render!


setSeed

public final void setSeed(int seed)
Set the seed to be used in the random number generator.
Parameters:
seed - The new random seed.

addRandomValues

public final void addRandomValues()
Adds a random set of values to every point in the landscape.

The values will range from -0.5 to 0.5


addRandomValues

public final void addRandomValues(double min,
                                  double max)
Adds a random set of values to every point in the landscape. The range of values can be set by the user.
Parameters:
min - The minimum value for the random values
max - The maximum value for the random values

addColour

public final void addColour(double min,
                            int r,
                            int g,
                            int b)
Assigns a colour to every point above a given height.
Parameters:
min - A value between zero and one.
r - The red value of the colour. Ranges from 0 to 255.
g - The green value of the colour. Ranges from 0 to 255.
b - The blue value of the colour. Ranges from 0 to 255.

setSingleSided

public final void setSingleSided(boolean sided)
Allows you to toggle if the faces are single-sided or not.
Parameters:
sided - True if the faces should be single-sided, false if not.

forceEdgesToZero

public final void forceEdgesToZero()
All of the edges of the landscape will be set to zero. This allows for possible joining of multiple landscapes.

©2001 SyGem Software