LDKRendererMeshBindingsCacheEntry
typedef struct LDKRendererMeshBindingsCacheEntry{
LDKRHITexture textures[LDK_MATERIAL_TEXTURE_SLOT_COUNT];
LDKRHISampler samplers[LDK_MATERIAL_TEXTURE_SLOT_COUNT];
LDKRHIBindings bindings;
}LDKRendererMeshBindingsCacheEntry;
LDKRendererMeshDesc
typedef struct LDKRendererMeshDesc{
const LDKMeshVertex *vertices;
u32 vertex_count;
const u32 *indices;
u32 index_count;
bool has_tangents;
}LDKRendererMeshDesc;
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;
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;
LDKRendererMeshSubmit
typedef struct LDKRendererMeshSubmit{
LDKResourceMesh mesh;
LDKResourceMaterial material;
u32 first_index;
u32 index_count;
Mat4 world;
LDKRendererViewId view_id;
u32 flags;
u32 instance_offset;
u32 instance_count;
LDKResourceInstanceSet instance_set;
Vec4 uv_rect;
}LDKRendererMeshSubmit;
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;
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.
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
);
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
);
Returns
true if the mesh is valid and alive, false otherwise.
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.
ldk_renderer_mesh_update
Update the renderer mesh.
LDK_API bool ldk_renderer_mesh_update(
LDKRenderer *renderer,
LDKResourceMesh mesh,
LDKRendererMeshDesc const *desc
);
Returns
True if the operation succeeds; false otherwise.
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.
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
);
Returns
true if the mesh was queued, false otherwise.
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.