Package icyllis.arc3d.granite
Class Clip_old
java.lang.Object
icyllis.arc3d.granite.Clip_old
Clip_old
is an abstract base class for producing a clip. It constructs a
clip mask if necessary, and fills out a ClipResult_old
instructing the
caller on how to set up the draw state.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final float
This is the maximum distance that a draw may extend beyond a clip's boundary and still count count as "on the other side".static final float
This is the slack around a half-pixel vertex coordinate where we don't trust the GPU's rasterizer to round consistently.static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract int
apply
(SurfaceDrawContext sdc, boolean aa, ClipResult_old out, Rect2f bounds) abstract void
Compute a conservative pixel bounds restricted to the given render target dimensions.static void
getPixelBounds
(Rect2fc bounds, boolean aa, boolean exterior, Rect2i out) Convert the analytic bounds of a shape into an integer pixel bounds, where the given aa type is used when the shape is rendered.
-
Field Details
-
CLIPPED
public static final int CLIPPED- See Also:
-
NOT_CLIPPED
public static final int NOT_CLIPPED- See Also:
-
CLIPPED_OUT
public static final int CLIPPED_OUT- See Also:
-
kBoundsTolerance
public static final float kBoundsToleranceThis is the maximum distance that a draw may extend beyond a clip's boundary and still count count as "on the other side". We leave some slack because floating point rounding error is likely to blame. The rationale for 1e-3 is that in the coverage case (and barring unexpected rounding), as long as coverage stays within 0.5 * 1/256 of its intended value it shouldn't have any effect on the final pixel values.- See Also:
-
kHalfPixelRoundingTolerance
public static final float kHalfPixelRoundingToleranceThis is the slack around a half-pixel vertex coordinate where we don't trust the GPU's rasterizer to round consistently. The rounding method is not defined in GPU specs, and rasterizer precision frequently introduces errors where a fraction invalid input: '<' 1/2 still rounds up.For non-AA bounds edges, an edge value between 0.45 and 0.55 will round in or round out depending on what side its on. Outside of this range, the non-AA edge will snap using round()
- See Also:
-
-
Constructor Details
-
Clip_old
public Clip_old()
-
-
Method Details
-
apply
-
getConservativeBounds
Compute a conservative pixel bounds restricted to the given render target dimensions. The returned bounds represent the limits of pixels that can be drawn; anything outside the bounds will be entirely clipped out. -
getPixelBounds
Convert the analytic bounds of a shape into an integer pixel bounds, where the given aa type is used when the shape is rendered. The bounds mode can be used to query exterior or interior pixel boundaries. Interior bounds only make sense when its know that the analytic bounds are filled completely.NOTE: When using kExterior_Bounds, some coverage-AA rendering methods may still touch a pixel center outside of these bounds but will evaluate to 0 coverage. This is visually acceptable, but an additional outset of 1px should be used for dst proxy access.
-