PeachDrawing

PeachDrawing.Warp

Warp.Composite(RasterSurface, RasterSurface, Homography, DepthPlane, DepthBuffer) Method

Draws source mapped by sourceToDestination<em>over</em> what destination already holds, where it is not behind what depth already holds: one plane of a 3D rendering context. plane is the depth of the same map (both are made from one 4x4 matrix). A fully opaque pixel records its depth; a translucent one does not, so it is composited over whatever was drawn before it without hiding what is behind it from a plane painted after.

public static void Composite(PeachDrawing.Core.RasterSurface source, PeachDrawing.Core.RasterSurface destination, in PeachDrawing.Homography sourceToDestination, in PeachDrawing.DepthPlane plane, PeachDrawing.DepthBuffer depth);

Parameters

source RasterSurface

destination RasterSurface

sourceToDestination Homography

plane DepthPlane

depth DepthBuffer

Remarks

Why the depth is affine in screen coordinates. A destination point maps back through the inverse to (u, v, w) = (u', v', 1) / W', where W' is the divisor the forward map divided by. The plane’s depth there is z' / W', and z' is affine in (u', v'), so it is Za * u + Zb * v + Zc * w of the inverse’s raw output: an affine function of the screen position, whose per-row slope is one subtraction. That is what lets the depth test run a row at a time in the depth-test row kernel.

Works in place row by row: one stack (or one rented) buffer per call, nothing else is allocated.