Package icyllis.arc3d.granite.geom

# 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
     }

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class icyllis.arc3d.granite.GeometryStep

  `GeometryStep.ProgramImpl`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final VertexInputLayout.Attribute`
  `BOX`
  `static final VertexInputLayout.Attribute`
  `COLOR`
  Per-instance attributes.
  `static final int`
  `FLAG_ANTIALIASING`
  `static final int`
  `FLAG_INSTANCED_MATRIX`
  `static final int`
  `FLAG_STROKE`
  `static final VertexInputLayout.AttributeSet`
  `INSTANCE_ATTRIBS`
  `static final VertexInputLayout.Attribute`
  `POSITION`
  Per-vertex attributes.
  `static final VertexInputLayout.Attribute`
  `STROKE`
  `static final VertexInputLayout.AttributeSet`
  `VERTEX_ATTRIBS`
  `static final VertexInputLayout.Attribute`
  `VIEW_MATRIX`

  ### Fields inherited from class icyllis.arc3d.granite.GeometryStep

  `DEPTH, FLAG_EMIT_COVERAGE, FLAG_EMIT_PRIMITIVE_COLOR, FLAG_HANDLE_SOLID_COLOR, FLAG_HAS_TEXTURES, FLAG_OUTSET_BOUNDS_FOR_AA, FLAG_PERFORM_SHADING, MODEL_VIEW, SOLID_COLOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SDFRectGeoProc(int flags)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `appendToKey(KeyBuilder b)`
  Appends a key on the KeyBuilder that reflects any variety in the code that the geometry processor subclass can emit.
  `GeometryStep.ProgramImpl`
  `makeProgramImpl(ShaderCaps caps)`
  Returns a new instance of the appropriate implementation class for the given GeometryProcessor.

  ### Methods inherited from class icyllis.arc3d.granite.GeometryStep

  `appendAttributesToKey, depthStencilFlags, depthStencilSettings, emitFragmentColorCode, emitFragmentCoverageCode, emitSamplers, emitsCoverage, emitsPrimitiveColor, emitUniforms, emitVaryings, emitVertexGeomCode, getInputLayout, handlesSolidColor, hasInstanceAttributes, hasVertexAttributes, instanceAttributes, instanceBinding, instanceStride, makeColorAttribute, name, numInstanceAttributes, numInstanceLocations, numTextureSamplers, numVertexAttributes, numVertexLocations, performsShading, primitiveType, textureSamplerState, textureSamplerSwizzle, uniqueID, vertexAttributes, vertexBinding, vertexStride, writeMesh, writeUniformsAndTextures`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### POSITION

    public static final VertexInputLayout.Attribute POSITION
    Per-vertex attributes.

  - ### COLOR

    public static final VertexInputLayout.Attribute COLOR
    Per-instance attributes.

  - ### BOX

    public static final VertexInputLayout.Attribute BOX

  - ### STROKE

    public static final VertexInputLayout.Attribute STROKE

  - ### VIEW_MATRIX

    public static final VertexInputLayout.Attribute VIEW_MATRIX

  - ### VERTEX_ATTRIBS

    public static final VertexInputLayout.AttributeSet VERTEX_ATTRIBS

  - ### INSTANCE_ATTRIBS

    public static final VertexInputLayout.AttributeSet INSTANCE_ATTRIBS

  - ### FLAG_ANTIALIASING

    public static final int FLAG_ANTIALIASING
    See Also:
      - Constant Field Values

  - ### FLAG_STROKE

    public static final int FLAG_STROKE
    See Also:
      - Constant Field Values

  - ### FLAG_INSTANCED_MATRIX

    public static final int FLAG_INSTANCED_MATRIX
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SDFRectGeoProc

    public SDFRectGeoProc(int flags)

- ## Method Details

  - ### appendToKey

    public void appendToKey(@Nonnull KeyBuilder b)
    Description copied from class: `GeometryStep`
    Appends a key on the KeyBuilder that reflects any variety in the code that the geometry processor subclass can emit.
    Specified by:
      `appendToKey` in class `GeometryStep`
    See Also:
      - `GeometryStep.makeProgramImpl(ShaderCaps)`

  - ### makeProgramImpl

    @Nonnull public GeometryStep.ProgramImpl makeProgramImpl(ShaderCaps caps)
    Description copied from class: `GeometryStep`
    Returns a new instance of the appropriate implementation class for the given GeometryProcessor. This method is called only when the specified key does not exist in the program cache.
    Specified by:
      `makeProgramImpl` in class `GeometryStep`
    See Also:
      - `GeometryStep.appendToKey(KeyBuilder)`