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.
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), orCULL_OCTREE(persistent tree reused across frames, ideal for large static scenes). Frustum derived fromsetCameraData()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), orbuild()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.
- Parse from anywhere -
SVGImage::fromDisk()loads a.svgfile;SVGImage::fromString()parses in-memory markup. Parsed images are reusable and expose their nativewidth/height. - Vector rendering -
VGContext::drawSVG($svg, $x, $y, $w, $h)renders the paths into the current frame; omit$w/$hto 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.hdrfiles and loads them into aFloatBufferautomatically; useisHDR()to tell which buffer type you got. - Load from memory -
Texture2D::fromBufferHDR()builds an HDR texture directly from a floatFloatBuffer. - Write to disk -
writeHDR()exports HDR textures to.hdr.
What's Changed
- PHP 8.5 Compatibility by @hmennen90 in #40
- Drawcall assembler by @mario-deluna in #39
New Contributors
- @hmennen90 made their first contribution in #40
Full Changelog: v2.3.0...v2.4.0