Commit Graph

21 Commits

Author SHA1 Message Date
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