Shapes 3D  3.0
 All Classes Functions Variables Pages
shapes3d.Terrain Class Reference
Inheritance diagram for shapes3d.Terrain:

Public Member Functions

 Terrain (Heightmap hm, float worldSize)
 
Terrain getThis ()
 
void addShape (Shape3D shape)
 
void draw (PGraphics pg)
 
void draw (PGraphics pg, final Camera<?> cam)
 
void draw (PGraphics pg, float px, float pz, float view_distance, Camera<?> cam)
 
void drawPickBuffer (PGraphics pg)
 
void drawPickBuffer (PGraphics pg, float px, float pz, float view_distance)
 
PVector[][] map ()
 
float worldHorizon ()
 
Terrain worldHorizon (float worldHorizon)
 
float worldX ()
 
float worldZ ()
 
Terrain worldPosition (float x, float z)
 
Terrain worldPosition (PVector pos)
 
float worldSize ()
 
int mapSize ()
 
float mapScale ()
 
float height (float x, float z)
 
void print ()
 
- Public Member Functions inherited from shapes3d.Shape3D
 Shape3D ()
 
void addPickHandler (Object obj, String methodName)
 
Shape3D pickable (boolean pickable)
 
boolean pickable ()
 
int nbrParts ()
 
Shape3D use (int parts_to_use)
 
Shape3D tag (String tag)
 
Shape3D tag (String tag, int parts)
 
String[] tags ()
 
Shape3D drawMode (int mode)
 
Shape3D drawMode (int mode, int parts)
 
int[] drawModes ()
 
Shape3D fill (int col)
 
Shape3D fill (int col, int parts)
 
int[] fills ()
 
Shape3D stroke (int col)
 
Shape3D stroke (int col, int parts)
 
int[] strokes ()
 
Shape3D strokeWeight (float weight)
 
Shape3D strokeWeight (float weight, int parts)
 
float[] strokeWeights ()
 
Shape3D scale (float scale)
 
float scale ()
 
Shape3D movie (PApplet pApplet, PImage movie)
 
Shape3D movie (PApplet pApplet, PImage movie, int parts)
 
Shape3D texture (PApplet app, String filename)
 
Shape3D texture (PImage texture)
 
Shape3D texture (PApplet app, String filename, int parts)
 
Shape3D texture (PImage texture, int parts)
 
PImage[] textures ()
 
Shape3D uv (float u0, float u1, float v0, float v1)
 
Shape3D uv (float u0, float u1, float v0, float v1, int parts)
 
Shape3D uvt (TransformUV transformer)
 
Shape3D uvt (TransformUV transformer, int parts)
 
Shape3D uvwrap (int wrap)
 
Shape3D uvwrap (int wrap, int parts)
 
Shape3D mesh (int nbrColSlices, int nbrRowSlices)
 
Shape3D mesh (int nbrColSlices, int nbrRowSlices, int parts)
 
Shape3D visible (boolean visible)
 
Shape3D visible (boolean visible, int parts)
 
boolean[] visibles ()
 
Shape3D moveTo (PVector pos)
 
Shape3D moveTo (float x, float y, float z)
 
Shape3D moveTo (float[] xyz)
 
float x ()
 
float y ()
 
float z ()
 
PVector getPosVec ()
 
PVector getPosVec (PVector target)
 
float[] getPosArray ()
 
float[] getPosArray (float[] target)
 
PVector getRotVec ()
 
PVector getRotVec (PVector target)
 
float[] getRotArray ()
 
float[] getRotArray (float[] target)
 
Shape3D rotateTo (PVector angles)
 
Shape3D rotateTo (float[] angles)
 
Shape3D rotateTo (float x, float y, float z)
 
Shape3D rotateToX (float x)
 
Shape3D rotateToY (float y)
 
Shape3D rotateToZ (float z)
 
Shape3D rotateBy (float x, float y, float z)
 
Shape3D rotateBy (float[] angle)
 
Shape3D rotateBy (PVector angles)
 
Shape3D rotateByX (float x)
 
Shape3D rotateByY (float y)
 
