Skip to content

v2.4.0

Latest

Choose a tag to compare

@mario-deluna mario-deluna released this 08 Jul 21:28
· 11 commits to master since this release
ebbf82d

Features

Draw Call Assembler

A new native rendering component (GL\Rendering\DrawCallAssembler) between your scene and OpenGL. Submit per-object draw requests (mesh + transform + material); it handles frustum culling, LOD selection, sorting, and instanced batching in C, then draws for you or hands back GPU-ready buffers - built to push millions of instances per frame.

s

The 09_drawcall_assembler.php example renders a 10,000,000-instance asteroid field with live camera culling. On my MacBook M1:

octree | submitted 10000000, visible 35 (100.0% culled), draw calls: 28, avg execute: 2.129ms, avg frame: 8.558ms (116.9 FPS)
  • Mesh registry & instancing - register a VAO once, then submit() transforms against its handle. Adjacent draws sharing mesh/material/pass/program auto-collapse into a single instanced call (indexed or array draws).
  • Culling - CULL_NONE, CULL_LINEAR (per-instance frustum test), or CULL_OCTREE (persistent tree reused across frames, ideal for large static scenes). Frustum derived from setCameraData() or set manually.
  • LOD - per-mesh distance tables via setLodTable(), with per-instance caching.
  • Sorting - front-to-back / back-to-front / per-pass, using packed 64-bit keys and an adaptive radix/quicksort/insertion sort to minimize state changes.
  • Two render paths - execute(callback) draws for you (owns the transform VBO internally), or build() fills GPU-ready buffers for your own loop.
  • Per-instance payload - attach arbitrary per-instance float data that travels through culling and sorting (bindPayloadData() / bindPayloadBuffer()).
  • Stats - instanceCount(), builtInstanceCount(), commandCount() for cull rate and draw-call counts.

SVG parsing & rendering

Parse SVG documents and draw them straight into the NanoVG vector-graphics context as real vector paths - no rasterization step.

s
  • Parse from anywhere - SVGImage::fromDisk() loads a .svg file; SVGImage::fromString() parses in-memory markup. Parsed images are reusable and expose their native width / height.
  • Vector rendering - VGContext::drawSVG($svg, $x, $y, $w, $h) renders the paths into the current frame; omit $w/$h to draw at native size, or pass them to scale to fit.
  • Fills, strokes & masks - solid fills and strokes are rendered, and alpha masks (mask="url(#id)") are honoured as a 1-bit hard-edged clip. Gradient paints are skipped for now.

HDR texture support

GL\Texture\Texture2D now handles High Dynamic Range images end to end. LDR images continue to load into a UByteBuffer; HDR images load into a FloatBuffer so pixel values are preserved beyond the 0–1 range.

  • Automatic detection - Texture2D::fromDisk() detects .hdr files and loads them into a FloatBuffer automatically; use isHDR() to tell which buffer type you got.
  • Load from memory - Texture2D::fromBufferHDR() builds an HDR texture directly from a float FloatBuffer.
  • Write to disk - writeHDR() exports HDR textures to .hdr.

What's Changed

New Contributors

Full Changelog: v2.3.0...v2.4.0