LDKTerrainChannel

typedef enum LDKTerrainChannel{
  LDK_TERRAIN_CHANNEL_R=0,
  LDK_TERRAIN_CHANNEL_G,
  LDK_TERRAIN_CHANNEL_B,
  LDK_TERRAIN_CHANNEL_A
}LDKTerrainChannel;
Function in ldk_terrain_system.h

ldk_terrain_heightmap_set

Assign a heightmap image to the terrain system.

LDK_API bool ldk_terrain_heightmap_set(LDKAssetImage image);

Parameters

LDKAssetImage image
Image used by this operation.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_terrain_system.h

ldk_terrain_system_is_active

Check whether the terrain system is active.

LDK_API bool ldk_terrain_system_is_active(void);

Returns

True when the queried condition holds; false otherwise.

Function in ldk_terrain_system.h

ldk_terrain_height_at_world

Query terrain height at a world-space X/Z point.

LDK_API bool ldk_terrain_height_at_world(
 float world_x,
 float world_z,
 float *out_height
);

Parameters

float world_x
World-space X coordinate.
float world_z
World-space Z coordinate.
float *out_height
Receives the surface height in world-space units.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_terrain_system.h

ldk_terrain_system_initialize

Initialize the terrain system.

int ldk_terrain_system_initialize(void *data);

Parameters

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

Returns

System initialization status code.

Function in ldk_terrain_system.h

ldk_terrain_system_update

Update the terrain system.

void ldk_terrain_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_terrain_system.h

ldk_terrain_system_terminate

Shut down the terrain system.

void ldk_terrain_system_terminate(void *data);

Parameters

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

LDKTerrainSystem

typedef struct LDKTerrainSystem{
  LDKAssetImage heightmap;
  LDKTerrainChannel height_channel;
  float cell_size;
  float height_scale;
  float height_offset;
  bool center_on_origin;
  float origin_x;
  float origin_z;
  u32 chunk_size;
  LDKAssetMaterial material;
  LDKAssetTextureAtlas texture_atlas;
  u32 surface_count;
  XSmallstr surface_0_name;
  float surface_0_min_height;
  float surface_0_blend_width;
  rgba32 surface_0_color;
  u64 surface_0_sprite_id;
  Vec2 surface_0_uv_scale;
  float surface_0_texture_weight;
  XSmallstr surface_1_name;
  float surface_1_min_height;
  float surface_1_blend_width;
  rgba32 surface_1_color;
  u64 surface_1_sprite_id;
  Vec2 surface_1_uv_scale;
  float surface_1_texture_weight;
  XSmallstr surface_2_name;
  float surface_2_min_height;
  float surface_2_blend_width;
  rgba32 surface_2_color;
  u64 surface_2_sprite_id;
  Vec2 surface_2_uv_scale;
  float surface_2_texture_weight;
  XSmallstr surface_3_name;
  float surface_3_min_height;
  float surface_3_blend_width;
  rgba32 surface_3_color;
  u64 surface_3_sprite_id;
  Vec2 surface_3_uv_scale;
  float surface_3_texture_weight;
  XSmallstr surface_4_name;
  float surface_4_min_height;
  float surface_4_blend_width;
  rgba32 surface_4_color;
  u64 surface_4_sprite_id;
  Vec2 surface_4_uv_scale;
  float surface_4_texture_weight;
  XSmallstr surface_5_name;
  float surface_5_min_height;
  float surface_5_blend_width;
  rgba32 surface_5_color;
  u64 surface_5_sprite_id;
  Vec2 surface_5_uv_scale;
  float surface_5_texture_weight;
  XSmallstr surface_6_name;
  float surface_6_min_height;
  float surface_6_blend_width;
  rgba32 surface_6_color;
  u64 surface_6_sprite_id;
  Vec2 surface_6_uv_scale;
  float surface_6_texture_weight;
  XSmallstr surface_7_name;
  float surface_7_min_height;
  float surface_7_blend_width;
  rgba32 surface_7_color;
  u64 surface_7_sprite_id;
  Vec2 surface_7_uv_scale;
  float surface_7_texture_weight;
  bool casts_shadows;
  u32 data_width;
  u32 data_height;
  u32 chunk_count;
  u32 visible_chunk_count;
  u32 mesh_update_count;
  bool has_geometry;
}LDKTerrainSystem;