diff options
author | Ruiqi Mao <ruiqimao@google.com> | 2018-06-29 14:32:21 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-29 19:34:28 +0000 |
commit | f510149da8d32f60f08d0a809eb037496079af3c (patch) | |
tree | 13b3670a481f3bae652968165d04f9ca4890d9bf /include/core/SkCanvas.h | |
parent | 38f118a2e7f986b06d69d0af41ec2d1af53dac39 (diff) |
skeletal animation support added to API and software backend
SkCanvas::drawVertices now supports overloads that take an array of bone deformation matrices.
SkVertices::MakeCopy and SkVertices::Builder now support two additional optional attributes, boneIndices and boneWeights.
Bug: skia:
Change-Id: I30a3b11691e7cdb13924907cc1401ff86d127aea
Reviewed-on: https://skia-review.googlesource.com/137221
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
Diffstat (limited to 'include/core/SkCanvas.h')
-rw-r--r-- | include/core/SkCanvas.h | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 5a307c8e6b..15ed034db6 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -2149,6 +2149,40 @@ public: */ void drawVertices(const sk_sp<SkVertices>& vertices, SkBlendMode mode, const SkPaint& paint); + /** Draw SkVertices vertices, a triangle mesh, using clip and SkMatrix. Bone data is used to + deform vertices with bone weights. + If vertices texs and vertices colors are defined in vertices, and SkPaint paint + contains SkShader, SkBlendMode mode combines vertices colors with SkShader. + The first element of bones should be an object to world space transformation matrix that + will be applied before performing mesh deformations. If no such transformation is needed, + it should be the identity matrix. + + @param vertices triangle mesh to draw + @param bones bone matrix data + @param boneCount number of bone matrices + @param mode combines vertices colors with SkShader, if both are present + @param paint specifies the SkShader, used as SkVertices texture, may be nullptr + */ + void drawVertices(const SkVertices* vertices, const SkMatrix* bones, int boneCount, + SkBlendMode mode, const SkPaint& paint); + + /** Draw SkVertices vertices, a triangle mesh, using clip and SkMatrix. Bone data is used to + deform vertices with bone weights. + If vertices texs and vertices colors are defined in vertices, and SkPaint paint + contains SkShader, SkBlendMode mode combines vertices colors with SkShader. + The first element of bones should be an object to world space transformation matrix that + will be applied before performing mesh deformations. If no such transformation is needed, + it should be the identity matrix. + + @param vertices triangle mesh to draw + @param bones bone matrix data + @param boneCount number of bone matrices + @param mode combines vertices colors with SkShader, if both are present + @param paint specifies the SkShader, used as SkVertices texture, may be nullptr + */ + void drawVertices(const sk_sp<SkVertices> vertices, const SkMatrix* bones, int boneCount, + SkBlendMode mode, const SkPaint& paint); + /** Draws a Coons patch: the interpolation of four cubics with shared corners, associating a color, and optionally a texture SkPoint, with each corner. @@ -2472,8 +2506,14 @@ protected: const SkPoint texCoords[4], SkBlendMode mode, const SkPaint& paint); virtual void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint); + + // TODO: Remove old signature virtual void onDrawVerticesObject(const SkVertices* vertices, SkBlendMode mode, - const SkPaint& paint); + const SkPaint& paint) { + this->onDrawVerticesObject(vertices, nullptr, 0, mode, paint); + } + virtual void onDrawVerticesObject(const SkVertices* vertices, const SkMatrix* bones, + int boneCount, SkBlendMode mode, const SkPaint& paint); virtual void onDrawImage(const SkImage* image, SkScalar dx, SkScalar dy, const SkPaint* paint); virtual void onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst, |