Class SDFRectGeoProc

java.lang.Object
icyllis.arc3d.granite.GeometryStep
icyllis.arc3d.granite.geom.SDFRectGeoProc

public class SDFRectGeoProc extends GeometryStep
Generates rectangle geometric primitive, uses instanced rendering.

Signed distance function (exact):


 float sdBox(vec2 p, vec2 b) {
     vec2 q = abs(p)-b;
     return length(max(q,0.0)) + min(max(q.x,q.y),0.0);
 }
 

Descriptor:

  • 0-1 bits: use distance-to-edge antialiasing
  • 1-2 bits: fill/stroke
  • 2-3 bits: use instanced view matrix

 struct Instance {
     ubyte4/float4 color; // premultiplied color
     float4 box;          // rectangle (radius x, center x, radius y, center y) in local space
     float2 stroke;       // optional (stroke radius, stroke position)
     float3 viewMatrix[3]; // optional view matrix
 }