LDK_GRASS_PROFILE_POINT_COUNT

#define LDK_GRASS_PROFILE_POINT_COUNT 4u

LDK_GRASS_MIN_SIDE_COUNT

#define LDK_GRASS_MIN_SIDE_COUNT 3u

LDK_GRASS_MAX_SIDE_COUNT

#define LDK_GRASS_MAX_SIDE_COUNT 8u

LDK_GRASS_TYPE_ID_INVALID

#define LDK_GRASS_TYPE_ID_INVALID UINT32_MAX

LDKGrassBladeTopology

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,
  /** Deprecated source-compatible name for the original thorny prototype. */LDK_GRASS_BLADE_TOPOLOGY_THORNY_RIBBON=LDK_GRASS_BLADE_TOPOLOGY_THORNY_STEM
}LDKGrassBladeTopology;

LDKGrassBladePreset

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
}LDKGrassBladePreset;
Struct in ldk_grass_system.h

LDKGrassProfilePoint

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;
Struct in ldk_grass_system.h

LDKGrassPlane

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;
Struct in ldk_grass_system.h

LDKGrassTypeDesc

Seconds until interaction deformation fully returns to rest. Zero uses the default.

typedef struct LDKGrassTypeDesc{
  XSmallstr name;
  LDKGrassBladePreset blade_preset;
  float density;
  float min_height;
  float max_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;
}LDKGrassTypeDesc;
Struct in ldk_grass_system.h

LDKGrassPatchDesc

Per-region state. Visual configuration comes from LDKGrassSystem.

typedef struct LDKGrassPatchDesc{
  LDKGrassPlane plane;
  float density_scale;
  u32 seed;
}LDKGrassPatchDesc;
Struct in ldk_grass_system.h

LDKGrassPatch

Opaque identity of one patch. Individual blades are intentionally hidden.

typedef struct LDKGrassPatch{
  u32 index;
  u32 version;
}LDKGrassPatch;
Function in ldk_grass_system.h

ldk_grass_system_initialize

Initialize the grass system.

int ldk_grass_system_initialize(void *data);

Parameters

void *data
Source data or system-owned context for this operation.

Returns

System initialization status code.

Function in ldk_grass_system.h

ldk_grass_system_update

Update the grass system.

void ldk_grass_system_update(
 void *data,
 const LDKEntityGroup *group,
 float dt
);

Parameters

void *data
Source data or system-owned context for this operation.
const LDKEntityGroup *group
Entity group used for this system update.
float dt
Elapsed time since the preceding update, in seconds.
Function in ldk_grass_system.h

ldk_grass_system_terminate

Shut down the grass system.

void ldk_grass_system_terminate(void *data);

Parameters

void *data
Source data or system-owned context for this operation.
Struct in ldk_grass_system.h

LDKGrassSystem

Animation cycles per second.

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;
  float specular;
  float shininess;
  float emission;
  bool casts_shadows;
  XSmallstr type_0_name;
  LDKGrassBladePreset type_0_blade_preset;
  float type_0_density;
  float type_0_min_height;
  float type_0_max_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;
  XSmallstr type_1_name;
  LDKGrassBladePreset type_1_blade_preset;
  float type_1_density;
  float type_1_min_height;
  float type_1_max_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;
  XSmallstr type_2_name;
  LDKGrassBladePreset type_2_blade_preset;
  float type_2_density;
  float type_2_min_height;
  float type_2_max_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;
  XSmallstr type_3_name;
  LDKGrassBladePreset type_3_blade_preset;
  float type_3_density;
  float type_3_min_height;
  float type_3_max_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;
  XSmallstr type_4_name;
  LDKGrassBladePreset type_4_blade_preset;
  float type_4_density;
  float type_4_min_height;
  float type_4_max_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;
  XSmallstr type_5_name;
  LDKGrassBladePreset type_5_blade_preset;
  float type_5_density;
  float type_5_min_height;
  float type_5_max_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;
  XSmallstr type_6_name;
  LDKGrassBladePreset type_6_blade_preset;
  float type_6_density;
  float type_6_min_height;
  float type_6_max_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;
  XSmallstr type_7_name;
  LDKGrassBladePreset type_7_blade_preset;
  float type_7_density;
  float type_7_min_height;
  float type_7_max_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;
  XSmallstr type_8_name;
  LDKGrassBladePreset type_8_blade_preset;
  float type_8_density;
  float type_8_min_height;
  float type_8_max_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;
  XSmallstr type_9_name;
  LDKGrassBladePreset type_9_blade_preset;
  float type_9_density;
  float type_9_min_height;
  float type_9_max_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;
  XSmallstr type_10_name;
  LDKGrassBladePreset type_10_blade_preset;
  float type_10_density;
  float type_10_min_height;
  float type_10_max_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;
  XSmallstr type_11_name;
  LDKGrassBladePreset type_11_blade_preset;
  float type_11_density;
  float type_11_min_height;
  float type_11_max_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;
  XSmallstr type_12_name;
  LDKGrassBladePreset type_12_blade_preset;
  float type_12_density;
  float type_12_min_height;
  float type_12_max_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;
  XSmallstr type_13_name;
  LDKGrassBladePreset type_13_blade_preset;
  float type_13_density;
  float type_13_min_height;
  float type_13_max_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;
  XSmallstr type_14_name;
  LDKGrassBladePreset type_14_blade_preset;
  float type_14_density;
  float type_14_min_height;
  float type_14_max_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;
  XSmallstr type_15_name;
  LDKGrassBladePreset type_15_blade_preset;
  float type_15_density;
  float type_15_min_height;
  float type_15_max_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;
}LDKGrassSystem;
Function in ldk_grass_system.h

ldk_grass_get_id_by_name

Return the active configuration index for name, or INVALID when absent.

LDK_API LDKGrassTypeId ldk_grass_get_id_by_name(const char *name);

Parameters

const char *name
Name identifying the object or setting.

Returns

The requested value.

Function in ldk_grass_system.h

ldk_grass_type_is_valid

True when type_id names a configured slot in the active GrassSystem.

LDK_API bool ldk_grass_type_is_valid(LDKGrassTypeId type_id);

Parameters

LDKGrassTypeId type_id
Identifier of the type.

Returns

True when the queried condition holds; false otherwise.

Function in ldk_grass_system.h

ldk_grass_type_register

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);

Parameters

const LDKGrassTypeDesc *desc
Description or configuration for this operation.

Returns

The requested value.

Function in ldk_grass_system.h

ldk_grass_patch_is_valid

True while patch identifies a live entry in the active GrassSystem.

LDK_API bool ldk_grass_patch_is_valid(LDKGrassPatch patch);

Parameters

LDKGrassPatch patch
Patch used by this operation.

Returns

True when the queried condition holds; false otherwise.

Function in ldk_grass_system.h

ldk_grass_remove

Remove a patch and every opaque blade belonging to it.

LDK_API bool ldk_grass_remove(LDKGrassPatch patch);

Parameters

LDKGrassPatch patch
Patch used by this operation.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_grass_system.h

ldk_grass_clear

Remove every live patch. Renderer-side style resources remain cached.

LDK_API void ldk_grass_clear(void);
Function in ldk_grass_system.h

ldk_grass_interact

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
);

Parameters

Vec3 from
World-space start of the interaction segment.
Vec3 to
World-space end of the interaction segment.
float radius
Interaction or geometry radius.
float strength
Strength of the interaction.

Returns

True if the operation succeeds; false otherwise.