Class DiamondSquareTerrain
java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
eu.svjatoslav.sixth.e3d.examples.terrain_demo.DiamondSquareTerrain
public class DiamondSquareTerrain
extends eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
A procedurally generated terrain mesh using the diamond-square algorithm.
Creates a grid of triangular polygons with height variation for mountains.
-
Field Summary
Fields inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
cachedBoundingBox, mouseInteractionController -
Constructor Summary
ConstructorsConstructorDescriptionDiamondSquareTerrain(int gridSize, double minHeight, double maxHeight, long seed) Creates a diamond-square terrain with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetHeightAt(double worldX, double worldZ) Returns the terrain height at the specified world XZ coordinates.Methods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
addShape, addShape, beforeTransformHook, extractSolidPolygons, getBoundingBox, getGroup, getLocation, getSubShapesRegistry, getTransform, getViewSpaceTracker, hideGroup, intersect, removeGroup, setBackfaceCulling, setCacheNeedsRebuild, setColor, setGroupForUngrouped, setMouseInteractionController, setRootComposite, setShadingEnabled, setTransform, showGroup, subtract, transform, unionMethods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
invalidateBounds
-
Constructor Details
-
DiamondSquareTerrain
public DiamondSquareTerrain(int gridSize, double minHeight, double maxHeight, long seed) Creates a diamond-square terrain with the specified parameters.- Parameters:
gridSize- the size of the heightmap grid (must be 2^n + 1)minHeight- the minimum terrain heightmaxHeight- the maximum terrain heightseed- random seed for reproducible terrain
-
-
Method Details
-
getHeightAt
public double getHeightAt(double worldX, double worldZ) Returns the terrain height at the specified world XZ coordinates.- Parameters:
worldX- the world X coordinateworldZ- the world Z coordinate- Returns:
- the terrain height at that position, or 0 if outside terrain bounds
-