Struct in ldk_renderer.h

LDKRendererMeshDesc

typedef struct LDKRendererMeshDesc{
  const LDKMeshVertex *vertices;
  u32 vertex_count;
  const u32 *indices;
  u32 index_count;
  bool has_tangents;
}LDKRendererMeshDesc;
Struct in ldk_renderer.h

LDKRendererMeshPass

typedef struct LDKRendererMeshPass{
  LDKRHIContext *rhi;
  LDKRHIShaderModule vertex_shader_module;
  LDKRHIShaderModule instanced_vertex_shader_module;
  LDKRHIShaderModule fragment_shader_module;
  LDKRHIShaderModule overlay_fragment_shader_module;
  LDKRHIShaderModule solid_unlit_fragment_shader_module;
  LDKRHIShaderModule textured_fragment_shader_module;
  LDKRHIShaderModule textured_unlit_fragment_shader_module;
  LDKRHIShaderModule textured_cutout_fragment_shader_module;
  LDKRHIShaderModule textured_unlit_cutout_fragment_shader_module;
  LDKRHIShaderModule vegetation_vertex_shader_module;
  LDKRHIShaderModule vegetation_instanced_vertex_shader_module;
  LDKRHIShaderModule vegetation_fragment_shader_module;
  LDKRHIShaderModule terrain_vertex_shader_module;
  LDKRHIShaderModule terrain_fragment_shader_module;
  LDKRHIBindingsLayout bindings_layout;
  LDKRHIPipeline vertex_color_pipeline;
  LDKRHIPipeline vertex_color_unlit_pipeline;
  LDKRHIPipeline vertex_color_blend_pipeline;
  LDKRHIPipeline vertex_color_unlit_blend_pipeline;
  LDKRHIPipeline overlay_pipeline;
  LDKRHIPipeline wireframe_pipeline;
  LDKRHIPipeline textured_pipeline;
  LDKRHIPipeline textured_unlit_pipeline;
  LDKRHIPipeline textured_overlay_pipeline;
  LDKRHIPipeline textured_cutout_pipeline;
  LDKRHIPipeline textured_unlit_cutout_pipeline;
  LDKRHIPipeline textured_unlit_cutout_overlay_pipeline;
  LDKRHIPipeline textured_blend_pipeline;
  LDKRHIPipeline textured_unlit_blend_pipeline;
  LDKRHIPipeline vertex_color_instanced_pipeline;
  LDKRHIPipeline vertex_color_unlit_instanced_pipeline;
  LDKRHIPipeline vertex_color_blend_instanced_pipeline;
  LDKRHIPipeline vertex_color_unlit_blend_instanced_pipeline;
  LDKRHIPipeline textured_instanced_pipeline;
  LDKRHIPipeline textured_unlit_instanced_pipeline;
  LDKRHIPipeline textured_cutout_instanced_pipeline;
  LDKRHIPipeline textured_unlit_cutout_instanced_pipeline;
  LDKRHIPipeline textured_blend_instanced_pipeline;
  LDKRHIPipeline textured_unlit_blend_instanced_pipeline;
  LDKRHIPipeline vegetation_pipeline;
  LDKRHIPipeline vegetation_instanced_pipeline;
  LDKRHIPipeline terrain_pipeline;
  LDKRHIBuffer camera_buffer;
  LDKRHIBuffer object_buffer;
  LDKRHIBuffer material_buffer;
  LDKRHIBuffer lighting_buffer;
  LDKRHIBuffer instance_buffer;
  LDKRHIBuffer instance_color_buffer;
  LDKRHIBuffer instance_uv_buffer;
  u32 instance_capacity;
  Mat4 *staging_worlds;
  LDKRHIColor *staging_colors;
  Vec4 *staging_uvs;
  u32 staging_capacity;
  LDKRHITexture shadow_texture;
  LDKRHISampler shadow_sampler;
  LDKRHITexture flat_normal_texture;
  LDKRHITexture white_specular_texture;
  LDKRHISampler fallback_sampler;
  LDKRHIBindings bindings;
  LDKRHIBindings vegetation_bindings;
  LDKRendererMeshBindingsCacheEntry *material_bindings_cache;
  u32 material_bindings_cache_count;
  u32 material_bindings_cache_capacity;
  bool is_initialized;
}LDKRendererMeshPass;
Struct in ldk_renderer.h

LDKRendererMeshResource

typedef struct LDKRendererMeshResource{
  LDKRHIBuffer vertex_buffer;
  LDKRHIBuffer index_buffer;
  u32 vertex_count;
  u32 index_count;
  u32 vertex_capacity;
  u32 index_capacity;
  LDKAssetMesh source_asset;
  u32 source_mesh_index;
  u32 ref_count;
  bool shared_asset_mesh;
  bool alive;
}LDKRendererMeshResource;
Enum in ldk_renderer.h

LDKRendererMeshSubmitFlag

typedef enum LDKRendererMeshSubmitFlag{
  LDK_RENDERER_MESH_SUBMIT_FLAG_NONE=0,
  LDK_RENDERER_MESH_SUBMIT_FLAG_OVERLAY=1<<0,
  LDK_RENDERER_MESH_SUBMIT_FLAG_CAST_SHADOWS=1<<1,
  LDK_RENDERER_MESH_SUBMIT_FLAG_BILLBOARD=1<<2,
  LDK_RENDERER_MESH_SUBMIT_FLAG_SCREEN_SPACE=1<<3
}LDKRendererMeshSubmitFlag;
Function in ldk_renderer.h

