LDK_GRASS_PROFILE_POINT_COUNT
#define LDK_GRASS_PROFILE_POINT_COUNT 4u
Procedural, instanced grass patches with per-type appearance, distribution, wind, interaction and optional color/height noise.
A GrassSystem has up to LDK_GRASS_TYPE_COUNT (16) named grass types. Each
type selects an LDKGrassBladePreset and controls density, blade dimensions,
colors and animation. Types can be configured in the GrassSystem inspector
or added at runtime with ldk_grass_type_register() while the system is
active.
ldk_grass_add() populates a rectangular plane using one configured type;
patches can later be changed with ldk_grass_update() or removed with
ldk_grass_remove(). The engine owns the individual blade instances.
In addition to the built-in presets, a game can register generators for
LDK_GRASS_BLADE_PRESET_CUSTOM_0 through LDK_GRASS_BLADE_PRESET_CUSTOM_7.
These are eight fixed slots, not eight additional grass types. Multiple
grass types may select the same custom preset with different settings.
A generator is called when a shared batch mesh needs to be created or rebuilt, not once for each blade. It receives the resolved blade profile and bottom/top colors and fills an LDKMeshData. The engine uploads the mesh, instances it, applies wind/interaction and renders its shadows.
Generator requirements:
The engine calls ldk_mesh_data_destroy() after the upload (or on failure).
is applied by the system's instance transforms.
restriction is required by the current patch bounds and culling.
Additional height segments produce a smoother bend.
initialize each vertex tangent; tangent.w = 0 disables its bend-normal
contribution. Vertex colors use LDK_RGBA32() for rgba32 inputs.
Example: a minimal two-sided ribbon. In the game's C source, include
stdlib.h for calloc(). * The example uses only four vertices for clarity.
static bool game_grass_ribbon(const LDKGrassBladeShape *shape,
rgba32 bottom_color, rgba32 top_color, LDKMeshData *out_mesh)
{
static const u32 triangles[12] = {
0u, 1u, 3u, 0u, 3u, 2u, 3u, 1u, 0u, 2u, 3u, 0u};
float half_width;
if (!shape || !out_mesh)
{
return false;
}
*out_mesh = (LDKMeshData){0};
half_width = shape->profile[0].width * 0.5f;
out_mesh->vertices = calloc(4u, sizeof(LDKMeshVertex));
out_mesh->indices = calloc(12u, sizeof(u32));
if (!out_mesh->vertices || !out_mesh->indices)
{
ldk_mesh_data_destroy(out_mesh);
return false;
}
for (u32 i = 0u; i < 4u; ++i)
{
float height = i >= 2u ? 1.0f : 0.0f;
float side = (i & 1u) ? 1.0f : 0.0f;
LDKMeshVertex *vertex = &out_mesh->vertices[i];
vertex->position = vec3_make(
side ? half_width : -half_width, height, 0.0f);
vertex->normal = vec3_make(0.0f, 0.0f, 1.0f);
vertex->uv = vec2_make(side, height);
vertex->color = LDK_RGBA32(height > 0.0f
? top_color : bottom_color);
vertex->tangent = vec4_make(0.0f, 0.0f, 1.0f, 1.0f);
}
for (u32 i = 0u; i < 12u; ++i)
{
out_mesh->indices[i] = triangles[i];
}
out_mesh->vertex_count = 4u;
out_mesh->index_count = 12u;
out_mesh->has_tangents = true;
return true;
}
Register the callback before creating grass that uses CUSTOM_0. Then
select CUSTOM_0 in an existing GrassSystem type or register a type at
runtime. This example runs after the GrassSystem has initialized:
ldk_grass_blade_generator_register(
LDK_GRASS_BLADE_PRESET_CUSTOM_0, game_grass_ribbon);
LDKGrassTypeDesc type;
ldk_grass_type_desc_defaults(&type);
x_smallstr_init(&type.name, "Reeds");
type.blade_preset = LDK_GRASS_BLADE_PRESET_CUSTOM_0;
type.blade_width = 0.2f;
LDKGrassTypeId type_id = ldk_grass_type_register(&type);
if (type_id != LDK_GRASS_TYPE_ID_INVALID)
{
LDKGrassPatchDesc patch;
ldk_grass_patch_desc_defaults(&patch);
patch.plane.axis_u = vec3_make(5.0f, 0.0f, 0.0f);
patch.plane.axis_v = vec3_make(0.0f, 0.0f, -5.0f);
ldk_grass_add(type_id, &patch);
}
A missing generator makes the corresponding custom batch fail rather than silently choosing another preset. Registering a different callback for an occupied slot triggers regeneration on the next GrassSystem update. Registrations survive scene/system reinitialization. Before unloading a game DLL containing a callback, unregister it with:
ldk_grass_blade_generator_register(
LDK_GRASS_BLADE_PRESET_CUSTOM_0, NULL);
ldkgrassinteract(from, to, radius, strength) queues a world-space capsule of influence. Equal endpoints produce a circular interaction. The active GrassSystem consumes queued interactions during its render update.
#define LDK_GRASS_PROFILE_POINT_COUNT 4u
#define LDK_GRASS_MIN_SIDE_COUNT 3u
#define LDK_GRASS_MAX_SIDE_COUNT 8u
#define LDK_GRASS_TYPE_COUNT 16u
#define LDK_GRASS_CUSTOM_BLADE_PRESET_COUNT 8u
#define LDK_GRASS_TYPE_ID_INVALID UINT32_MAX
typedef u32 LDKGrassTypeId;
Deprecated source-compatible name for the original thorny prototype.
typedef enum LDKGrassBladeTopology{
LDK_GRASS_BLADE_TOPOLOGY_RIBBON=0,
LDK_GRASS_BLADE_TOPOLOGY_CROSSED_RIBBONS,
LDK_GRASS_BLADE_TOPOLOGY_RADIAL,
LDK_GRASS_BLADE_TOPOLOGY_TRIPLE_RIBBONS,
LDK_GRASS_BLADE_TOPOLOGY_THORNY_STEM,
LDK_GRASS_BLADE_TOPOLOGY_PLUMED_STEM,
LDK_GRASS_BLADE_TOPOLOGY_CUSTOM,
/** Deprecated source-compatible name for the original thorny prototype. */LDK_GRASS_BLADE_TOPOLOGY_THORNY_RIBBON=LDK_GRASS_BLADE_TOPOLOGY_THORNY_STEM
}LDKGrassBladeTopology;
typedef enum LDKGrassBladePreset{
LDK_GRASS_BLADE_PRESET_THIN=0,
LDK_GRASS_BLADE_PRESET_CROSSED,
LDK_GRASS_BLADE_PRESET_TUFT,
LDK_GRASS_BLADE_PRESET_FLAT_TOP,
LDK_GRASS_BLADE_PRESET_THORNY,
LDK_GRASS_BLADE_PRESET_PLUMED_STEM,
LDK_GRASS_BLADE_PRESET_CUSTOM_0,
LDK_GRASS_BLADE_PRESET_CUSTOM_1,
LDK_GRASS_BLADE_PRESET_CUSTOM_2,
LDK_GRASS_BLADE_PRESET_CUSTOM_3,
LDK_GRASS_BLADE_PRESET_CUSTOM_4,
LDK_GRASS_BLADE_PRESET_CUSTOM_5,
LDK_GRASS_BLADE_PRESET_CUSTOM_6,
LDK_GRASS_BLADE_PRESET_CUSTOM_7
}LDKGrassBladePreset;
One sample of the normalized blade profile. Height is in [0, 1]. Width is the full ribbon width, or the radial diameter, at that height.
typedef struct LDKGrassProfilePoint{
float height;
float width;
}LDKGrassProfilePoint;
Used only by the CUSTOM topology; 0..7.
typedef struct LDKGrassBladeShape{
LDKGrassProfilePoint profile[LDK_GRASS_PROFILE_POINT_COUNT];
LDKGrassBladeTopology topology;
/** Used by the radial and thorny stem topologies. */u32 side_count;
/** Used only by the CUSTOM topology; 0..7. */u32 custom_slot;
}LDKGrassBladeShape;
Generate one reusable blade mesh for a registered CUSTOM preset. The returned LDKMeshData must own malloc-allocated vertices and indices; the engine releases both via ldk_mesh_data_destroy after GPU upload. Mesh coordinates use normalized height Y in [0,1], and X/Z must remain within half the maximum shape profile width, relative to the origin. UV.y is the normalized deformation coordinate, from 0 at the root to 1 at the tip. A tangent with w != 0 enables bent-normal computation. This callback must not create renderer resources.
typedef bool(*LDKGrassBladeMeshGenerator)(const LDKGrassBladeShape *shape, rgba32 bottom_color, rgba32 top_color, LDKMeshData *out_mesh);
Flat target geometry. The complete parallelogram, including its edges, is a valid generation area. origin + axis_u + axis_v is the opposite corner.
typedef struct LDKGrassPlane{
Vec3 origin;
Vec3 axis_u;
Vec3 axis_v;
}LDKGrassPlane;
Seconds until interaction deformation fully returns to rest. Zero uses the default.
typedef struct LDKGrassTypeDesc{
XSmallstr name;
LDKGrassBladePreset blade_preset;
float density;
/** Tendency to grow near other blades: 0 = uniform, 1 = clustered. */float clumping;
/** Maximum distance from a clump root, in world units. */float clump_radius;
float min_height;
float max_height;
/** Use the noise texture to interpolate between min_height and max_height. */bool use_noise_height;
float blade_width;
float curvature;
/** Per-type maximum wind displacement before the system wind force. */float wind_strength;
/** Seconds until interaction deformation fully returns to rest. Zero uses the default. */float interaction_recovery_time;
rgba32 bottom_color;
rgba32 top_color;
bool use_noise_color;
bool use_custom_noise_palette;
u32 noise_color_stop_0_color;
u32 noise_color_stop_1_color;
u32 noise_color_stop_2_color;
u32 noise_color_stop_3_color;
}LDKGrassTypeDesc;
Per-region state. Visual configuration comes from LDKGrassSystem.
typedef struct LDKGrassPatchDesc{
LDKGrassPlane plane;
float density_scale;
u32 seed;
}LDKGrassPatchDesc;
Opaque identity of one patch. Individual blades are intentionally hidden.
typedef struct LDKGrassPatch{
u32 index;
u32 version;
}LDKGrassPatch;
Initialize the grass system.
int ldk_grass_system_initialize(void *data);
void *dataSystem initialization status code.
Update the grass system.
void ldk_grass_system_update(
void *data,
const LDKEntityGroup *group,
float dt
);
void *dataconst LDKEntityGroup *groupfloat dtShut down the grass system.
void ldk_grass_system_terminate(void *data);
void *dataRegister or unregister the mesh generator for CUSTOM_0 through CUSTOM_7. Pass NULL to unregister before unloading game code containing the callback. Registrations survive GrassSystem scene initialization and termination. Re-registering an occupied slot rebuilds affected grass batches on update.
LDK_API bool ldk_grass_blade_generator_register(
LDKGrassBladePreset preset,
LDKGrassBladeMeshGenerator generator
);
false for non-CUSTOM presets; true otherwise.
Color stops, mapped to the noise [0, 1] interval.
typedef struct LDKGrassSystem{
float min_tilt_degrees;
float max_tilt_degrees;
/** Shared lean azimuth: 0 degrees is +X, 90 degrees is +Z. */float tilt_direction_degrees;
/** Wind azimuth: 0 degrees is +X, 90 degrees is +Z. */float wind_direction_degrees;
float wind_force;
/** Animation cycles per second. */float wind_speed;
/** Grayscale noise image used for world-space color and height sampling. */LDKAssetImage color_noise_texture;
/** Noise repetitions per world unit. Must be positive. */float color_noise_scale;
/** Color stops, mapped to the noise [0, 1] interval. */float color_stop_1_position;
float color_stop_2_position;
u32 color_stop_0_color;
u32 color_stop_1_color;
u32 color_stop_2_color;
u32 color_stop_3_color;
float specular;
float shininess;
float emission;
bool casts_shadows;
bool unlit;
XSmallstr type_0_name;
LDKGrassBladePreset type_0_blade_preset;
float type_0_density;
float type_0_clumping;
float type_0_clump_radius;
float type_0_min_height;
float type_0_max_height;
bool type_0_use_noise_height;
float type_0_blade_width;
float type_0_curvature;
float type_0_wind_strength;
float type_0_interaction_recovery_time;
u32 type_0_bottom_color;
u32 type_0_top_color;
bool type_0_use_noise_color;
bool type_0_use_custom_noise_palette;
u32 type_0_noise_color_stop_0_color;
u32 type_0_noise_color_stop_1_color;
u32 type_0_noise_color_stop_2_color;
u32 type_0_noise_color_stop_3_color;
XSmallstr type_1_name;
LDKGrassBladePreset type_1_blade_preset;
float type_1_density;
float type_1_clumping;
float type_1_clump_radius;
float type_1_min_height;
float type_1_max_height;
bool type_1_use_noise_height;
float type_1_blade_width;
float type_1_curvature;
float type_1_wind_strength;
float type_1_interaction_recovery_time;
u32 type_1_bottom_color;
u32 type_1_top_color;
bool type_1_use_noise_color;
bool type_1_use_custom_noise_palette;
u32 type_1_noise_color_stop_0_color;
u32 type_1_noise_color_stop_1_color;
u32 type_1_noise_color_stop_2_color;
u32 type_1_noise_color_stop_3_color;
XSmallstr type_2_name;
LDKGrassBladePreset type_2_blade_preset;
float type_2_density;
float type_2_clumping;
float type_2_clump_radius;
float type_2_min_height;
float type_2_max_height;
bool type_2_use_noise_height;
float type_2_blade_width;
float type_2_curvature;
float type_2_wind_strength;
float type_2_interaction_recovery_time;
u32 type_2_bottom_color;
u32 type_2_top_color;
bool type_2_use_noise_color;
bool type_2_use_custom_noise_palette;
u32 type_2_noise_color_stop_0_color;
u32 type_2_noise_color_stop_1_color;
u32 type_2_noise_color_stop_2_color;
u32 type_2_noise_color_stop_3_color;
XSmallstr type_3_name;
LDKGrassBladePreset type_3_blade_preset;
float type_3_density;
float type_3_clumping;
float type_3_clump_radius;
float type_3_min_height;
float type_3_max_height;
bool type_3_use_noise_height;
float type_3_blade_width;
float type_3_curvature;
float type_3_wind_strength;
float type_3_interaction_recovery_time;
u32 type_3_bottom_color;
u32 type_3_top_color;
bool type_3_use_noise_color;
bool type_3_use_custom_noise_palette;
u32 type_3_noise_color_stop_0_color;
u32 type_3_noise_color_stop_1_color;
u32 type_3_noise_color_stop_2_color;
u32 type_3_noise_color_stop_3_color;
XSmallstr type_4_name;
LDKGrassBladePreset type_4_blade_preset;
float type_4_density;
float type_4_clumping;
float type_4_clump_radius;
float type_4_min_height;
float type_4_max_height;
bool type_4_use_noise_height;
float type_4_blade_width;
float type_4_curvature;
float type_4_wind_strength;
float type_4_interaction_recovery_time;
u32 type_4_bottom_color;
u32 type_4_top_color;
bool type_4_use_noise_color;
bool type_4_use_custom_noise_palette;
u32 type_4_noise_color_stop_0_color;
u32 type_4_noise_color_stop_1_color;
u32 type_4_noise_color_stop_2_color;
u32 type_4_noise_color_stop_3_color;
XSmallstr type_5_name;
LDKGrassBladePreset type_5_blade_preset;
float type_5_density;
float type_5_clumping;
float type_5_clump_radius;
float type_5_min_height;
float type_5_max_height;
bool type_5_use_noise_height;
float type_5_blade_width;
float type_5_curvature;
float type_5_wind_strength;
float type_5_interaction_recovery_time;
u32 type_5_bottom_color;
u32 type_5_top_color;
bool type_5_use_noise_color;
bool type_5_use_custom_noise_palette;
u32 type_5_noise_color_stop_0_color;
u32 type_5_noise_color_stop_1_color;
u32 type_5_noise_color_stop_2_color;
u32 type_5_noise_color_stop_3_color;
XSmallstr type_6_name;
LDKGrassBladePreset type_6_blade_preset;
float type_6_density;
float type_6_clumping;
float type_6_clump_radius;
float type_6_min_height;
float type_6_max_height;
bool type_6_use_noise_height;
float type_6_blade_width;
float type_6_curvature;
float type_6_wind_strength;
float type_6_interaction_recovery_time;
u32 type_6_bottom_color;
u32 type_6_top_color;
bool type_6_use_noise_color;
bool type_6_use_custom_noise_palette;
u32 type_6_noise_color_stop_0_color;
u32 type_6_noise_color_stop_1_color;
u32 type_6_noise_color_stop_2_color;
u32 type_6_noise_color_stop_3_color;
XSmallstr type_7_name;
LDKGrassBladePreset type_7_blade_preset;
float type_7_density;
float type_7_clumping;
float type_7_clump_radius;
float type_7_min_height;
float type_7_max_height;
bool type_7_use_noise_height;
float type_7_blade_width;
float type_7_curvature;
float type_7_wind_strength;
float type_7_interaction_recovery_time;
u32 type_7_bottom_color;
u32 type_7_top_color;
bool type_7_use_noise_color;
bool type_7_use_custom_noise_palette;
u32 type_7_noise_color_stop_0_color;
u32 type_7_noise_color_stop_1_color;
u32 type_7_noise_color_stop_2_color;
u32 type_7_noise_color_stop_3_color;
XSmallstr type_8_name;
LDKGrassBladePreset type_8_blade_preset;
float type_8_density;
float type_8_clumping;
float type_8_clump_radius;
float type_8_min_height;
float type_8_max_height;
bool type_8_use_noise_height;
float type_8_blade_width;
float type_8_curvature;
float type_8_wind_strength;
float type_8_interaction_recovery_time;
u32 type_8_bottom_color;
u32 type_8_top_color;
bool type_8_use_noise_color;
bool type_8_use_custom_noise_palette;
u32 type_8_noise_color_stop_0_color;
u32 type_8_noise_color_stop_1_color;
u32 type_8_noise_color_stop_2_color;
u32 type_8_noise_color_stop_3_color;
XSmallstr type_9_name;
LDKGrassBladePreset type_9_blade_preset;
float type_9_density;
float type_9_clumping;
float type_9_clump_radius;
float type_9_min_height;
float type_9_max_height;
bool type_9_use_noise_height;
float type_9_blade_width;
float type_9_curvature;
float type_9_wind_strength;
float type_9_interaction_recovery_time;
u32 type_9_bottom_color;
u32 type_9_top_color;
bool type_9_use_noise_color;
bool type_9_use_custom_noise_palette;
u32 type_9_noise_color_stop_0_color;
u32 type_9_noise_color_stop_1_color;
u32 type_9_noise_color_stop_2_color;
u32 type_9_noise_color_stop_3_color;
XSmallstr type_10_name;
LDKGrassBladePreset type_10_blade_preset;
float type_10_density;
float type_10_clumping;
float type_10_clump_radius;
float type_10_min_height;
float type_10_max_height;
bool type_10_use_noise_height;
float type_10_blade_width;
float type_10_curvature;
float type_10_wind_strength;
float type_10_interaction_recovery_time;
u32 type_10_bottom_color;
u32 type_10_top_color;
bool type_10_use_noise_color;
bool type_10_use_custom_noise_palette;
u32 type_10_noise_color_stop_0_color;
u32 type_10_noise_color_stop_1_color;
u32 type_10_noise_color_stop_2_color;
u32 type_10_noise_color_stop_3_color;
XSmallstr type_11_name;
LDKGrassBladePreset type_11_blade_preset;
float type_11_density;
float type_11_clumping;
float type_11_clump_radius;
float type_11_min_height;
float type_11_max_height;
bool type_11_use_noise_height;
float type_11_blade_width;
float type_11_curvature;
float type_11_wind_strength;
float type_11_interaction_recovery_time;
u32 type_11_bottom_color;
u32 type_11_top_color;
bool type_11_use_noise_color;
bool type_11_use_custom_noise_palette;
u32 type_11_noise_color_stop_0_color;
u32 type_11_noise_color_stop_1_color;
u32 type_11_noise_color_stop_2_color;
u32 type_11_noise_color_stop_3_color;
XSmallstr type_12_name;
LDKGrassBladePreset type_12_blade_preset;
float type_12_density;
float type_12_clumping;
float type_12_clump_radius;
float type_12_min_height;
float type_12_max_height;
bool type_12_use_noise_height;
float type_12_blade_width;
float type_12_curvature;
float type_12_wind_strength;
float type_12_interaction_recovery_time;
u32 type_12_bottom_color;
u32 type_12_top_color;
bool type_12_use_noise_color;
bool type_12_use_custom_noise_palette;
u32 type_12_noise_color_stop_0_color;
u32 type_12_noise_color_stop_1_color;
u32 type_12_noise_color_stop_2_color;
u32 type_12_noise_color_stop_3_color;
XSmallstr type_13_name;
LDKGrassBladePreset type_13_blade_preset;
float type_13_density;
float type_13_clumping;
float type_13_clump_radius;
float type_13_min_height;
float type_13_max_height;
bool type_13_use_noise_height;
float type_13_blade_width;
float type_13_curvature;
float type_13_wind_strength;
float type_13_interaction_recovery_time;
u32 type_13_bottom_color;
u32 type_13_top_color;
bool type_13_use_noise_color;
bool type_13_use_custom_noise_palette;
u32 type_13_noise_color_stop_0_color;
u32 type_13_noise_color_stop_1_color;
u32 type_13_noise_color_stop_2_color;
u32 type_13_noise_color_stop_3_color;
XSmallstr type_14_name;
LDKGrassBladePreset type_14_blade_preset;
float type_14_density;
float type_14_clumping;
float type_14_clump_radius;
float type_14_min_height;
float type_14_max_height;
bool type_14_use_noise_height;
float type_14_blade_width;
float type_14_curvature;
float type_14_wind_strength;
float type_14_interaction_recovery_time;
u32 type_14_bottom_color;
u32 type_14_top_color;
bool type_14_use_noise_color;
bool type_14_use_custom_noise_palette;
u32 type_14_noise_color_stop_0_color;
u32 type_14_noise_color_stop_1_color;
u32 type_14_noise_color_stop_2_color;
u32 type_14_noise_color_stop_3_color;
XSmallstr type_15_name;
LDKGrassBladePreset type_15_blade_preset;
float type_15_density;
float type_15_clumping;
float type_15_clump_radius;
float type_15_min_height;
float type_15_max_height;
bool type_15_use_noise_height;
float type_15_blade_width;
float type_15_curvature;
float type_15_wind_strength;
float type_15_interaction_recovery_time;
u32 type_15_bottom_color;
u32 type_15_top_color;
bool type_15_use_noise_color;
bool type_15_use_custom_noise_palette;
u32 type_15_noise_color_stop_0_color;
u32 type_15_noise_color_stop_1_color;
u32 type_15_noise_color_stop_2_color;
u32 type_15_noise_color_stop_3_color;
}LDKGrassSystem;
Initialize a useful default grass type description.
LDK_API void ldk_grass_type_desc_defaults(LDKGrassTypeDesc *out_desc);
LDKGrassTypeDesc *out_descReturn the active configuration index for name, or INVALID when absent.
LDK_API LDKGrassTypeId ldk_grass_get_id_by_name(const char *name);
const char *nameThe requested value.
True when type_id names a configured slot in the active GrassSystem.
LDK_API bool ldk_grass_type_is_valid(LDKGrassTypeId type_id);
LDKGrassTypeId type_idTrue when the queried condition holds; false otherwise.
Copy one configured type from the active GrassSystem.
LDK_API bool ldk_grass_type_get(
LDKGrassTypeId type_id,
LDKGrassTypeDesc *out_desc
);
LDKGrassTypeId type_idLDKGrassTypeDesc *out_descTrue if the operation succeeds; false otherwise.
Register an additional type in the first free runtime slot. Names must be unique. Returns INVALID when the system is inactive, the description is invalid, the name already exists, or all 16 slots are occupied.
LDK_API LDKGrassTypeId ldk_grass_type_register(const LDKGrassTypeDesc *desc);
const LDKGrassTypeDesc *descThe requested value.
Initialize an empty one-square-unit patch with density scale 1.
LDK_API void ldk_grass_patch_desc_defaults(LDKGrassPatchDesc *out_desc);
LDKGrassPatchDesc *out_descReturn an invalid grass patch handle.
LDK_API LDKGrassPatch ldk_grass_patch_null(void);
An invalid or empty handle.
True while patch identifies a live entry in the active GrassSystem.
LDK_API bool ldk_grass_patch_is_valid(LDKGrassPatch patch);
LDKGrassPatch patchTrue when the queried condition holds; false otherwise.
Generate and retain one patch using a configured grass type.
LDK_API LDKGrassPatch ldk_grass_add(
LDKGrassTypeId type_id,
const LDKGrassPatchDesc *desc
);
LDKGrassTypeId type_idconst LDKGrassPatchDesc *descThe requested value.
Replace a patch recipe and regenerate its persistent blade transforms.
LDK_API bool ldk_grass_update(
LDKGrassPatch patch,
LDKGrassTypeId type_id,
const LDKGrassPatchDesc *desc
);
LDKGrassPatch patchLDKGrassTypeId type_idconst LDKGrassPatchDesc *descTrue if the operation succeeds; false otherwise.
Remove a patch and every opaque blade belonging to it.
LDK_API bool ldk_grass_remove(LDKGrassPatch patch);
LDKGrassPatch patchTrue if the operation succeeds; false otherwise.
Remove every live patch. Renderer-side style resources remain cached.
LDK_API void ldk_grass_clear(void);
Queue one world-space grass interaction capsule for the active GrassSystem. Passing the same point for from and to produces a circular interaction. The queued interaction is consumed by the GrassSystem render update.
LDK_API bool ldk_grass_interact(
Vec3 from,
Vec3 to,
float radius,
float strength
);
Vec3 fromVec3 tofloat radiusfloat strengthTrue if the operation succeeds; false otherwise.