Commit Graph

176 Commits (f2378fc8d8afd9e97d2b51b0b09e62c70eb8b39b)

Author SHA1 Message Date
Mike Balfour 8b82041361
Optimize SurfaceData bulk queries (#7593)
* Add comparison operators to SurfaceTagWeight.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Changed AddSurfaceTagWeight to always combine weights.
This simplifies the API a bit and defines the behavior if someone ever tries to add a duplicate tag.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Added benchmarks for measuring the performance-critical APIs.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Changed SurfaceTagWeights to a fixed_vector.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Add inPosition to AddSurfacePoint.
This will be used to detect which input the surface point is associated with.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Add inPositionIndex to the appropriate APIs.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Switched Gradient Surface benchmarks to use actual surface components.
The gradient unit tests and benchmarks were previously using a mock surface data system, which led to misleading benchmark results. Now, the actual SurfaceData system gets constructed, and the tests use a mock provider, but the benchmarks use actual shape providers for more realistic benchmarking.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed unit tests to have better query ranges.
Half of each previous range was querying outside the surface provider's data.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* First attempt at removing SurfacePointLists.
This currently runs significantly slower than the previous code but passes the unit tests.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Another attempt at optimization.
This one runs faster than the previous, but still slow.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fix the cmake dependency so that the gradient tests rebuild SurfaceData.dll when run.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Switch SurfaceAltitudeGradient over to the new bulk API.
Also, optimized the non-bulk API by having it reuse the SurfacePointList to avoid the repeated allocation / deallocation cost.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Switched to using an indirect index so that all allocations are consecutive in our reserved buffer.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Switched back to SurfaceTagWeight again.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Added runtime dependency to LmbrCentral for unit tests.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Switched code over to use the full EnumeratePoints in most cases.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Added knowledge of max surface point creation into the system.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Add generic GetSurfacePointsFromList API implementation for surface providers.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed implementation to use the correct maximum number of input points based on the surface providers being queried.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fix out-of-bounds references on empty lists.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fix memory allocation that caused benchmark runs to crash.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Starting to clean up the API.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Move SurfacePointList into separate files for easier maintainability.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed bug where too many points were filtered out due to using the position Z as a part of the AABB check.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Made FilterPoints an internal part of SurfacePointList so we can choose when and how to perform the filtering.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Final cleanup / comments.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Added includes for non-unity builds.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Changed how unit tests initialize the mock lists to try and fix the linux errors.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed compile error.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Chris Burel 0b317ee0f5
Merge pull request #7566 from aws-lumberyard-dev/fixClangWindowsBuild
Fix clang windows build
4 years ago
bosnichd d0e5f9d20b
Added Async APIs for the various Process*FromList/Region terrain functions. (#7480)
* Added Async APIs for the various Process*FromList terrain functions.

Please note that we are currently defaulting the number of worker threads to one, because splitting the work over multiple threads causes contention when locking various mutexes, resulting in slower overall wall time for async requests split over multiple threads vs one where all the work is done on a single thread. The latter is still preferable over a regular synchronous call because it is just as quick and prevents the main thread from blocking. This should be changed once the mutex contention issues have been addressed, so that async calls automatically split the work between available job manager worker threads, unless the ProcessAsyncParams specify a different desired number of jobs.

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Fix Linux builds by adding missing #include

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Added a test for cancellation of terrain async requests, and fix it so that it works.

Note that the benchmarks show this implementation to be slightly slower than the previous one, which I presume is because we're now calling a 'perSurfacePointFunction' in the inner loop; this can probably be addressed, but will result in a lot of code duplication, and I think efforts will be better spent on removing the mutex contention to enable running multiple terrain async jobs at the same time.

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Added Async versions for all Process*Region terrain API functions, along with benchmarks.

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Fix the newly added terrain async request benchmarks to actually use the async APIs.

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Revert to the original version which just calls the synchronous API from the job function, along with some other updates in response to review feedback.

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Change the TerrainWorldDebugger to use the async API, along with the following changes:
- TerrainJobContext no longer uses a JobCancelGroup so we can guarantee the completion callbacks of associated jobs will be invoked even if it is cancelled.
- As a result of the above change, the ProcessAsyncCompleteCallback function signature again accepts the associated TerrainJobContext as a param.
- The TerrainProcessAsyncCancellation test has been resurrected and simplified by using binary semaphores instead of condition variables.
- All the async related TerrainSystemBenchmark functions have been simplified by using binary semaphores instead of condition variables.
- Global cancellation of all terrain jobs on deactivation of the TerrainSystem has been reintroduced, but in a different way than before.
- Other miscellaneous changes/fixes made while testing and based on earlier PR feedback.

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Updates based on review feedback:
- Go back to using a vector instead of an array (fixed the original problem by adding custom copy/assignment constructors/operators to the WireframeSector struct).
- When calling WireframeSector::Reset, block until any associated in flight has completed.
- Added the concept of a minimum number of positions per terrain job.

Signed-off-by: bosnichd <bosnichd@amazon.com>

* Use semaphore instead of binary_semaphore in a bunch of places to account for the race condition where a completion callback fires before we started waiting for it.

Signed-off-by: bosnichd <bosnichd@amazon.com>
4 years ago
Chris Burel 664403c5de Mark benchmark state variables in for loops as unused in benchmarks
Signed-off-by: Chris Burel <burelc@amazon.com>
4 years ago
SergeyAMZN a715897699
Merge pull request #7439 from aws-lumberyard-dev/TerrainMaterialsFix
LYN-8403 Prevent the same Surface Tag from getting reused
4 years ago
amzn-sj 396ec8a247
[Terrain] Optimize bulk queries to the Terrain System to retrieve height, surface weights, and normals (#7357) 4 years ago
Sergey Pereslavtsev c964d2085f Removed pragma once from cpp
Signed-off-by: Sergey Pereslavtsev <pereslav@amazon.com>
4 years ago
Sergey Pereslavtsev 469fcc4fb2 Merge branch 'development' of https://github.com/o3de/o3de into TerrainMaterialsFix 4 years ago
Ken Pruiksma dc5d50a4ce
Terrain default surface material (#7481)
Terrain default surface material
This adds the ability to set a default material on detail material regions as a fallback material for when there are no materials for an assigned surface tag, or there's only one surface tag but its weight is less than 1.0.

This also fixes some issues
- The terrain surface list component now correctly sends notifications on tag changes.
- The terrain area material notifications bus now has two separate change notifications - one for material, the other for tag
- The terrain renderer will now only consider a single region per point queried instead of any region that might have a matching surface tag.
4 years ago
Sergey Pereslavtsev 5dfbddd0cf Build fix
Signed-off-by: Sergey Pereslavtsev <pereslav@amazon.com>
4 years ago
Sergey Pereslavtsev 701b7a55e6 PR feedback addressing
Signed-off-by: Sergey Pereslavtsev <pereslav@amazon.com>
4 years ago
Sergey Pereslavtsev 13268dea98 Merge branch 'development' of https://github.com/o3de/o3de into TerrainMaterialsFix 4 years ago
Sergey Pereslavtsev 9aece3e84b LYN-8403 Prevent the same Surface Tag from getting reused
Signed-off-by: Sergey Pereslavtsev <pereslav@amazon.com>
4 years ago
Mike Balfour d9ba0af645
SurfacePoint data structure encapsulations (#7413)
* First pass at encapsulating SurfacePointList.
The biggest challenge in optimizing SurfacePointList(s) usage is the overall memory management associated with it. There are M surface points with N surface mask entries created for every input point, which leads to a lot of container reallocation and memory shuffling when processing multiple input points. By encapsulating the list, it should become easier to preallocate the entries, as well as keep "helper data" around for managing the bookkeeping to associate the input points with the output points.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Small fixes and TODO reminders.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Encapsulate surface point creation and separate EnumeratePoints out from modifications.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Start removing SurfacePoint from the exposed API.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Changed SurfacePointList to split out the surface point storage to allow for span<> usage over time.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Removed entity id

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Removed SurfacePoint from SurfaceData, changed all remaining uses to AzFramework::SurfaceData::SurfacePoint.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Encapsulated SurfaceTagWeightMap and renamed to SurfaceTagWeights.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed make file.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Better commenting and parameter naming.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Renamed methods to be more descriptive.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Ken Pruiksma ff4412db7c
Calculating uv transforms for terrain detail materials (#7375)
Calculating uv transforms for terrain detail materials

This adds support for uv transforms in terrain detail materials. To support this work, the code for generating a matrix from material properties was pulled out of the material functor and put into a new MaterialUtils file in Atom Utils.
4 years ago
antonmic ba76d304dc merging latest dev
Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
4 years ago
Mike Balfour 3f63cf3546
Misc SurfaceData Optimizations (#7299)
* Misc SurfaceData Optimizations.
This includes a few different optimizations found while trying to make the bulk query APIs faster:
* Switches mutexes over to shared_lock to optimize for the multi-reader-single-writer pattern
* Surface provider point creation now uses a pre-created set of masks to initialize with, and uses std::move() to move the created point into the output list instead of copying it.
* Splits CombineSortAndFilterNeightboringPoints so that the FilterPoints() can occur separately and efficiently with erase/remove_if, and avoids making a copy of the output points.
* Optimized SurfaceDataShapeComponent::ModifySurfacePoints
* Fixed potential bug where the sort wasn't stable since it only compared the Z value, and could have produced unexpected results for differing points with the exact same Z value.
* Fixed up a couple small bugs and missing checks in the unit tests

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed syntax on unit tests.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
bosnichd ff4529fc60
Terrain ray cast benchmarks and optimization. (#7303)
* 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>
4 years ago
jiaweig 1dd4898713
LYN-8551 Terrain: Renderer: Create compute pass for clipmaps (#7116)
* Allocate a pass that will be used to generate clipmap

Signed-off-by: jiaweig <51759646+jiaweig-amzn@users.noreply.github.com>

* Fix some small issues

Signed-off-by: jiaweig <51759646+jiaweig-amzn@users.noreply.github.com>

* Rename the pass to avoid future conflict. Move assets to terrain gem.

Signed-off-by: jiaweig <51759646+jiaweig-amzn@users.noreply.github.com>

* Turn the pass off

Signed-off-by: jiaweig <51759646+jiaweig-amzn@users.noreply.github.com>

* Move pass templates to Terrain gem

Signed-off-by: jiaweig <51759646+jiaweig-amzn@users.noreply.github.com>

* move load template to private

Signed-off-by: jiaweig <51759646+jiaweig-amzn@users.noreply.github.com>

* Add macro texture compute pass

Signed-off-by: jiaweig <51759646+jiaweig-amzn@users.noreply.github.com>

* Fix uncleaned code from previous commit

Signed-off-by: jiaweig <51759646+jiaweig-amzn@users.noreply.github.com>
4 years ago
AMZN-nggieber f5fcab75d6
Display Gem Icons in Gem Catalog (#7294)
Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com>

Co-authored-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>
4 years ago
Ken Pruiksma b455b915a8
Making terrain query resolution a single float instead of a Vector2 (#7186)
* 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>
4 years ago
antonmic 42a812bb04 Removing transmission from terrain PBR shader
Signed-off-by: antonmic <56370189+antonmic@users.noreply.github.com>
4 years ago
SergeyAMZN ff79931d1d
Merge pull request #7171 from aws-lumberyard-dev/TerrainMaterialsFix
LYN-7637 Allow Terrain Physics Collider to assign a default physics material
4 years ago
Ken Pruiksma 7946886126
TerrainDetailMaterialManager to use ClipmapBounds for its detail mateiral id texture. (#7182)
* Switching TerrainDetailMaterialManager to use ClipmapBounds for its detail mateiral id texture. This results in a lot of code removal and some simplifications for the shader.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Changing some names to be clearer

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Reducing the update multiple back to 1 since this texture is updated purely on the CPU

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Updates from PR review

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Mike Balfour c36b2fbbd6
SurfaceData cleanups to prepare for bulk APIs (#7166)
* Initial cleanup of GetSurfacePointsFromRegion in prep for bulk API support.
* Removed the generated lookup point from the output structure. Nothing was using it, and by keeping it separate, I can pass it in as a list of points that can be passed throughout the terrain, gradient, and surface data APIs.
* Clarified on the SurfaceProvider bus that GetSurfacePoints() only gets valid XY values on the inPosition.
* Simplified the TerrainSurfaceDataSystemComponent implementation a bit.  The EnumerateHandlers() and the terrain Aabb checks were overkill. Also, the terrain Aabb check assumed that the Z value on the inPosition was valid, which it isn't always.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Remove CryCommon dependency.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Sergey Pereslavtsev bb93dd3315 PR feedback + refactored some code duplication in tests
Signed-off-by: Sergey Pereslavtsev <pereslav@amazon.com>
4 years ago
lumberyard-employee-dm b9824ed172
Updated all array_view uses with the C++20 span. (#7157)
* Updated all array_view uses with the C++20 span.

The updates were done in the following order
1. `AZStd::array_view<([^>].+)\* ?>`  -> `AZStd::span<\1 const>`
2. `AZStd::array_view<(?:const )(.+)>` -> `AZStd::span<const \1>`
3. `AZStd::array_view` -> `AZStd::span`

Removed the implementation of array_view.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Added missing whitespace between `const` and the typename for spans.

Updated the ShaderTest comparison of the ShaderResourceGroupLayout span
to compare the sizes as well

Updated comments on some of the methods that stated that they return "an
array" to mention they return "a span".

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
Ken Pruiksma 453808eb90
Clipmap bounds class (#7134)
* ClipmapBounds class - This class is built to keep track of textures for clipmap like structures where there is a virtual center point and the edges need to be updated as the camera moves around the world

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Removing dead code

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Updates from PR feedback.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* comment update

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Updates from review suggestions

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* More updates. Moved the snapped center point calculation out to a separate function so the constructor doesn't need to do unnecessary work.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Removing unused variable.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Fixing bug in unit test that was doing a comparison and throwing away the result instead of actually testing it.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Adding some comments and constifying some functions.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Fixing numeric casting issue on linux

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Sergey Pereslavtsev 4c01c5b67f LYN-7637 Allow Terrain Physics Collider to assign a default physics material
Signed-off-by: Sergey Pereslavtsev <pereslav@amazon.com>
4 years ago
Mike Balfour 95c0186d1b
Add GetHeights() and GetSurfaceWeightsFromList() APIs. (#7121)
These perform bulk queries of the underlying gradients which is much faster than performing a lot of individual queries.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
lumberyard-employee-dm f3e9e41f4f
Adding partial implementation of C++20 concepts and range functions for AZStd::span (#7102)
* Adding partial implementation of C++20 concepts and range functions for AZStd::span

The new concepts to discovered existing issues with the PathIterator and deque::iterator classes
PathIterator wasn't properly an input_iterator and therefore the Path classes weren't a range due to an incorrect const_iterator alias
The deque::iterator classes was missing the operator+ friend function that accepted a (ptrdiff_t, deque::iterator) to fulfill the random_access_iterator concepts

The AZStd implementations of (uninitialized_)copy(_n), (uninitialized_)move(_n) and (uninitialized_)file(_n) have been optimized to use memcpy and memset based on fulfilling the contiguous_iterator concept

Fixed invalid AZStd::vector inserts in FrameGraphExecuter.cpp and SliceditorEntityOwnershipService.cpp
The code was trying to copy the underlying addresses for vector<unique_ptr> to a vector<raw pointer> using insert, which it was doing by using memcpy.

relates to #6749

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed the `fixed_vector` emplace function to not move initialized
elements using uninitialized_move.

This was causing initialized elements of the fixed_vector to be
overwritten with the element at the emplace position.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed clang warnings about variables that are set, but never read

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Updated the `az_has_builtin_is_constant_evaluated` define to not have
"()" as is not a macro.

This helps prevent users from using `az_has_builtin_is_constant_evaluated`
define in a situation where they want to know if the function is being
evaluated in a compile time context.
In that case they need to use the `az_builtin_is_constant_evaluated()`
macro (which of course looks quite similiar) but does not have the word
"has" in it..

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Updated the AZStd span class to be C++20 compliant.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Changed phrase "DoesNotCompiles" to be more grammatically correct.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Added more unit test for AZStd span

Fixed an the the return type of the subspan template overload to account
for the source span having a dynamic extent.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Removed unused variable from span unit test.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
4 years ago
bosnichd f34d3a822e
Add a ray cast API to the terrain system, implement it, and use it so entities can be placed on top of terrain. (#6895)
* 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>
4 years ago
Chris Galvan 8d0dce2613
Merge pull request #7101 from siretty/fix_build_linux_clang_13
Fix Build on Linux with Clang 13 with Debug, Profile and Release Configuration
4 years ago
Chris Galvan 71640c1c82
Merge pull request #6376 from nemerle/compiletime_filerequest_code2
Compile time reduction - FileRequest & related changes
4 years ago
Daniel Edwards 0a5f472f43 Clang 13: Fix build errors ...
... due to local variables only being written to (but never read).

Signed-off-by: Daniel Edwards <dev@danieledwards.de>
4 years ago
Mike Balfour dbd6ddbc1c
Optimized Gradient Previewer (#7074)
* Faster method with older one commented out for profiling.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Removed commented-out code

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Addressed PR feedback, fixed subtle bug in interlace math.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed unrelated bug in terrain cmake file.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fix linux compile error.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
santorac 74c6fa5f94
Merge pull request #7010 from aws-lumberyard-dev/Atom/santorac/MaterialAssetDeferredBaking3
Fixed Material Builder To Avoid Reading Material Type Source File
4 years ago
amzn-sj 8e08e42c86 Fix some warnings about unused parameters
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
amzn-sj d8226357f4 Merge
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
amzn-sj 0a722b5a06 Update comment for clarity
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
amzn-sj 3df7e239ac Fix build error on PC
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
amzn-sj 7bba4172ec Add a GetNumSamplesFromRegion function which returns the number of samples given a region and step size. Update Terrain Feature Processor to use this function to get the number of samples instead of computing num samples independently.
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
amzn-sj 4b5f4042f2 Move common code used by multiple tests into functions to reduce code duplication.
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
santorac f87d0f8386 Updated all .material files to have materialTypeVersion instead of propertyLayoutVersion. This was renamed in code at some point but we forgot to rename in the files. Before this was silently ignored but since I removed MaterialSourceDataSerializer, this started being reported as a warning.
Signed-off-by: santorac <55155825+santorac@users.noreply.github.com>
4 years ago
amzn-sj 392d08e2f0 Update Terrain renderer code to use the ProcessRegion API functions instead of the Get* functions
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
amzn-sj 7178637e01 Merge branch 'development' into SJ/TerrainOptimization
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
amzn-sj f05ca0897e Fix some warnings and remove an unused function parameter
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
amzn-sj 8fa0440030 Update TerrainPhysicsColliderTests to add mocks for the ProcessRegion functions since the TerrainPhysicsColliderComponent now uses the ProcessRegion functions
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
amzn-sj 6ac1211ae9 Add unit tests for ProcessSurfaceWeightsFromRegion and ProcessSurfacePointsFromRegion.
Signed-off-by: amzn-sj <srikkant@amazon.com>
4 years ago
AMZN-byrcolin c778606c89
Templates restricted (#6498)
* Templates/Restricted upgrade/fixes:
Fixed template storage format: templates now only store true relative paths and no longer save "origin" paths and "optional" has been removed, it was never used.
Upgraded all templates to new standard
Template system now correctly handles child objects: Child objects no longer have to specify restricted they inherit from parent
Restricted now operates at the object level and makes no assumptions about parent
Restricted templates can now be combined and seperated on creation
ly_get_list_relative_filename has been deprecated for o3de_pal_dir
All Gems/Projects/Templates updated to use new code

Signed-off-by: byrcolin <byrcolin@amazon.com>
4 years ago