vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::TerrainPlants Namespace Reference

Where a terrain's plants stand: each grid square grows as many of a layer's plants as the density painted at its corners asks, placed, turned and sized by a hash of the square and the layer's seed. More...

Classes

struct  Plant
 One plant: which layer, and where in the terrain it stands. More...

Functions

void scatter (const TerrainAsset &terrain, std::vector< Plant > &out)
 Every plant terrain grows.

Variables

constexpr uint32_t MAX_PER_SQUARE = 64
 The most plants one grid square grows of one layer, whatever its density asks.

Detailed Description

Where a terrain's plants stand: each grid square grows as many of a layer's plants as the density painted at its corners asks, placed, turned and sized by a hash of the square and the layer's seed.

A function of the asset alone, so every end of a networked game and every load grows the same plants, and a stroke moves only those where it painted.

Function Documentation

◆ scatter()

void Vkm::Engine::TerrainPlants::scatter ( const TerrainAsset & terrain,
std::vector< Plant > & out )

Every plant terrain grows.

Parameters
terrainThe terrain; a layer with no density map grows none.
[out]outReplaced with them, layer by layer, row by row.