Skip to content
Brass Orrery

Orrery Terrain · OrreryTerrainCore module · function

Native::

SampleBrushMask

Experimental

M at a local position (FBrushMaskDab::Local), in Q16 from 0 to kBrushMaskOne: the one sampler entry point, which dispatches on the dab's flags.

Declaration

int64_t SampleBrushMask(const FBrushMaskDab& Dab, int64_t X_q16, int64_t Y_q16);
Header
#include "Native/BrushMask.h"
Module
PublicDependencyModuleNames.Add("OrreryTerrainCore"); in your module’s Build.cs.
Stability
Experimental: supported, may change in a minor version, with a changelog line.
Thread
Pure integer arithmetic, any thread; the same bits on every machine (BrushMask.SamplerGolden, SamplerGoldenBicubic and SamplerGoldenAspect).

Description

Both samplers place sample centres at (i + 1/2) of the level's span, floor the position to Q16 samples and clamp the neighbours they read at the edge. A white mask gives exactly kBrushMaskOne everywhere on it, and a position on a sample's centre gives that sample.

  • Bilinear (the default): the four neighbours, blended from exact products and rounded half up once.

  • Bicubic (kBrushMaskBicubic): the 4 × 4 neighbours under the Catmull-Rom cubic (Keys 1981, a = -1/2), separable, its weights in Q20 rounded half up with the centre-left one taking the remainder so they sum to exactly 1; the sum is rounded half up once and clamped to [0, kBrushMaskOne], since the cubic overshoots a step by up to 2/27.

Parameters

NameTypeDefaultMeaning
Dabconst FBrushMaskDab&——
X_q16int64_t——
Y_q16int64_t——
Note.

Pure integer arithmetic, any thread; the same bits on every machine (BrushMask.SamplerGolden, SamplerGoldenBicubic and SamplerGoldenAspect).