class

FFoliagePaint

The brush maths as pure functions, so the count a dab targets, the falloff that thins its rim and the filters that refuse a slope are measurable without a viewport, a scene or a device. The tool owns the gesture and the surface; nothing here reads either.

Module
Game
Header
#include "Terrain/FoliageInstances.h"
Namespace
Mowo

Properties

TypeNameDescription
static constexpr floatkTwoPiDefault 6.2831853f.

Public functions

ReturnsNameDescription
uint32_tDesiredCountHow many instances of a type a full brush disc holds.
floatFalloffWeightAcceptance weight at a normalized distance from the brush centre (0 centre, 1 rim): flat 1 inside the un-faded core, a smoothstep down to 0 at the rim.
floatSlopeDegrees
boolPassesFilters
boolIsClearOfNo instance of typeIndex stands within radius of point.
floatNextFloat01
Vec2SampleDiscUniform point in a disc of radius, as an XZ offset.
FFoliagePaintedInstanceMakeInstance
voidRerollRe-rolls scale and yaw against the type's current settings, keeping where it stands — what Reapply does to instances under the brush.
voidCollectInBrushIndices of instances whose XZ distance to the centre is within the radius; typeFilter < 0 takes every type.
uint32_tCountInBrush
voidEraseIndicesRemoves the listed indices in one pass; duplicates and out-of-range entries are ignored.
voidRemoveTypeDrops every instance of typeIndex and renumbers the ones above it, so removing a palette row never leaves an instance pointing past the end.
boolPointInPolygonEven-odd test; a polygon of fewer than three points contains nothing.
FoliageInstanceToRenderInstanceThe scatter-side record the render seam consumes: the stored normal blended into the up-vector by the type's align-to-normal.
uint32_tSeedForOne stream per dab of a stroke, so a stroke replays identically for a given seed regardless of how many pixels the cursor moved in between.

Function details

DesiredCount

C++
static uint32_t DesiredCount(float typeDensity, float brushDensity, float radius)

How many instances of a type a full brush disc holds.

FalloffWeight

C++
static float FalloffWeight(float normalizedDistance, float falloff)

Acceptance weight at a normalized distance from the brush centre (0 centre, 1 rim): flat 1 inside the un-faded core, a smoothstep down to 0 at the rim. Falloff 0 keeps the whole disc at 1.

SlopeDegrees

C++
static float SlopeDegrees(const Vec3& normal)

PassesFilters

C++
static bool PassesFilters(const FFoliageType& type, const Vec3& normal, float height)

IsClearOf

C++
static bool IsClearOf(const std::vector<FFoliagePaintedInstance>& instances, uint32_t typeIndex, const Vec3& point, float radius)

No instance of typeIndex stands within radius of point.

NextFloat01

C++
static float NextFloat01(uint32_t& state)

SampleDisc

C++
static Vec2 SampleDisc(uint32_t& state, float radius)

Uniform point in a disc of radius, as an XZ offset.

MakeInstance

C++
static FFoliagePaintedInstance MakeInstance(const FFoliageType& type, uint32_t typeIndex, const Vec3& position, const Vec3& normal, uint32_t& state)

Reroll

C++
static void Reroll(const FFoliageType& type, FFoliagePaintedInstance& instance, uint32_t& state)

Re-rolls scale and yaw against the type's current settings, keeping where it stands — what Reapply does to instances under the brush.

CollectInBrush

C++
static void CollectInBrush(const std::vector<FFoliagePaintedInstance>& instances, const Vec3& center, float radius, int32_t typeFilter, std::vector<uint32_t>& outIndices)

Indices of instances whose XZ distance to the centre is within the radius; typeFilter < 0 takes every type.

CountInBrush

C++
static uint32_t CountInBrush(const std::vector<FFoliagePaintedInstance>& instances, const Vec3& center, float radius, int32_t typeFilter)

EraseIndices

C++
static void EraseIndices(std::vector<FFoliagePaintedInstance>& instances, const std::vector<uint32_t>& indices)

Removes the listed indices in one pass; duplicates and out-of-range entries are ignored.

RemoveType

C++
static void RemoveType(std::vector<FFoliagePaintedInstance>& instances, uint32_t typeIndex)

Drops every instance of typeIndex and renumbers the ones above it, so removing a palette row never leaves an instance pointing past the end.

PointInPolygon

C++
static bool PointInPolygon(const std::vector<Vec2>& polygon, const Vec2& point)

Even-odd test; a polygon of fewer than three points contains nothing.

ToRenderInstance

C++
static FoliageInstance ToRenderInstance(const FFoliagePaintedInstance& instance, float alignToNormal, float alignMaxDegrees = 0.0f)

The scatter-side record the render seam consumes: the stored normal blended into the up-vector by the type's align-to-normal.

SeedFor

C++
static uint32_t SeedFor(uint32_t strokeSeed, uint32_t dab)

One stream per dab of a stroke, so a stroke replays identically for a given seed regardless of how many pixels the cursor moved in between.

Generated from Terrain/FoliageInstances.h via game.json · Nov 5, 2026Version 1.0.0