Add new SkPoint3 class
The existing Light filter and the upcoming Lighting Shader both need a Point3 class
Review URL: https://codereview.chromium.org/1229693009
diff --git a/gm/lighting.cpp b/gm/lighting.cpp
index 0bfbb47..6df5851 100644
--- a/gm/lighting.cpp
+++ b/gm/lighting.cpp
@@ -8,6 +8,7 @@
#include "gm.h"
#include "SkLightingImageFilter.h"
#include "SkOffsetImageFilter.h"
+#include "SkPoint3.h"
#define WIDTH 330
#define HEIGHT 660
@@ -69,14 +70,18 @@
canvas->restore();
}
}
- SkPoint3 pointLocation(0, 0, SkIntToScalar(10));
+ SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10));
SkScalar azimuthRad = SkDegreesToRadians(SkIntToScalar(225));
SkScalar elevationRad = SkDegreesToRadians(SkIntToScalar(5));
- SkPoint3 distantDirection(SkScalarMul(SkScalarCos(azimuthRad), SkScalarCos(elevationRad)),
- SkScalarMul(SkScalarSin(azimuthRad), SkScalarCos(elevationRad)),
- SkScalarSin(elevationRad));
- SkPoint3 spotLocation(SkIntToScalar(-10), SkIntToScalar(-10), SkIntToScalar(20));
- SkPoint3 spotTarget(SkIntToScalar(40), SkIntToScalar(40), 0);
+ SkPoint3 distantDirection = SkPoint3::Make(SkScalarMul(SkScalarCos(azimuthRad),
+ SkScalarCos(elevationRad)),
+ SkScalarMul(SkScalarSin(azimuthRad),
+ SkScalarCos(elevationRad)),
+ SkScalarSin(elevationRad));
+ SkPoint3 spotLocation = SkPoint3::Make(SkIntToScalar(-10),
+ SkIntToScalar(-10),
+ SkIntToScalar(20));
+ SkPoint3 spotTarget = SkPoint3::Make(SkIntToScalar(40), SkIntToScalar(40), 0);
SkScalar spotExponent = SK_Scalar1;
SkScalar cutoffAngle = SkIntToScalar(15);
SkScalar kd = SkIntToScalar(2);