docs(examples): immediate-mode rendering example + guide (A5)#159
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the missing Immediate-Render example + guide for v0.14 Phase 4D (PR-3 / Backlog A5). The
drawGeometry/RenderBatch+drawBatchAPI shipped in #150/#151 but had no example or guide page; this closes that gap.Example —
geometry-graphics/immediate-mode-renderingA node-free, procedural scene:
drawGeometry— 14 procedural gears (regular polygons built as interleavedposition+colorgeometry), each drawn individually with its own raw worldMatrixand tint. One draw call each.RenderBatch+drawBatch— a field of 2,400 sparks of one shared static geometry, rebuilt each frame and submitted as a single instanced draw call.mountControls) showscontext.stats.drawCalls, and amountControlPaneltoggle flips the spark field between the instanced batch and onedrawGeometryper spark, so the draw-call count visibly jumps from a handful to thousands — proving the batch is one draw call.Guide —
rendering/immediate-mode.mdxNew advanced chapter in the Rendering part: when to use immediate mode vs. the retained scene graph, building standard-layout geometry,
drawGeometry,RenderBatch/drawBatch, and readingRenderStats.drawCalls. Embeds the example via<ExamplePreview>. Registered inguide-structure.tswith examples + apiLinks (rendering-context, render-batch, geometry, matrix, color).Verification (all green locally)
pnpm typecheck:examples✅pnpm typecheck:guides✅pnpm lint✅ (0 errors; 4 pre-existing warnings ininput/keyboard.js)pnpm format:check✅examples:sync-generated.jscommitted;examples.jsonentry added by handNotes
src/changes — examples + docs only.backend: "core"(uses the backend-agnosticRenderingContextimmediate path).