* Terrain ray cast benchmarks and optimization:
- Added some benchmarks that exercise terrain ray casting.
- Optimized terrain ray casting by removing an unnecessary AABB intersection check (this was suggested by @invertednormal in the original review, but I forgot to actually remove it until now).
- Fixed a bug where we were not normalizing the ray direction before performing the Moller-Trumbore ray<->triangle intersection calculations.
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Update to make work with changes pulled down from mainline.
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Making terrain query resolution a single float instead of a Vector2
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* Keeping the concept of different x/y step sizes in region queries since that may be useful and is separate from query resolution. Also keeping the concept of different x/y step sizes in physics since that's independent of the terrain gem.
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* Formatting cleanups
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* A few more minor cleanups
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* Added support to convert serialized Vector2 query resolution to a single float.
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* Switch ray intersection check back to using separate values for x and y resolution
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* Fixing new unit tests added to use float query resolution.
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* Updating automated test
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
* Add a ray cast API to the terrain system, implement it, and use it so entities can be placed on top of terrain.
Still to do:
- Unit tests
- Profiling/benchmarks
- Optimization (if needed, may not be now after updating to use the iterative approach, but one option could be to use SIMD to ray cast against both triangles at once)
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Fix typos.
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Added a FindNearestIntersectionIterative to use in place of the first-pass FindnearestIntersectionRecursive attempt.
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Remove some functions that are no longer being used.
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Remove a unicode character from a comment to fix the validation build.
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Remove another unicode character from a comment to fix the validation build.
Signed-off-by: bosnichd <bosnichd@amazon.com>
* Update to bail out as soon as t > 1.0f
Signed-off-by: bosnichd <bosnichd@amazon.com>