b2dDrawImageQuadDepth

Like b2dDrawImageQuad, but each corner carries its own depth (0..1), z-tested per-pixel.

2D Overlay

Parameters & Returns

Parameters

image Int
x1 Int
y1 Int
z1 Double
x2 Int
y2 Int
z2 Double
x3 Int
y3 Int
z3 Double
x4 Int
y4 Int
z4 Double

Returns

Void

Quick Summary

Like b2dDrawImageQuad, but each corner carries its own depth (0..1), z-tested per-pixel.

Technical Exegesis...

Maps a whole image onto four arbitrary corners AND gives each corner a depth (z1..z4, 0 = near .. 1 = far). The quad is z-tested per pixel against the shared 2D depth buffer, so textured faces interpenetrate and self-occlude correctly - real 3D built from the 2D runtime, no manual sorting or backface culling. Shares the depth buffer with b2dDrawQuadDepth and b2dSetDepth, so all three occlude one another. Honours b2dSetColor (tint) and b2dSetAlpha.

Example

Example.bam
Local d:Double = (FAR * (vz - NEAR)) / (vz * (FAR - NEAR))   ; per corner
b2dDrawImageQuadDepth(crate, sx0,sy0,d0, sx1,sy1,d1, sx2,sy2,d2, sx3,sy3,d3)