restore til I understand what changed
Change-Id: I58abeb7405cdefe6d9882b7c9977e051143fcb67 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266716 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
00a9764319
commit
db301b73f8
@ -8,9 +8,22 @@
|
||||
#include "include/core/SkCanvas.h"
|
||||
#include "include/core/SkColor.h"
|
||||
#include "include/core/SkMatrix.h"
|
||||
#include "include/core/SkMatrix44.h"
|
||||
#include "include/private/SkM44.h"
|
||||
#include "tools/timer/TimeUtils.h"
|
||||
|
||||
static SkM44 rotate_axis_angle(SkScalar x, SkScalar y, SkScalar z, SkScalar radians) {
|
||||
// SkM44 doesn't expose any rotation factories yet
|
||||
SkMatrix44 m;
|
||||
m.setRotateAboutUnit(x, y, z, radians);
|
||||
|
||||
float a[16];
|
||||
m.asColMajorf(a);
|
||||
SkM44 m4;
|
||||
m4.setColMajor(a);
|
||||
return m4;
|
||||
}
|
||||
|
||||
// Adapted from https://codepen.io/adamdupuis/pen/qLYzqB
|
||||
class CrBug224618GM : public skiagm::GM {
|
||||
public:
|
||||
@ -42,7 +55,7 @@ protected:
|
||||
0.f, 0.f, -1.f / radius, 1.f};
|
||||
SkM44 zoom = SkM44::Translate(0.f, 0.f, radius);
|
||||
SkM44 postZoom = SkM44::Translate(0.f, 0.f, -radius - 1.f);
|
||||
SkM44 rotateHorizontal = SkM44::Rotate({0, 1, 0}, 2.356194490192345f);
|
||||
SkM44 rotateHorizontal = rotate_axis_angle(0.f, 1.f, 0.f, 2.356194490192345f);
|
||||
|
||||
// w in degrees will need to be converted to radians
|
||||
SkV4 axisAngles[6] = {
|
||||
@ -62,7 +75,7 @@ protected:
|
||||
SkColorSetARGB(0xFF, 0x80, 0x00, 0x80) // purple css
|
||||
};
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
SkM44 model = SkM44::Rotate({axisAngles[i].x, axisAngles[i].y, axisAngles[i].z},
|
||||
SkM44 model = rotate_axis_angle(axisAngles[i].x, axisAngles[i].y, axisAngles[i].z,
|
||||
SkDegreesToRadians(axisAngles[i].w));
|
||||
model = SkM44::Translate(radius, radius) * proj * // project and place content
|
||||
zoom * rotateHorizontal * model * postZoom * // main model matrix
|
||||
|
Loading…
Reference in New Issue
Block a user