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
| Type | Name | Description |
|---|---|---|
static constexpr float | kTwoPi | Default 6.2831853f. |
Public functions
| Returns | Name | Description |
|---|---|---|
uint32_t | DesiredCount | How many instances of a type a full brush disc holds. |
float | FalloffWeight | 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. |
float | SlopeDegrees | |
bool | PassesFilters | |
bool | IsClearOf | No instance of typeIndex stands within radius of point. |
float | NextFloat01 | |
Vec2 | SampleDisc | Uniform point in a disc of radius, as an XZ offset. |
FFoliagePaintedInstance | MakeInstance | |
void | Reroll | Re-rolls scale and yaw against the type's current settings, keeping where it stands — what Reapply does to instances under the brush. |
void | CollectInBrush | Indices of instances whose XZ distance to the centre is within the radius; typeFilter < 0 takes every type. |
uint32_t | CountInBrush | |
void | EraseIndices | Removes the listed indices in one pass; duplicates and out-of-range entries are ignored. |
void | RemoveType | Drops every instance of typeIndex and renumbers the ones above it, so removing a palette row never leaves an instance pointing past the end. |
bool | PointInPolygon | Even-odd test; a polygon of fewer than three points contains nothing. |
FoliageInstance | ToRenderInstance | The scatter-side record the render seam consumes: the stored normal blended into the up-vector by the type's align-to-normal. |
uint32_t | SeedFor | 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. |
Function details
DesiredCount
static uint32_t DesiredCount(float typeDensity, float brushDensity, float radius)How many instances of a type a full brush disc holds.
FalloffWeight
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
static float SlopeDegrees(const Vec3& normal)PassesFilters
static bool PassesFilters(const FFoliageType& type, const Vec3& normal, float height)IsClearOf
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
static float NextFloat01(uint32_t& state)SampleDisc
static Vec2 SampleDisc(uint32_t& state, float radius)Uniform point in a disc of radius, as an XZ offset.
MakeInstance
static FFoliagePaintedInstance MakeInstance(const FFoliageType& type, uint32_t typeIndex, const Vec3& position, const Vec3& normal, uint32_t& state)Reroll
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
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
static uint32_t CountInBrush(const std::vector<FFoliagePaintedInstance>& instances, const Vec3& center, float radius, int32_t typeFilter)EraseIndices
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
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
static bool PointInPolygon(const std::vector<Vec2>& polygon, const Vec2& point)Even-odd test; a polygon of fewer than three points contains nothing.
ToRenderInstance
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
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.