simvx.graphics.renderer.game_viewport¶
Game Viewport Renderer — offscreen render target for in-editor game preview.
Renders the game scene through the forward renderer into an offscreen RenderTarget, then exposes it as a bindless texture for Draw2D to display in the editor’s viewport panel.
Follows the same pattern as PostProcessPass: render to offscreen target in pre_render, sample the result as a texture in the main pass.
Usage: gvp = GameViewportRenderer(engine) gvp.create(width, height)
# In pre_render (before main render pass):
gvp.begin_pass(cmd)
scene_renderer.render_scene_content(cmd)
gvp.end_pass(cmd)
# In Draw2D (inside main render pass):
Draw2DTexture.draw_texture(gvp.texture_id, x, y, w, h)
# Cleanup:
gvp.destroy()
Module Contents¶
Classes¶
Manages an offscreen render target for rendering the game scene. |
Data¶
API¶
- simvx.graphics.renderer.game_viewport.__all__¶
[‘GameViewportRenderer’]
- class simvx.graphics.renderer.game_viewport.GameViewportRenderer(engine: Any)[source]¶
Manages an offscreen render target for rendering the game scene.
The rendered result is registered as a bindless texture so Draw2D can display it as a textured quad in the editor viewport panel.
Also owns a
Draw2DPasscompiled against the offscreen render pass, allowing game tree 2D overlays (Labels, Panels, customdraw()calls) to be rendered into the same target as the 3D scene.Initialization
- create(width: int, height: int) None[source]¶
Create the offscreen render target and register its texture.
Uses R16G16B16A16_SFLOAT to match the HDR render pass format, ensuring pipeline compatibility with the 3D pipelines (which are compiled against the HDR offscreen render pass).
- resize(width: int, height: int) None[source]¶
Recreate the render target at a new size.
Preserves the bindless texture slot across resizes: the slot id the editor handed out stays stable, only the backing image view changes. Draw2D tickets that captured the old id keep working.
- render_draw2d(cmd: Any, batches: list) None[source]¶
Render pre-extracted Draw2D batches into the offscreen target.
Call AFTER end_pass (3D content) to overlay 2D game content. Begins its own render pass with LOAD_OP_LOAD to preserve 3D content.
- property texture_id: int¶
Bindless texture index for Draw2D, or -1 if not created.
- property width: int¶
- property height: int¶
- property ready: bool¶
True when the render target is created and ready for rendering.