Shape3D rotateByZ (float z)
 
void draw (PGraphics pg)
 
void drawPickBuffer (PGraphics pg)
 

Protected Member Functions

void calcShape ()
 
void makeParts ()
 
void releaseMemory ()
 
float[] calcBounds (float bx0, float by0, float bx1, float by1)
 
- Protected Member Functions inherited from shapes3d.Shape3D
void fireEvent (Object...objects)
 

Additional Inherited Members

- Static Public Member Functions inherited from shapes3d.Shape3D
static void showSurfaceNormals ()
 
static void showSurfaceNormals (int color, float weight, float length)
 
static void hideSurfaceNormals ()
 
static int nextPickColor ()
 
static Picked pick (PApplet app, PGraphics canvas, int x, int y)
 
static Picked[] pick (PApplet app, PGraphics canvas, int x0, int y0, int x1, int y1)
 
static Picked[] mergePicks (Picked[] picked)
 
static void keepPickBufferImage (boolean keep)
 
static PImage pickBufferImage ()
 
static int nbrShapes3D ()
 
- Public Attributes inherited from shapes3d.Shape3D
String tag
 
int tagNo = 0
 
- Public Attributes inherited from shapes3d.utils.SConstants
int WIRE = 0x00000011
 
int SOLID = 0x00000012
 
int TEXTURE = 0x00000014
 
int DRAWALL = WIRE | SOLID | TEXTURE
 
int WHITE = 0xFFFFFFFF
 
int BLACK = 0xFF000000
 
int GREY = 0xFFC0C0C0
 
int RED = 0xFFFF0000
 
int GREEN = 0xFF00FF00
 
int BLUE = 0xFF0000FF
 
int YELLOW = 0xFFFFFF00
 
int PURPLE = 0xFFFF00FF
 
int CYAN = 0xFF00FFFF
 
int ORANGE = 0xFFFFC000
 
int CW = 1
 
int CCW = 2
 
int ALL = 0b11111111
 
int BOTTOM = 0b00000001
 
int TOP = 0b00000010
 
int FRONT = 0b00000100
 
int BACK = 0b00001000
 
int LEFT = 0b00010000
 
int RIGHT = 0b00100000
 
int BODY = 0b00000001
 
int END0 = 0b00000010
 
int END1 = 0b00000100
 
float ONE_DEG_T = (float) (Math.PI / 180.0)
 
PathOrthogonal ORTHO_X = new PathOrthogonal.PathNormalX()
 
PathOrthogonal ORTHO_Y = new PathOrthogonal.PathNormalY()
 
PathOrthogonal ORTHO_Z = new PathOrthogonal.PathNormalZ()
 
PathOrthogonal ORTHO_A = new PathOrthogonal.PathNormalAMC()
 
TransformUV ROT_0 = TransformUV.ROT0
 
TransformUV ROT_90 = TransformUV.ROT90
 
TransformUV ROT_180 = TransformUV.ROT180
 
TransformUV ROT_270 = TransformUV.ROT270
 
TransformUV FLIP_H = TransformUV.FLIPH
 
TransformUV FLIP_V = TransformUV.FLIPV
 
Rotation ROTATION_ZERO = new Rotation()
 
int T_BOX = 0x1001
 
int T_DOME = 0x1002
 
int T_CONE = 0x1003
 
int T_ELLIPSOID = 0x1004
 
int T_EXTRUSION = 0x1005
 
int T_LATHESTOCK = 0x1006
 
int T_MD2 = 0x1007
 
int T_SKYBOX = 0x1008
 
int T_SKYDOME = 0x1009
 
int T_TERRAIN = 0x100A
 
int T_TUBE = 0x100B
 
int C_LATHESURFACE = 0x2001
 
int C_OVAL = 0x2002
 
int C_POLYGON = 0x2003
 
int P_BCURVE2D = 0x3001
 
int P_BCURVE3D = 0x3002
 
int P_BSPLINE2D = 0x3003
 
int P_BSPLINE3D = 0x3004
 
int P_LINEAR = 0x3005
 
int P_LISSAJOUS = 0x3006
 
