Index: src/core/SkNormalSource.h |
diff --git a/src/core/SkNormalSource.h b/src/core/SkNormalSource.h |
index e46e2dae34cc84d5fdf0e2877f2c21968f1fff13..332caf31a572a12d807e13ce3519e3db150e948f 100644 |
--- a/src/core/SkNormalSource.h |
+++ b/src/core/SkNormalSource.h |
@@ -9,6 +9,17 @@ |
#define SkNormalSource_DEFINED |
#include "SkFlattenable.h" |
+#include "SkShader.h" |
+ |
+class SkMatrix; |
+class SkPoint3; |
+ |
+#if SK_SUPPORT_GPU |
+class GrFragmentProcessor; |
+class GrContext; |
+enum SkFilterQuality; |
+enum SkSourceGammaTreatment; |
+#endif |
/** Abstract class that generates or reads in normals for use by SkLightingShader. |
*/ |
@@ -69,6 +80,56 @@ public: |
*/ |
static sk_sp<SkNormalSource> MakeFlat(); |
+ /** This enum specifies the shape of the bevel. |
+ */ |
+ enum class BevelType { |
egdaniel
2016/07/25 15:48:00
Change this to what we just discussed. Make sure t
dvonbeck
2016/07/25 20:37:14
Done.
|
+ /* This bevel simulates a surface that is slanted from the shape's edges inwards, linearly. |
+ * It generates normals perpendicular to a straight line of slope 'height/width' that goes |
+ * from the closest edge of the shape to the point being shaded, as long as that point is |
+ * less than 'width' away from the closest edge. |
+ */ |
+ kLinear, |
+ /* This bevel simulates a surface that rounds off at the shape's edges, smoothly becoming |
+ * perpendicular to the x-y plane, starting 'width' units from the edge and following a |
+ * quadratic bezier curve. |
+ * |
+ * It can be more rigorously defined as the top surface of the volume enclosed between the |
+ * plane z=0, the plane z='height', and the surface formed by the union of all quadratic |
+ * bezier curves defined as follows: |
+ * - The start point is the edge of the shape |
+ * - The end point is 'width' units from the start point in the x-y plane |
+ * - The end point z-coordinate is 'height'. |
+ * - The projection of the curve in the x-y plane is perpendicular to the shape's edge |
+ * at the start point. |
+ * - The control point is the projection of the start point onto the z='height' plane. |
+ */ |
+ kRoundedOut, |
+ /* This bevel simulates a surface that sharply becomes perpendicular to the x-y plane at a |
+ * distance of 'width' units from the edge, and then smoothly becomes parallel to the x-y |
+ * plane following a quadratic bezier curve. |
+ * |
+ * It can be more rigorously defined as the top surface of the volume enclosed between the |
+ * plane z=0, the plane z='height', and the surface formed by the union of all quadratic |
+ * bezier curves defined as follows: |
+ * - The start point is the edge of the shape |
+ * - The end point is 'width' units from the start point in the x-y plane |
+ * - The end point z-coordinate is 'height'. |
+ * - The projection of the curve in the x-y plane is perpendicular to the shape's edge |
+ * at the start point. |
+ * - The control point is the projection of the end point onto the z=0 plane. |
+ */ |
+ kRoundedIn |
+ }; |
+ /** Returns a normal source that generates a bevel for the given shape. UNIMPLEMENTED: Will |
+ return straight-up normals only. |
+ |
+ @param type the type of bevel to add |
+ @param width the width of the bevel, in source space. Must be positive. |
+ @param height the height of the plateau, in source space. Can be positive, negative, |
+ or zero. A negative height means the simulated bevels slope downwards. |
+ */ |
+ static sk_sp<SkNormalSource> MakeBevel(BevelType, SkScalar width, SkScalar height); |
+ |
SK_DEFINE_FLATTENABLE_TYPE(SkNormalSource) |
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
}; |