Surface Quad Shader Program
Surface-quad fragment shader that maps any planar quadrilateral footprint to a unit-square image space via a 2D homography (3x3 perspective transform). The homography is the inverse of the perspective projection a planar source image has on a planar ground patch, and is uniquely determined by the four corner correspondences. For rectangular footprints the homography reduces to an affine transform, identical to bilinear interpolation, so axis-aligned earth.worldwind.shape.ProjectedMediaSurface usages don't change. For trapezoidal footprints (as produced by a tilted drone gimbal) the homography is the mathematically correct interior interpolation; bilinear gives a different, incorrect result that diverges from a true perspective the further you stray from the corners.
The matrix is computed CPU-side from the four ground corners + the unit-square image corners and uploaded as the homography uniform per draw. The vertex shader passes the geographic position to the fragment shader as a varying; the fragment stage applies the homography to the interpolated geographic position and divides by w to land in image UV space, then runs the standard texCoordMatrix and texture sample.
Inheritors
Properties
Functions
Load the ground-to-image Matrix3 for this draw. The fragment shader applies it to each fragment's local (lon, lat) and divides by w to land in unit-square image space. Skips the upload when the matrix matches what's already on the GPU - covers the common case of static photos and paused video, where re-binding the same surface drawable on every render frame would otherwise re-upload an unchanged value.
Frees any resources associated with this instance. After this method returns the rendering resource is invalid, and any associated GL object is deleted.