int P_RING = 0x3007
 
int P_SPIRAL = 0x3008
 
- Protected Attributes inherited from shapes3d.Shape3D
PGraphics on_canvas
 
PMatrix on_canvas_matrix
 
PVector pos = new PVector(0,0,0)
 
PVector rot = new PVector(0,0,0)
 
PVector up = new PVector(0,1,0)
 
PVector centreRot = new PVector(0,0,0)
 
float shapeScale = 1.0f
 
_ShapePart[] shapeParts = new _ShapePart[0]
 
int useParts = ALL
 
int pickColor
 
boolean pickable = true
 
Object eventHandlerObject = null
 
Method eventHandlerMethod = null
 
String eventHandlerMethodName
 
- Static Protected Attributes inherited from shapes3d.Shape3D
static HashMap< Integer, Shape3DmapColor2Shape = new HashMap<Integer, Shape3D>()
 
static HashMap< PGraphics,
PGraphics > 
mapCanvas2ColorBuffer = new HashMap<PGraphics, PGraphics>()
 
static List< Shape3DshapesMade = new ArrayList<Shape3D>()
 
static Set< PickedmarqueeSelection = new HashSet<Picked>()
 
static boolean show_normals = false
 
static int normal_color = 0xFFFF00FF
 
static float normal_weight = 1.0f
 
static float normal_length = 10
 
static int nextPickColor = 0xFF000000
 
static boolean keepCopy = false
 
static PImage pbImage = null
 

Detailed Description

Author
Peter Lager

Member Function Documentation

float [] shapes3d.Terrain.calcBounds ( float  bx0,
float  by0,
float  bx1,
float  by1 
)
protected

If two boxes overlap then the overlap region is another box. This method is used to calculate the coordinates of the overlap.
The boxes are represented by the top-left and bottom-right corner coordinates. If the returned array has a length: 0 then they do not overlap
4 then these are the coordinates of the top-left and bottom-right corners of the overlap region.

Parameters
bx0top-left corner of rectangle B
by0top-left corner of rectangle B
bx1bottom-right corner of rectangle B
by1bottom-right corner of rectangle B
Returns
an array with the overlap box coordinates (if any)
void shapes3d.Terrain.draw ( PGraphics  pg,
final Camera<?>  cam 
)
Parameters
pgthe canvas
lookAtthe direction we are looking (normalised vector)
void shapes3d.Terrain.draw ( PGraphics  pg,
float  px,
float  pz,
float  view_distance,
Camera<?>  cam 
)

Draw the terrain centered about px, py as far as view_distance

Parameters
pgthe canvas
pxreal world position on the terrain
pzreal world position on the terrain
view_distancereal world view distance
float shapes3d.Terrain.height ( float  x,
float  z 
)

Retrieve the terrain height for any position on the terrain

Parameters
xany valid X position coordinate
zany valid Z position coordinate
Returns
the terrain height at [x, z]
PVector [][] shapes3d.Terrain.map ( )

If you use this method to enable modifications to the map then you do so at your own risk

Returns
the terrain map with the {x,y,z] coordinates
float shapes3d.Terrain.mapScale ( )
Returns
the mapScale
int shapes3d.Terrain.mapSize ( )
Returns
the mapSize
float shapes3d.Terrain.worldHorizon ( )
Returns
the worldHorizon
Terrain shapes3d.Terrain.worldHorizon ( float  worldHorizon)

The world horizon controls how much of the terrain is rendered at any one time.

Parameters
worldHorizonthe worldHorizon to set
Returns
this shape
Terrain shapes3d.Terrain.worldPosition ( float  x,
float  z 
)

Specify the center of the terrain rendering. This will usually be called from a camera which ensures [x, z] is over the terrain, otherwise the user is responsible for doing this.

Parameters
xx position
zz position
Returns
this shape
float shapes3d.Terrain.worldSize ( )
Returns
the worldSize
float shapes3d.Terrain.worldX ( )
Returns
the worldX
float shapes3d.Terrain.worldZ ( )
Returns
the worldZ

The documentation for this class was generated from the following file: