Commit Graph

32 Commits

Author SHA1 Message Date
Mike Reed
fab619867b share code around animating the rotating cube
Change-Id: I90e0918b1ce6df7f54fae67916754289eb9a263b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272638
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-21 18:50:02 +00:00
Mike Reed
415caceb11 adopt new name convention
Change-Id: I7dedf2c8724256cf6889d8a608b425cb9188c030
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272597
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-21 17:28:42 +00:00
Mike Reed
46f5c5f08b Make SkM44 public
Need to migrate clients from private/ to core/ include
Unexperimentalize concat44() methods on SkCanvas

Change-Id: I64b8816722a9d93316cb8b8691d2d9a3e36f167f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272464
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-21 15:50:31 +00:00
Mike Reed
bd3de19f79 clean up leftovers from 3d samples
Change-Id: Ifb2414932d43ea3fafe7226dccb4acafdc41a07d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272337
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-20 14:58:53 +00:00
Mike Reed
e1a81bad5f move SkVec2 into shared header
Change-Id: I2b39242fe0519fa188151974dea883bad5652eb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272118
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-19 23:27:04 +00:00
Mike Reed
23823669b3 simplify rotation calc
Change-Id: I371f8808dbb6b22dfccd7044f862141b48c4dcf3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272117
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-19 22:54:44 +00:00
Mike Reed
5263837748 add fling to rotating cube
Change-Id: I4eb9a64cf41b088fca239cc7877b9dc9870d14ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271863
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-19 19:29:27 +00:00
Mike Reed
cfee8ee525 add skotties to cube demo
Change-Id: I2e1db9d4255cfcac4c589b726a371adfb0c5786e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271576
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-02-18 18:31:15 +00:00
Brian Osman
7353dc5490 Change SkSL main() from (float x, float y) to (float2 p)
Change-Id: Id046199edd63535ef07e1dfa65fbc7c0f8cefd00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269371
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-07 20:19:13 +00:00
Brian Osman
46b2b00584 Fix bump3d use of sample()
Change-Id: I75d7a4bdbfb2a5d22b85bca0cae2975378b19a53
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269365
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-07 17:36:58 +00:00
Florin Malita
d589916ebc Potentially-uninitialized Sk3LookAt result
Bug: oss-fuzz:20520
Change-Id: I383881571fa156c6faa5e798a1e126bb9e5e8dd0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268621
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2020-02-04 15:31:30 +00:00
Mike Reed
5a36a3a4c3 don't need to include deprecated Sk3D.h
Change-Id: I0259a5e7b32be3b93cf52de3efc2859886d31a4e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266626
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-27 21:28:26 +00:00
Mike Reed
2d4a28ef9f use vsphere to control light
Change-Id: Iec36d5bff6d1d6cd07a55c44d46e49f922166312
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266717
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-26 04:02:50 +00:00
Mike Reed
e580995f25 virtual sphere
Change-Id: Id79169837fddd0a608083a925d263fe1d97494f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266622
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-26 02:07:50 +00:00
Mike Reed
00a9764319 consolidate examples to 1 matrix type
Change-Id: I40fcf8290608b838cd6bd189f2905b6ce16a12f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266681
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-26 00:06:20 +00:00
Mike Reed
78184a3ce6 Revert "convert sample completely to SkM4"
This reverts commit e455d2e708.

Reason for revert: more testing

Original change's description:
> convert sample completely to SkM4
> 
> Change-Id: Ib8fdf0f9c326f0809d132da650eaccc20e58f9f8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266676
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: I946dbeb166b00a53aa7b3f470322c46d6263e9a7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266678
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-25 03:20:39 +00:00
Mike Reed
e455d2e708 convert sample completely to SkM4
Change-Id: Ib8fdf0f9c326f0809d132da650eaccc20e58f9f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266676
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-25 03:05:39 +00:00
Mike Reed
07d32b4d2d remove some memory-based methods, add rc()
Change-Id: I44d6f67dcd3d042127ad20ebdaa332e94f1b0829
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266216
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-01-23 16:52:06 +00:00
Mike Reed
9262555222 remove fun operator overloads
Change-Id: I6ae2d5d1cbe2fc5d9d782aa96900acd5703080e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265757
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-22 15:42:44 +00:00
Brian Osman
808f021b51 Improve error handling in SkSL ByteCode
- Allow for $floatLiteral and $intLiteral when determining type
  categories. These could slip into the IR, leading to asserts.
- We weren't propagating the source text in specialize(), so errors in
  the ByteCodeGenerator would actually assert about a missing fSource.
  It's held by unique_ptr on Program, so we wastefully clone the
  string, but we don't have that many specializations yet, so not too
  bad?

Change-Id: I9c79acfb084e6dc8628625dea039c085ec46dba7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265598
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-21 23:07:12 +00:00
Brian Osman
ea7711d4a8 Tweak pointlight3d sample to work in Raster backend
- Once we add all the missing intrinsics, the locally defined ones
  can go away.
- Having the default interpreter vector width match the raster pipeline
  is a huge perf win.

Change-Id: I482e409e57791b78a0e6fb15929ae77eb0e76bf3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265600
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-21 22:47:12 +00:00
Mike Reed
8c2ccc07ba use real normal-map texture
transpose(inverse(localToWorld)) does not seem to be working, so skipping
it for now.

Change-Id: I7dd5a01020f590dec02b36f54752092643acf3d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265401
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-21 15:29:00 +00:00
Mike Reed
9f22f1ff31 use transpose of inverse for transforming normals
Change-Id: I16d5167dcaed215a8009225765cd53c3620790dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265338
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-21 01:49:58 +00:00
Mike Reed
f0b7edf6cd hack up bump-map
Change-Id: Ib1e92359f0decd60bdcb628a5b11be1c597b4f82
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265219
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-18 19:53:49 +00:00
Mike Reed
ee3216d8f8 Use SkSL to do point-light shading
- misc fixes to utilities
- hit-testing for 3D scenes (simple version)

Had to manually inform the shader of the local-to-world matrix.
Should try making that automatic in the future.

Note: due to bug in interpreter, point-light sample can't run in raster
(yet).

Change-Id: I7a30b7676ea6cd7eb264373dd2507133c901d85e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264999
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-18 03:16:18 +00:00
Mike Reed
d4d3b33624 Make converting from 4x4 to 3x3 explicit
Change-Id: I4d190d6831cb517d5e9f22b3f872013367bddc08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264856
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-16 22:15:30 +00:00
Mike Reed
c43f2a0898 mark all exerimental (3d) apis as such
Bug: skia:9768
Change-Id: I10d8d3507df15ad45d827d2210d5bf2250ac1aaf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264778
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-16 20:25:40 +00:00
Mike Reed
b18e74dcbd Expose camera matrix in SkCanvas
3 new getters:
- localToWorld
- localToCamera
- localToDevice (same as total-matrix)

The current tracking minimizes overhead, by using a computed inverse to
produce the localToWorld/Camera. This can be change as needed in the
future (more precision, but more memory/overhead), but for now is
sufficient to try out the new APIs.

Change-Id: I85440318f36dca935124b782e110fe9c0152ae7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264648
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-01-16 19:35:40 +00:00
Mike Reed
c4b8eefe56 move SkV3 into header
Change-Id: I20284b415bbfe5ecc15fe9fe47dcbb65850d4368
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264682
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-16 11:34:32 +00:00
Mike Reed
ee0a03a3f3 experimental: saveCamera()
bug: skia:9768
Change-Id: I84b8f32933023d3376b51c2b93cc843863008828
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264476
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-15 19:27:34 +00:00
Mike Reed
7543587ee2 clean-up 3d sample's use of matrices
Propose a standard way to talk about the camera (etc) in SkCanvas:
- client provides 3 matrices: viewport, projection, camera
- canvas->concat(viewport * projection * camera * invert(viewport)
- camera and projection are taken straight from the textbook for 3D
- "viewport" means a matrix that transforms +-1 square about the origin
  to the clients working canvas. A simple way to describe it is:
  "specify the area-of-interest with a rectangle and z_scale"

Expose the ctm as a 44 from canvas for now. Likely we will add these
3 new matrices to canvas, and each may have a getter.

Bug: skia:
Change-Id: I6fa79c56956e060c17569848a81e13c13cb0981a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264221
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-14 15:56:12 +00:00
Mike Reed
69ace2a0ad sample3d
Change-Id: Idae6792f0ed1150c1cd167690403c7b97795e5ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263817
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-11 21:23:27 +00:00