ldk_renderer_mesh_create

Create a renderer-owned mesh resource. The renderer uploads the supplied CPU-side vertex and index data into renderer-owned RHI buffers, stores those buffers in the renderer mesh cache, and returns a renderer resource handle. The source vertex and index arrays are only needed during creation. After the mesh is created, the returned resource does not depend on the original CPU buffers.

LDK_API LDKResourceMesh ldk_renderer_mesh_create(
 LDKRenderer *renderer,
 LDKRendererMeshDesc const *desc
);

Parameters

LDKRenderer *renderer
Renderer that will own the mesh resource.
LDKRendererMeshDesc const *desc
Mesh creation description containing vertices and indices.

Returns

Mesh resource handle, or an invalid handle on failure.

Function in ldk_renderer.h

ldk_renderer_mesh_destroy

Destroy a renderer-owned mesh resource. The renderer resolves the mesh handle, destroys the underlying RHI vertex and index buffers, and releases the renderer mesh cache slot. Destroying an invalid or already-dead mesh handle is a no-op. Mesh resources are also destroyed automatically when the renderer is terminated.

LDK_API void ldk_renderer_mesh_destroy(
 LDKRenderer *renderer,
 LDKResourceMesh mesh
);

Parameters

LDKRenderer *renderer
Renderer that ownss the mesh resource.
LDKResourceMesh mesh
Mesh resource handle to destroy.
Function in ldk_renderer.h

ldk_renderer_mesh_is_valid

Check whether a mesh resource handle refers to a live renderer mesh. The handle is validated against the renderer that owns the mesh resource. A non-zero handle is not enough to prove validity; the resource must still exist in the renderer mesh cache.

LDK_API bool ldk_renderer_mesh_is_valid(
 LDKRenderer *renderer,
 LDKResourceMesh mesh
);

Parameters

LDKRenderer *renderer
Renderer that owns the mesh resource.
LDKResourceMesh mesh
Mesh resource handle to validate.

Returns

true if the mesh is valid and alive, false otherwise.

Function in ldk_renderer.h

ldk_renderer_mesh_null

Return an invalid mesh resource handle. This is the renderer mesh equivalent of a null handle. It can be used to initialize mesh fields or to represent the absence of a mesh.

LDK_API LDKResourceMesh ldk_renderer_mesh_null(void);

Returns

Invalid mesh resource handle.

Function in ldk_renderer.h

ldk_renderer_submit_orthographic_overlay_mesh_to_view

Submit a view-local orthographic overlay mesh in framebuffer pixels. The submitted world transform is in view-relative pixels: X right, Y up, origin at the bottom-left of the render target. Z represents an arbitrary local depth. The viewport-independent orthographic camera applies no perspective foreshortening. These meshes render after ordinary overlays, without scene depth testing. Intended for editor handles.

LDK_API bool ldk_renderer_submit_orthographic_overlay_mesh_to_view(
 LDKRenderer *renderer,
 LDKRendererViewId view_id,
 LDKResourceMesh mesh,
 LDKResourceMaterial material,
 Mat4 pixel_transform
);

Parameters

LDKRenderer *renderer
Renderer receiving this request.
LDKRendererViewId view_id
Renderer view receiving this operation.
LDKResourceMesh mesh
Mesh resource used by the operation.
LDKResourceMaterial material
Material used by the operation.
Mat4 pixel_transform
Pixel transform used by this operation.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_renderer.h

ldk_renderer_submit_overlay_mesh_to_view

Submit a mesh as a view-local overlay for this frame. Overlay meshes are rendered after regular meshes for the selected view, with depth testing and depth writes disabled. This makes them independent of the scene depth buffer and suitable for editor gizmos.

LDK_API bool ldk_renderer_submit_overlay_mesh_to_view(
 LDKRenderer *renderer,
 LDKRendererViewId view_id,
 LDKResourceMesh mesh,
 LDKResourceMaterial material,
 Mat4 world
);

Parameters

LDKRenderer *renderer
Renderer instance.
LDKRendererViewId view_id
ID of the only view that should draw this mesh.
LDKResourceMesh mesh
Mesh resource handle to render.
LDKResourceMaterial material
Material resource handle to use.
Mat4 world
World transform for this mesh instance.

Returns

true if the mesh was queued, false otherwise.

Function in ldk_renderer.h

ldk_renderer_submit_wireframe_mesh_to_view

Submit a depth-tested wireframe mesh to one render view. The mesh is drawn after scene meshes and before editor overlays. It uses the scene depth buffer without writing depth, so hidden geometry remains occluded by the rendered scene. Color uses 0xRRGGBBAA and supports alpha blending. line_width is requested in pixels and may be clamped by the RHI backend. flags accepts LDK_RENDERER_MESH_SUBMIT_FLAG_BILLBOARD only.

LDK_API bool ldk_renderer_submit_wireframe_mesh_to_view(
 LDKRenderer *renderer,
 LDKRendererViewId view_id,
 LDKResourceMesh mesh,
 Mat4 world,
 u32 color,
 float line_width,
 u32 flags
);

Parameters

LDKRenderer *renderer
Renderer receiving this request.
LDKRendererViewId view_id
Renderer view receiving this operation.
LDKResourceMesh mesh
Mesh resource used by the operation.
Mat4 world
Object-to-world transformation matrix.
u32 color
Color value used by the operation.
float line_width
Line width used by this operation.
u32 flags
Bitmask of options controlling this operation.

Returns

True if the operation succeeds; false otherwise.