Class DiamondSquareTerrain
java.lang.Object
eu.svjatoslav.aukio.e3d.renderer.raster.shapes.AbstractShape
eu.svjatoslav.aukio.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
eu.svjatoslav.aukio.e3d.examples.terrain_demo.DiamondSquareTerrain
public class DiamondSquareTerrain
extends eu.svjatoslav.aukio.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.aukio.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.aukio.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
addShape, addShape, beforeTransformHook, collectMeshBlocks, collectRenderTriangles, extractSolidPolygons, getBoundingBox, getGlobalRenderListVersion, getGroup, getLocation, getSubShapesRegistry, getTransform, getTransformWeight, getViewSpaceTracker, hideGroup, intersect, postprocessRenderList, removeGroup, setBackfaceCulling, setCacheNeedsRebuild, setColor, setGroupForUngrouped, setMouseInteractionController, setRootComposite, setShadingEnabled, setTransform, showGroup, subtract, transform, unionMethods inherited from class eu.svjatoslav.aukio.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
-