Renders 3D world to active render target (updates animations/physics, multi-camera support).
Takes no parameters.
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
This function takes no parameters.
Returns
Void
Quick Summary
Renders 3D world to active render target (updates animations/physics, multi-camera support).
Takes no parameters.
Returns nothing.
Technical Exegesis...
Renders 3D world to active render target (updates animations/physics, multi-camera support). Takes no parameters. Returns nothing. Renders all visible entities from active camera's perspective to current render target (main window or canvas set by b3dSetRenderTargetCanvas), updates animations once per frame (skeletal/morph animations, physics simulation), manages camera projection matrices for multi-camera rendering. Must call b3dCls3D before this function.
This function renders the 3D scene.
Renders 3D world to active render target (updates animations/physics, multi-camera support). Takes no parameters. Returns nothing. Renders all visible entities from active camera's perspective to current render target (main window or canvas set by b3dSetRenderTargetCanvas), updates animations once per frame (skeletal/morph animations, physics simulation), manages camera projection matrices for multi-camera rendering. Must call b3dCls3D before this function.
This function renders the 3D scene. Render target: renders to g_activeCanvasID (main window if -1, canvas if >= 0), uses canvas's render target and depth buffer if rendering to canvas, main window's backbuffer if rendering to main window. Animation updates: calculates deltaTime since last frame (high_resolution_clock elapsed time), updates all skeletal animations via UpdateAllAnimations(deltaTime), updates physics simulation via UpdatePhysicsSystem(deltaTime), updates only once per frame (g_animationsUpdatedThisFrame flag prevents duplicate updates if multiple cameras render). Camera management: initializes camera handle-to-index mappings on first render (memset g_cameraHandleToIndex to -1, assigns indices 0 to activeCameraCount-1), main window rendering updates all cameras with main window dimensions (UpdateAllCameras), canvas rendering updates only active camera with canvas dimensions (UpdateCameraAtIndex for g_activeCamera), prevents aspect ratio flickering when canvases have different dimensions. Multi-camera workflow: each camera can render to different canvas (call b3dSetActiveCamera, b3dSetRenderTargetCanvas, b3dCls3D, b3dRenderWorld per camera), cameras updated with correct viewport dimensions for each target, camera projection matrices recalculated per render target. Use cases: (1) Main rendering (render entire scene to main window), (2) Multi-viewport (split-screen, multiple cameras to different canvases), (3) Render to texture (render scene to canvas for picture-in-picture, mirrors, security cameras), (4) Post-processing (render to canvas, apply effects, copy to main window), (5) UI integration (render 3D to small canvas, composite with 2D UI). Common patterns: main loop b3dCls3D() then b3dRenderWorld(), split-screen for i = 0 to 1 then b3dSetActiveCamera(cameras[i]) b3dSetRenderTargetCanvas(canvas[i]) b3dCls3D() b3dRenderWorld(), render to texture b3dSetRenderTargetCanvas(mirrorCanvas) b3dCls3D() b3dRenderWorld() then b3dSetRenderTargetCanvas(-1) b3dCls3D() b3dRenderWorld(). Typical usage: call once per frame after b3dCls3D to render visible scene, call multiple times per frame for multi-camera rendering (different viewpoints or render targets), combine with b3dSetRenderTargetCanvas for off-screen rendering. Render pipeline: frustum culling (b3dEntityInView equivalent), mesh sorting (opaque front-to-back for early-Z, transparent back-to-front for blending), shadow map rendering (if lights have castsShadows=true), main scene rendering (geometry pass with lighting, PBR shading), billboard rendering, post-processing (if enabled). Performance: GPU-bound operation (depends on triangle count, texture resolution, light count, shadow map resolution), typical cost 5-16ms for complex scenes at 1080p, optimize by reducing draw calls (instance similar meshes), lowering shadow map resolution, culling off-screen entities. Animation deltaTime: first frame assumes 60 FPS (deltaTime = 1/60 = 0.016667s), subsequent frames use actual elapsed time (high precision), ensures smooth animation regardless of framerate. First call requirement: prints error if g_currentContext == nullptr (b3dCls3D not called first), b3dCls3D must precede b3dRenderWorld every frame. Validation: returns silently if no current context, does not crash on repeated calls. Related: b3dCls3D clears render target and depth buffer (required before this), b3dSetActiveCamera selects which camera to render from, b3dSetRenderTargetCanvas selects render target (main window or canvas), b3dUpdateWorld updates physics without rendering (separate update/render).