simvx.graphics.renderer.forward¶
Default renderer: Vulkan forward path; implements the RendererBackend ABC.
Module Contents¶
Classes¶
Default Vulkan forward renderer: multi-draw indirect, per-viewport frustum culling. |
Data¶
API¶
- simvx.graphics.renderer.forward.__all__¶
[‘Renderer’]
- simvx.graphics.renderer.forward.log¶
‘getLogger(…)’
- class simvx.graphics.renderer.forward.Renderer(engine: Any, max_objects: int = 10000)[source]¶
Bases:
simvx.graphics.renderer._base.RendererBackendDefault Vulkan forward renderer: multi-draw indirect, per-viewport frustum culling.
Initialization
- set_skybox(cubemap: simvx.graphics.engine.CubemapHandle) None[source]¶
Set a cubemap as the skybox and run the IBL precompute.
Accepts a :class:
~simvx.graphics.engine.CubemapHandlereturned by- Meth:
Engine.load_cubemap. The renderer takes ownership of the underlying Vulkan resources and destroys them at shutdown. IBL precompute (irradiance + prefiltered specular + BRDF LUT) is run once per unique handle and cached, mirroring the web renderer’sIBLPass._byCubemapIdlazy-precompute behaviour. Re-setting the same handle is a no-op past the cache check.
- property post_processing: simvx.graphics.renderer.post_process.PostProcessPass | None[source]¶
Access post-processing pass for configuration.
- property custom_post_processing: simvx.graphics.renderer.custom_post_process.CustomPostProcessPass | None[source]¶
Access custom user post-process pass for configuration.
- set_gizmo_data(data: simvx.graphics.renderer.gizmo_pass.GizmoRenderData | None) None[source]¶
Set gizmo render data for the current frame (or None to hide).
- property ssao: simvx.graphics.renderer.ssao_pass.SSAOPass | None[source]¶
Access SSAO pass for configuration.
- set_materials(materials: numpy.ndarray) None[source]¶
Set material array and upload to GPU (skips if unchanged).
- set_lights(lights: numpy.ndarray) None[source]¶
Set light array and upload to GPU (skips if unchanged).
Prepends uint32 light_count to match GLSL LightBuffer layout: [uint32 count][Light[0]][Light[1]]…
- capture_reflection_probes(adapter: Any) bool[source]¶
Capture any new / requested reflection probes. Returns True if any captured.
Driven from the app’s pre_render hook (before the main render pass) so a capture this frame is visible the same frame. Probe face rendering reuses the offscreen scene path and clobbers per-frame submission lists, so the caller must re-submit the main scene when this returns True: exactly the SubViewport contract.
- submit_text(text: str, x: float, y: float, font_path: str | None = None, size: float = 24.0, colour: tuple = (1.0, 1.0, 1.0, 1.0)) None[source]¶
Submit text for 2D overlay rendering.
- init(device: Any, swapchain: Any) None[source]¶
Initialize (called by ABC contract: use setup() instead).
- submit_instance(mesh_handle: simvx.graphics.types.MeshHandle, transform: numpy.ndarray, material_id: int = 0, viewport_id: int = 0) None[source]¶
Submit a mesh instance for rendering this frame.
- submit_multimesh(mesh_handle: simvx.graphics.types.MeshHandle, transforms: numpy.ndarray, material_id: int = 0, material_ids: numpy.ndarray | None = None, viewport_id: int = 0) None[source]¶
Bulk-submit many instances of the same mesh: avoids per-instance Python loops.
Args: mesh_handle: Shared mesh for all instances. transforms: (N, 4, 4) float32 array of model matrices. material_id: Material index for all instances (ignored if material_ids given). material_ids: Optional (N,) uint32 array of per-instance material indices. viewport_id: Viewport index.
- submit_shader_instance(mesh_handle: simvx.graphics.types.MeshHandle, transform: numpy.ndarray, material_id: int, shader_material: Any) None[source]¶
Submit a MeshInstance3D that carries a ShaderMaterial.
The per-material pipeline is lazy-compiled + cached on first use via ShaderMaterialManager. During the forward draw, the renderer splits these submissions into their own bucket, binds the custom pipeline, updates the uniform buffer, and draws one mesh at a time, per- material pipeline switching is the cost of the custom-shader path.
- submit_particles(particle_data: numpy.ndarray) None[source]¶
Submit particle data for rendering this frame.
- submit_gpu_particles(emitter_config: dict, *, emitter_id: int = 0) None[source]¶
Submit a GPU particle emitter config for compute-shader simulation this frame.
emitter_idis a stable per-node identifier (id(node) & 0xFFFFFFFFfrom :class:SceneAdapter). :class:ParticleComputekeys its persistent SSBOs by this id so multi-emitter scenes render correctly: matches the webGPUParticlePassownership model.
- submit_occluder2d(polygon_vertices: list[tuple[float, float]]) None[source]¶
Submit a 2D occluder polygon for shadow casting this frame.
- submit_skinned_instance(mesh_handle: simvx.graphics.types.MeshHandle, transform: numpy.ndarray, material_id: int, joint_matrices: numpy.ndarray) None[source]¶
Submit a skinned mesh instance with joint matrices for this frame.
- pre_render(cmd: Any) None[source]¶
Record offscreen passes (shadow maps, HDR) before main render pass begins.
- resize(width: int, height: int) None[source]¶
Handle framebuffer resize: recreate post-process targets + 3D pipelines.
- register_mesh(vertices: numpy.ndarray, indices: numpy.ndarray) simvx.graphics.types.MeshHandle[source]¶
Register mesh data on GPU via engine’s mesh registry.
- upload_texture_pixels(pixels: numpy.ndarray, width: int, height: int) int[source]¶
Upload RGBA pixel data to GPU, return bindless texture index.
- capture_frame() numpy.ndarray[source]¶
Capture the last rendered frame as (H, W, 4) uint8 RGBA numpy array.
- __slots__¶
()