Commit Graph

52 Commits (2913d72d17b02a42f35e8b0c9939b18df15db834)

Author SHA1 Message Date
sphrose 7159e3fe57 Moving to stabilization
Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
4 years ago
sphrose c28e92bf51
Merge pull request #5441 from aws-lumberyard-dev/terrain/sphrose/field_name_fix_LYN-8004
Various bug fixes.
4 years ago
sphrose bff8a2e147 improved fix
Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
4 years ago
John Jones-Steele c35f74e9ce
Physics/test axis aligned box shape configuration works #7378a (#5366)
* Safety commit before merging

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Moved from Physics to Terrain

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Changes from PR + AR fix

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Fixed another AR bug

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Fixed another AR compilation bug

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* More PR changes

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Added virtual destructor

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Added TestSuite_main_Optimized.py

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Changes from PR

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Further fixes for PR

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Fix to editor_test.py

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Testing prefab level

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Testing slice level

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Testing prefab level

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Disabled orefab loading for the time being.

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>
4 years ago
John Jones-Steele 938899a495
Minor fixups for terrain physics collide lyn 7692 (#5413)
* First commit

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* completed changes

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>
4 years ago
sphrose af08cc5ab3 Various bug fixes.
Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
4 years ago
Ken Pruiksma a2efc587cc
Rendered World Size in the Terrain World Render component set to invisible (#5378)
It's not currently hooked up, so setting invisible for now until it does something.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Ken Pruiksma 0b061d2e00
GHI-5338 - Fixing incorrect calculation of sector bounds for negative values (#5352)
Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Mike Balfour 6a21d4f50d
Merge pull request #5351 from aws-lumberyard-dev/terrain/mbalfour/use_ground_plane_non_functional
Use Ground Plane non functional
Added functionality to the "Use Ground Plane" toggle. Now, when it's enabled, the Terrain Layer Spawner will always provide valid terrain data at the minimum height of the spawner box, even if no Terrain Height Gradient List exists. If it's disabled, it won't provide any terrain data unless the Terrain Height Gradient List exists.
4 years ago
Mike Balfour df0403a5e6
Merge pull request #5333 from aws-lumberyard-dev/terrain/mbalfour/debugger_wireframe_refresh_bug
Fix terrain wireframe refresh.
4 years ago
Mike Balfour b0abb8dbc3 Merge branch 'stabilization/2110' into terrain/mbalfour/use_ground_plane_non_functional
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

# Conflicts:
#	Gems/Terrain/Code/Source/Components/TerrainHeightGradientListComponent.cpp
4 years ago
Mike Balfour 97b0eddcb4 Hook up the "Use Ground Plane" toggle.
The "Use Ground Plane" toggle is now functional.  When disabled, the terrain layer spawner will say "terrain exists = false" for any point in its bounds unless there's also a Terrain Height Gradient List component with a valid entry.  When enabled, it will always say "terrain exists = true", and it will return the min height of the spawner box as the ground plane if there's no valid Terrain Height Gradient List height provider.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Mike Balfour e32e1ce572 Fix terrain wireframe refresh.
If a terrain layer spawner went outside the world bounds, the debug wireframe wouldn't update correctly because the heights were outside the wireframe sector AABBs.  Adjusted the logic to account for this.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Mike Balfour 5b504086f9 Prevent infinite recursion with Altitude Gradient.
Using the Altitude Gradient as an input to the Height Gradient List can cause infinite recursion since it is both setting and fetching the same height value.  Added guards to warn if this occurs and gracefully handles the situation.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Ken Pruiksma d52ce49dcb
Terrain macro material fixes (#5182)
* Minor fixes for macro materials
- When macro image views are no longer used, they will explicitely be set to nullptr
- limiting for loop in shader to the number of macro materials total so it doesn't read unitialized memory

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

* Removing parts of the terrain shader no longer used.

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

* Fixing normalization in shaders, adding default valus for all structs used in SRGs.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
John Jones-Steele 021917ad27
Fix bug 4198 (#5107)
Signed-off-by: John Jones-Steele <jjjoness@amazon.com>
4 years ago
Mike Balfour 86270339d8
Added terrain surface data notifications (#5067)
* Fix notifications for surface data changes.
Separated the notifications from the surface component and the height component to add a reason to a RefreshArea request.  This makes it possible to distinguish between surface changes and height changes and provide the appropriate OnTerrainDataChanged flags.

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

* Reworked to use a changeMask instead of separate calls.

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

* PR Feedback
Judicious use of "using" to reduce a bunch of bulky namespaces.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Ken Pruiksma a661189ea9
Fix for rendering artifacts on height map update. (#5066)
* Fix for rendering artifacts on height map update. This was being caused by not always lining up update aabbs with the query resolution correctly. In the future the float -> integer aabb calculations should be abstracted away. Some of this is done in the detail material ID work, but doesn't exist in the stabilization branch so we can circle around to it later.

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

* PR review updates - fixing cast, making constexpr for bytes per pixel.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
sphrose e9b5a51d9f
Fix console warning when adding TerrainWorldRendererComponent (#4964)
* Fix console warning when adding TerrainWorldRendererComponent

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Change default value

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
4 years ago
Mike Balfour 91ca986e2a
Terrain Macro Material component improvements (#4930)
* First pass of non-working changes to Terrain Macro Material Component.

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

* Reworked Terrain Macro Material to use properties instead of a material.

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

* Fixed comments.

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

* PR feedback - disable attributes when no normal map selected

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

* Fix linux compile error - unused variables.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Mike Balfour 2fe4524458
Terrain API cleanups (#4914)
* Terrain API fixups
Moved SurfaceData definitions in AzFramework out of terrain into separate files.
Added some missing API calls: Get*FromVector2, GetSurfacePoint*
Changed OrderedSurfaceTagWeightSet to SurfaceTagWeightList

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

* PR feedback - remove IsClose check.

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

* Fixed PhysX test compile failures by redcoding a bunch of "dummy terrain" implementation that's unused.
It was originally added for the PhysX Terrain component, but that component is long gone and has been superceded by the more generic PhysX Heightfield Collider.

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

* Fixed up failing terrain unit tests.
Added API changes, and changed the assumption on where the surface weight sort is taking place.  The component is no longer expected to provide the sorted list, it only needs to be sorted at the end coming out of the terrain system, so the unit tests have been modified to reflect that.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
John Jones-Steele 3d67be162c
Terrain Physics Heightfield support
* New Heightfield Components

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Misc PR fixes
* Fixed linux build failure from bad #include
* Renamed "Terrain Physics Collider" to "Terrain Physics Heightfield Collider" per physics team feedback
* Fixed 1/5 -> 1/4 typo in a comment
* Added missing member copies in HeightfieldShapeConfiguration

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

* Addressed PR feedback

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

* Changes from review

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Remove tabs accidently added

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Fixed overly complicated scaling math.

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

* Added comments to make it more obvious what's happening on CreateEnd / DestroyBegin.

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

* Moved Heightfield CreatePxGeometryFromConfig into its own function

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

Co-authored-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Mike Balfour e2105ed5b3
Remove unused header file that caused compile failures. (#4759)
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
sphrose bcc186f87f
Terrain/sphrose/surface materials component (#4541)
* wip

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* wip

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Terrain Surface Materials List Component.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* fix erroneous commit

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Added some comments.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Review changes.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Surface Materials list unit tests

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Missing shape test

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* review changes.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Compile fix.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Fix case issue in include path.

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

* replaced reverted test.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

Co-authored-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Mike Balfour c7e6907064
Flipped y value on uv so that the macro material lines up with the corresponding height data. (#4701)
Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Ken Pruiksma 937c2b2e88
Terrain FP supports macro material component (#4587)
* Adding basic support for TerrainMacroMaterialNotificationBus. Tracking macro materials in list.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
(cherry picked from commit b4773454334de940d730620ffff300b46d6c611d)

* Adding bus connection

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
(cherry picked from commit 66c99f503adb24f4be4f81716b544202d8e237d9)

* Additions to indexed data vector to allow for getting an index from the data or deleting data with a reference to the data itself instead of the index.
Additions to the feature processor for tracking macro material indices in sectors.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
(cherry picked from commit 06365dbde5454e18e5fdf941f03b17b0d632027c)

* Macro materials updating which macro materials are used in which sectors. Correctly handling construction / destruction.

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

* Updating the terrain macro material type to have the correct properties and also not attempt to render. Refactored some of the update loop in the TerrainFP to only rebuild the sectors when necessary, otherwise just update the srgs.

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

* Fixed up macro material to not try to actually render anything with shaders or hook to any shader data
Terrain FP now pulls data pulling from macro material instance to use in the terrain material
Various bug fixes around when terrain sectors needed reprocessing

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

* Adding basic support for TerrainMacroMaterialNotificationBus. Tracking macro materials in list.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
(cherry picked from commit b4773454334de940d730620ffff300b46d6c611d)

* Adding bus connection

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
(cherry picked from commit 66c99f503adb24f4be4f81716b544202d8e237d9)

* Additions to indexed data vector to allow for getting an index from the data or deleting data with a reference to the data itself instead of the index.
Additions to the feature processor for tracking macro material indices in sectors.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
(cherry picked from commit 06365dbde5454e18e5fdf941f03b17b0d632027c)

* Macro materials updating which macro materials are used in which sectors. Correctly handling construction / destruction.

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

* Updating the terrain macro material type to have the correct properties and also not attempt to render. Refactored some of the update loop in the TerrainFP to only rebuild the sectors when necessary, otherwise just update the srgs.

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

* Fixed up macro material to not try to actually render anything with shaders or hook to any shader data
Terrain FP now pulls data pulling from macro material instance to use in the terrain material
Various bug fixes around when terrain sectors needed reprocessing

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

* Constify all the things

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

* Updates from PR review.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Ken Pruiksma 8fc8baa579
Terrain FP now pulls data from Terrain system (#4492)
* Feature processor now pulls data instead of the render component pushing it. This results in fewer and cheaper heightmap rebuilds. The feature processor can also handle dirty regions correctly now, although it doesn't seem like they are being passed in correctly yet.

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

* Fixing issues with initialization, dirty region tracking, and total rendered world size.

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

* Fixing bug with resizing the world

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

* Decreasing the scope of a mutex

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

* Fixes from PR review

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

* Fixed a math issue with float rounding. Fixed static AZ::Name usage.

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

* Removing unused variable

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Mike Balfour f68d2676a0
Terrain/mbalfour/terrain macro material component (#4500)
* Initial TerrainMacroMaterial Component.
The APIs will likely need to be adjusted once it gets hooked up to the renderer.
It also would benefit from better UX to prevent users from selecting the wrong material types, but there are separate tickets for the Editor to add features to allow for that.

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

* Addressed PR feedback.

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

* More PR feedback - add create/destroy notifications.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Mike Balfour 4b6c93f289
Bugfixes for terrain surface data. (#4508)
* Bugfixes for terrain surface data.
1. Changed the TerrainSurfaceDataSystem component to query for all the surface types, now that we have them.
2. Added dependency tracking to the TerrainSurfaceGradientList component so that it will refresh terrain data when any of its data changes.

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

* Addressed PR feedback

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
sphrose 4a4c93f866
Terrain/sphrose/surface gradient list component (#4409)
* cherry-pick conflict fix

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Missed include file

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* review changes.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* cherry-pick merge fix

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* review changes.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* bug fix

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* review changes.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* compile fix

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* compile fix

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
4 years ago
Ken Pruiksma 7052ccfa52
Terrain detail and macro texture support (#4403)
* Terrain feature processor improvements regarding material, mesh, and lod
- Now using a material with pbr lighting for terrain. Removed some of the old shader code that wasn't needed anymore
- Move heightmap image declaration to the material so it's not needed in the object SRG anymore
- Added prototype code (commented out) for smoothing the terrain with a b-spline weighting function
- Mesh data is all made with a proper mesh asset now.
- Added basic LOD support (no continuous LOD yet, but it does pop between lod levels)
- Moved RenderCommon to be accessible publicly. It contains stencil refs that should be public.

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

* Adding more material options to terrain shader

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

* Fixing terrain's per object srg because of changes in the default per object srg.

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

* Added more features to the terrain material. Shader & Material reloads are now handled.

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

* Added stub for terrain render max area setting in the renderer component. Added detail texture tiling setable from the material

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

* Missing change to material type from last commit

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

* Adding macro material in material type and support detail roughness.

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

* Fixing merge issues in terrain material type

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

* Adding more features to the terrain material
- Macro color and normals
- Detail layer fade out
- Reoriented detail normals

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

* Remove line that unintentionally was added back during a rebase & merge.

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

* Fixing previously deleted unused static that came back after a merge. Fixed an issue with macro normals in the terrain shader.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Ken Pruiksma 8791ae7ed7
Terrain feature processor improvements regarding material, mesh, and lod (#4303)
* Terrain feature processor improvements regarding material, mesh, and lod
- Now using a material with pbr lighting for terrain. Removed some of the old shader code that wasn't needed anymore
- Move heightmap image declaration to the material so it's not needed in the object SRG anymore
- Added prototype code (commented out) for smoothing the terrain with a b-spline weighting function
- Mesh data is all made with a proper mesh asset now.
- Added basic LOD support (no continuous LOD yet, but it does pop between lod levels)
- Moved RenderCommon to be accessible publicly. It contains stencil refs that should be public.

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

* Fixing terrain's per object srg because of changes in the default per object srg.

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

* PR Fixes

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

* Removing unused static.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Mike Balfour 4b2dc9b3a4
Terrain System fixes (#4299)
* Remove the "TEST_SUPPORTED" traits.
Terrain unit tests should be usable on all platforms, so they shouldn't need a platform-specific trait to enable/disable.

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

* Fix a few misc terrain bugs.
* Change Activate/Deactivate to happen immediately instead of deferring.  There were too many order-of-operation bugs caused by trying to defer this.
* Added implementation for calculating normals.
* Fixed bug where GetHeightSynchronous wasn't stopping at the highest-priority layer.
* Added locks for SurfaceData bus to help ensure we lock our mutexes in the correct order and avoid deadlocks.

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

* Add trivial TerrainSystem tests.
Tests construction, Activate(), Deactivate(), and destruction.

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

* Unified Terrain system calls on single bus.

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

* Added mock for TerrainDataNotificationBus listener.
Also added unit tests to verify the listener, and added in missing notification events.

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

* Removed extra Sampler class.
Fixed up APIs to correctly pass Sampler and terrainExistsPtr around.

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

* Switched MockTerrainSystem to be proper gmock.
This makes it for flexible to use and easier to reuse from other test environments.

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

* Fix settings bug caused by bad order of operations that occurred when the methods moved to a different bus.

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

* Eliminate extra EBus by simplifying area initialization.
Previously, there was a back-and-forth ebus signal used for the terrain system to find any terrain spawners that were created prior to the terrain system activation.  Now it uses the more simple technique of just grabbing all the spawners that are currently hooked up to the spawner ebus.

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

* Switch to NiceMock so that "uninteresting" mock calls get ignored.

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

* Addressed PR feedback.
Filled in terrainExistsPtr at the end, and added it to GetNormal as well.

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

* Fixed shader height calculation.
It was off by half a pixel, and it was interpolating, both of which were wrong.

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

* Create initial LmbrCentral mocks that other Gems can use.
To help improve mock maintenance over time, this creates mocks in the same Gem as the systems being mocked, instead of the other Gems that need to use mocked systems during testing.  This way, the mocks should more easily stay in sync with the interface that they mock out.

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

* Null-guard any uses of Atom to make the class easier to unit test.

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

* Add more mocked terrain services

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

* Moved Terrain mocks to publicly-available Mocks directory.  Also added more unit tests.

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

* Change debug code to use EXACT instead of BILINEAR height sampling, because it's specifically using the terrain grid.

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

* Added support for the sampler filters.

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

* Fix bad merge.

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

* Add unit test to verify terrain layers define terrain regions.

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

* Moved the AABB component mock into a private terrain header, since it's a specialized mock just for the terrain tests.

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

* Moved sampler and normal calculations into TerrainSystem so that they can work across multiple adjacent areas.

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

* Missed a couple of unit test changes.

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

* Removed normal query as well, that needs a seprate unit test.

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

* Removed unused variable that was only caught in Linux/Android builds.

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

* Addressed PR feedback
Made the parameter names consistently listed in MockShapes.h.
Added comments to TerrainHeightGradientListComponent explaining why terrainExists is always true when a gradient exists.
Also fixed a bug where terrainExists should technically be *false* if no gradient exists.

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

* Added more descriptive comments and names for ClampPosition.

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

* Unit tests to verify height samplers work correctly.

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

* Fix bug where wireframe didn't refresh when the setting changed.

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

* Created TerrainWorldRenderer Component and moved all terrain rendering management code into it.

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

* Fixed the icon references

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

* Removed expensive profile marker.

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

* Addressed PR feedback

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

* Fixed AR error - constexpr doesn't need to be in a lambda capture.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Mike Balfour dc050d4acd
Terrain System bugfixes (#4180)
* Remove the "TEST_SUPPORTED" traits.
Terrain unit tests should be usable on all platforms, so they shouldn't need a platform-specific trait to enable/disable.

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

* Fix a few misc terrain bugs.
* Change Activate/Deactivate to happen immediately instead of deferring.  There were too many order-of-operation bugs caused by trying to defer this.
* Added implementation for calculating normals.
* Fixed bug where GetHeightSynchronous wasn't stopping at the highest-priority layer.
* Added locks for SurfaceData bus to help ensure we lock our mutexes in the correct order and avoid deadlocks.

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

* Add trivial TerrainSystem tests.
Tests construction, Activate(), Deactivate(), and destruction.

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

* Unified Terrain system calls on single bus.

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

* Added mock for TerrainDataNotificationBus listener.
Also added unit tests to verify the listener, and added in missing notification events.

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

* Removed extra Sampler class.
Fixed up APIs to correctly pass Sampler and terrainExistsPtr around.

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

* Switched MockTerrainSystem to be proper gmock.
This makes it for flexible to use and easier to reuse from other test environments.

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

* Fix settings bug caused by bad order of operations that occurred when the methods moved to a different bus.

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

* Eliminate extra EBus by simplifying area initialization.
Previously, there was a back-and-forth ebus signal used for the terrain system to find any terrain spawners that were created prior to the terrain system activation.  Now it uses the more simple technique of just grabbing all the spawners that are currently hooked up to the spawner ebus.

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

* Switch to NiceMock so that "uninteresting" mock calls get ignored.

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

* Addressed PR feedback.
Filled in terrainExistsPtr at the end, and added it to GetNormal as well.

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

* Fixed shader height calculation.
It was off by half a pixel, and it was interpolating, both of which were wrong.

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

* Create initial LmbrCentral mocks that other Gems can use.
To help improve mock maintenance over time, this creates mocks in the same Gem as the systems being mocked, instead of the other Gems that need to use mocked systems during testing.  This way, the mocks should more easily stay in sync with the interface that they mock out.

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

* Null-guard any uses of Atom to make the class easier to unit test.

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

* Add more mocked terrain services

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

* Moved Terrain mocks to publicly-available Mocks directory.  Also added more unit tests.

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

* Change debug code to use EXACT instead of BILINEAR height sampling, because it's specifically using the terrain grid.

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

* Added support for the sampler filters.

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

* Fix bad merge.

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

* Add unit test to verify terrain layers define terrain regions.

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

* Moved the AABB component mock into a private terrain header, since it's a specialized mock just for the terrain tests.

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

* Moved sampler and normal calculations into TerrainSystem so that they can work across multiple adjacent areas.

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

* Missed a couple of unit test changes.

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

* Removed normal query as well, that needs a seprate unit test.

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

* Removed unused variable that was only caught in Linux/Android builds.

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

* Addressed PR feedback
Made the parameter names consistently listed in MockShapes.h.
Added comments to TerrainHeightGradientListComponent explaining why terrainExists is always true when a gradient exists.
Also fixed a bug where terrainExists should technically be *false* if no gradient exists.

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

* Added more descriptive comments and names for ClampPosition.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Esteban Papp bbe437819b
Enables override/virtual warnings
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
Mike Balfour 089391f761
Terrain System cleanups and unit tests (#4119)
* Remove the "TEST_SUPPORTED" traits.
Terrain unit tests should be usable on all platforms, so they shouldn't need a platform-specific trait to enable/disable.

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

* Fix a few misc terrain bugs.
* Change Activate/Deactivate to happen immediately instead of deferring.  There were too many order-of-operation bugs caused by trying to defer this.
* Added implementation for calculating normals.
* Fixed bug where GetHeightSynchronous wasn't stopping at the highest-priority layer.
* Added locks for SurfaceData bus to help ensure we lock our mutexes in the correct order and avoid deadlocks.

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

* Add trivial TerrainSystem tests.
Tests construction, Activate(), Deactivate(), and destruction.

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

* Unified Terrain system calls on single bus.

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

* Added mock for TerrainDataNotificationBus listener.
Also added unit tests to verify the listener, and added in missing notification events.

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

* Removed extra Sampler class.
Fixed up APIs to correctly pass Sampler and terrainExistsPtr around.

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

* Switched MockTerrainSystem to be proper gmock.
This makes it for flexible to use and easier to reuse from other test environments.

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

* Fix settings bug caused by bad order of operations that occurred when the methods moved to a different bus.

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

* Eliminate extra EBus by simplifying area initialization.
Previously, there was a back-and-forth ebus signal used for the terrain system to find any terrain spawners that were created prior to the terrain system activation.  Now it uses the more simple technique of just grabbing all the spawners that are currently hooked up to the spawner ebus.

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

* Switch to NiceMock so that "uninteresting" mock calls get ignored.

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

* Addressed PR feedback.
Filled in terrainExistsPtr at the end, and added it to GetNormal as well.

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

* Fixed shader height calculation.
It was off by half a pixel, and it was interpolating, both of which were wrong.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Esteban Papp ee2e728760 Merge branch 'development' into cmake/warn_virtual
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
sphrose 9c07078ee8
Change shape type in test mock plus bugfix. (#4073)
Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
4 years ago
Esteban Papp 5965760612 Merge branch 'development' into cmake/warn_virtual
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
Mike Balfour 280796e1f4
Fix GHI 4041 Terrain Shader Crash (#4050)
The terrain feature processor was crashing due to an invalid shader name.  The shader name has been fixed, but the feature processor has also been hardened so that it no longer crashes if a shader fails to load.
Also, while testing, this inadvertently exposed a second crash in EntitySerializer that occurs when components don't serialize in correctly.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
4 years ago
Artur K 3a4937456a
Build time reduction: AzStdOnDemandReflection (#3111)
* Move a few specializations from AzStdOnDemandReflection.inl to cpp file

This reduces compilation time and produced profile/debug file sizes.

The specializations for string and string_view are only implemented for 'char' type, since
others are not used anywhere.

Extracted `Reflect` method from `ClientAuthAWSCredentials` to a cpp file.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Windows build fixes.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Added missing license.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Fix missing spaces in template argument lists

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Clang format on ClientAuthAWSCredentials.cpp

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>

* Merge upstream development and fix linux build.

Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
4 years ago
Esteban Papp 9f6d4125b8 Merge branch 'development' into cmake/warn_virtual
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
Esteban Papp d836503814 some more fixes
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
4 years ago
Ken Pruiksma d17ac748ac
Various terrain improvements: (#3942)
* Various terrain improvements:
- Height now stored in a R16_unorm to decrease the amount of memory / memory bandwidth needed for the height field
- Many simplifications to the feature processor
- Added a shader to render to the depth pre pass
- Pulled common functionality needed by depth and forward to a common include shader
- Forward shader now outputs to all the expected render targets
- Adjusted the way normals and lighting are being calculated

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

* Adding missing shader files. Updated terrain shader to alter the color slightly with height.

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

* Removed pixel shader code from terrain depth pass

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

* Renamed the depth pass shaders to no longer indicate they include a pixel shader.

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

* Removing unneeded code from TerrainCommon.azsli

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
sphrose 65de5ec3e6
Change TerrainLayerSpawner to use axis aligned box. (#4019)
* Change TerrainLayerSpawner to use axis aligned box.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Review change.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
4 years ago
Steve Pham e6573766c2
Fixes for release builds for unused variable warnings (#4000)
Signed-off-by: Steve Pham <spham@amazon.com>
4 years ago
sphrose cc7cc9b7a8
Terrain/sphrose/layer spawner (#3980)
* #3326 Get layer priorities to work.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Refresh terrain when layer settings change

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Removed dependency notification handling: it isn't needed due to deactivate/activate cycle caused by editor redrawing.
Moved layer registering to ordered map sorted by priority.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Remove unused code, add extra sort condition.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Fix copy/paste error.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Change erase method.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Review suggestions.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Fix bus disconnect order, change GetUseGroundPlane to return bool.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Create unit tests for Terrain Spawning component #3224

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Remove unintended commit.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* Remove blank line.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>

* PR changes.

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
4 years ago
amzn-phist 2d623590e8
Fix the DefaultGem template's Editor target (#3853)
Removes the OUTPUT_NAME from the .Editor target in the Gem template.
Removes the same from Gems that have it currently.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
4 years ago
Ken Pruiksma 0c7dfce5a0
First pass terrain cleanup (#3753)
* First pass cleanup of some terrain components.

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

* Adding basic culling to terrain sectors

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

* Adding default value for m_transform

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
4 years ago
Jeremy Ong a9b4ad3486 Compile out tracker in release mode
Signed-off-by: Jeremy Ong <jcong@amazon.com>
4 years ago