Merge remote-tracking branch 'upstream/stabilization/2110' into nvsickle/StabToDevNov21
Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
This commit is contained in:
@@ -67,12 +67,6 @@ namespace AzFramework
|
||||
/// Make path relative to the provided root.
|
||||
virtual void MakePathRelative(AZStd::string& /*fullPath*/, const char* /*rootPath*/) {}
|
||||
|
||||
/// Gets the engine root path where the modules for the current engine are located.
|
||||
virtual const char* GetEngineRoot() const { return nullptr; }
|
||||
|
||||
/// Retrieves the app root path for the application.
|
||||
virtual const char* GetAppRoot() const { return nullptr; }
|
||||
|
||||
/// Get the Command Line arguments passed in.
|
||||
virtual const CommandLine* GetCommandLine() { return nullptr; }
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#include <AzCore/Console/Console.h>
|
||||
#include <AzFramework/Viewport/ViewportBus.h>
|
||||
#include <GridMate/Memory.h>
|
||||
#include <AzFramework/Physics/HeightfieldProviderBus.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include <AzFramework/AzFrameworkModule.h>
|
||||
@@ -224,13 +225,6 @@ namespace AzFramework
|
||||
}
|
||||
}
|
||||
|
||||
void Application::PreModuleLoad()
|
||||
{
|
||||
SetRootPath(RootPathType::EngineRoot, m_engineRoot.c_str());
|
||||
AZ_TracePrintf(s_azFrameworkWarningWindow, "Engine Path: %s\n", m_engineRoot.c_str());
|
||||
}
|
||||
|
||||
|
||||
void Application::Stop()
|
||||
{
|
||||
if (m_isStarted)
|
||||
@@ -318,6 +312,8 @@ namespace AzFramework
|
||||
AzFramework::SurfaceData::SurfaceTagWeight::Reflect(context);
|
||||
AzFramework::SurfaceData::SurfacePoint::Reflect(context);
|
||||
AzFramework::Terrain::TerrainDataRequests::Reflect(context);
|
||||
Physics::HeightfieldProviderRequests::Reflect(context);
|
||||
Physics::HeightMaterialPoint::Reflect(context);
|
||||
|
||||
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
@@ -394,11 +390,6 @@ namespace AzFramework
|
||||
outModules.emplace_back(aznew AzFrameworkModule());
|
||||
}
|
||||
|
||||
const char* Application::GetAppRoot() const
|
||||
{
|
||||
return m_appRoot.c_str();
|
||||
}
|
||||
|
||||
const char* Application::GetCurrentConfigurationName() const
|
||||
{
|
||||
#if defined(_RELEASE)
|
||||
@@ -434,19 +425,19 @@ namespace AzFramework
|
||||
|
||||
void Application::ResolveEnginePath(AZStd::string& engineRelativePath) const
|
||||
{
|
||||
AZ::IO::FixedMaxPath fullPath = m_engineRoot / engineRelativePath;
|
||||
auto fullPath = AZ::IO::FixedMaxPath(GetEngineRoot()) / engineRelativePath;
|
||||
engineRelativePath = fullPath.String();
|
||||
}
|
||||
|
||||
void Application::CalculateBranchTokenForEngineRoot(AZStd::string& token) const
|
||||
{
|
||||
AzFramework::StringFunc::AssetPath::CalculateBranchToken(m_engineRoot.String(), token);
|
||||
AZ::StringFunc::AssetPath::CalculateBranchToken(GetEngineRoot(), token);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void Application::MakePathRootRelative(AZStd::string& fullPath)
|
||||
{
|
||||
MakePathRelative(fullPath, m_engineRoot.c_str());
|
||||
MakePathRelative(fullPath, GetEngineRoot());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@@ -582,30 +573,6 @@ namespace AzFramework
|
||||
}
|
||||
}
|
||||
|
||||
void Application::SetRootPath(RootPathType type, const char* source)
|
||||
{
|
||||
[[maybe_unused]] const size_t sourceLen = strlen(source);
|
||||
|
||||
// Copy the source path to the intended root path and correct the path separators as well
|
||||
switch (type)
|
||||
{
|
||||
case RootPathType::AppRoot:
|
||||
{
|
||||
AZ_Assert(sourceLen < m_appRoot.Native().max_size(), "String overflow for App Root: %s", source);
|
||||
m_appRoot = AZ::IO::PathView(source).LexicallyNormal();
|
||||
}
|
||||
break;
|
||||
case RootPathType::EngineRoot:
|
||||
{
|
||||
AZ_Assert(sourceLen < m_engineRoot.Native().max_size(), "String overflow for Engine Root: %s", source);
|
||||
m_engineRoot = AZ::IO::PathView(source).LexicallyNormal();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AZ_Assert(false, "Invalid RootPathType (%d)", static_cast<int>(type));
|
||||
}
|
||||
}
|
||||
|
||||
struct DeprecatedAliasesKeyVisitor
|
||||
: AZ::SettingsRegistryInterface::Visitor
|
||||
{
|
||||
|
||||
@@ -95,8 +95,6 @@ namespace AzFramework
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! ApplicationRequests::Bus::Handler
|
||||
const char* GetEngineRoot() const override { return m_engineRoot.c_str(); }
|
||||
const char* GetAppRoot() const override;
|
||||
void ResolveEnginePath(AZStd::string& engineRelativePath) const override;
|
||||
void CalculateBranchTokenForEngineRoot(AZStd::string& token) const override;
|
||||
bool IsPrefabSystemEnabled() const override;
|
||||
@@ -146,8 +144,6 @@ namespace AzFramework
|
||||
*/
|
||||
void SetFileIOAliases();
|
||||
|
||||
void PreModuleLoad() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//! AZ::ComponentApplication
|
||||
void RegisterCoreComponents() override;
|
||||
@@ -181,13 +177,7 @@ namespace AzFramework
|
||||
bool m_ownsConsole = false;
|
||||
|
||||
bool m_exitMainLoopRequested = false;
|
||||
|
||||
enum class RootPathType
|
||||
{
|
||||
AppRoot,
|
||||
EngineRoot
|
||||
};
|
||||
void SetRootPath(RootPathType type, const char* source);
|
||||
|
||||
};
|
||||
} // namespace AzFramework
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "HeightfieldProviderBus.h"
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
|
||||
namespace Physics
|
||||
{
|
||||
void HeightfieldProviderRequests::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<Physics::HeightfieldProviderRequestsBus>("HeightfieldProviderRequestsBus")
|
||||
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
|
||||
->Attribute(AZ::Script::Attributes::Module, "physics")
|
||||
->Attribute(AZ::Script::Attributes::Category, "PhysX")
|
||||
->Event("GetHeightfieldGridSpacing", &Physics::HeightfieldProviderRequestsBus::Events::GetHeightfieldGridSpacing)
|
||||
->Event("GetHeightfieldAabb", &Physics::HeightfieldProviderRequestsBus::Events::GetHeightfieldAabb)
|
||||
->Event("GetHeightfieldTransform", &Physics::HeightfieldProviderRequestsBus::Events::GetHeightfieldTransform)
|
||||
->Event("GetMaterialList", &Physics::HeightfieldProviderRequestsBus::Events::GetMaterialList)
|
||||
->Event("GetHeights", &Physics::HeightfieldProviderRequestsBus::Events::GetHeights)
|
||||
->Event("GetHeightsAndMaterials", &Physics::HeightfieldProviderRequestsBus::Events::GetHeightsAndMaterials)
|
||||
->Event("GetHeightfieldMinHeight", &Physics::HeightfieldProviderRequestsBus::Events::GetHeightfieldMinHeight)
|
||||
->Event("GetHeightfieldMaxHeight", &Physics::HeightfieldProviderRequestsBus::Events::GetHeightfieldMaxHeight)
|
||||
->Event("GetHeightfieldGridColumns", &Physics::HeightfieldProviderRequestsBus::Events::GetHeightfieldGridColumns)
|
||||
->Event("GetHeightfieldGridRows", &Physics::HeightfieldProviderRequestsBus::Events::GetHeightfieldGridRows)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void HeightMaterialPoint::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->Class<Physics::HeightMaterialPoint>()->Attribute(AZ::Script::Attributes::Category, "Physics");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Physics
|
||||
@@ -26,10 +26,25 @@ namespace Physics
|
||||
|
||||
struct HeightMaterialPoint
|
||||
{
|
||||
HeightMaterialPoint(
|
||||
float height = 0.0f, QuadMeshType type = QuadMeshType::SubdivideUpperLeftToBottomRight, uint8_t index = 0)
|
||||
: m_height(height)
|
||||
, m_quadMeshType(type)
|
||||
, m_materialIndex(index)
|
||||
, m_padding(0)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~HeightMaterialPoint() = default;
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
AZ_RTTI(HeightMaterialPoint, "{DF167ED4-24E6-4F7B-8AB7-42622F7DBAD3}");
|
||||
float m_height{ 0.0f }; //!< Holds the height of this point in the heightfield relative to the heightfield entity location.
|
||||
QuadMeshType m_quadMeshType{ QuadMeshType::SubdivideUpperLeftToBottomRight }; //!< By default, create two triangles like this |\|, where this point is in the upper left corner.
|
||||
uint8_t m_materialIndex{ 0 }; //!< The surface material index for the upper left corner of this quad.
|
||||
uint16_t m_padding{ 0 }; //!< available for future use.
|
||||
|
||||
};
|
||||
|
||||
//! An interface to provide heightfield values.
|
||||
@@ -37,6 +52,8 @@ namespace Physics
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
//! Returns the distance between each height in the map.
|
||||
//! @return Vector containing Column Spacing, Rows Spacing.
|
||||
virtual AZ::Vector2 GetHeightfieldGridSpacing() const = 0;
|
||||
@@ -46,11 +63,27 @@ namespace Physics
|
||||
//! @param numRows contains the size of the grid in the y direction.
|
||||
virtual void GetHeightfieldGridSize(int32_t& numColumns, int32_t& numRows) const = 0;
|
||||
|
||||
//! Returns the height field gridsize columns.
|
||||
//! @return the size of the grid in the x direction.
|
||||
virtual int32_t GetHeightfieldGridColumns() const = 0;
|
||||
|
||||
//! Returns the height field gridsize rows.
|
||||
//! @return the size of the grid in the y direction.
|
||||
virtual int32_t GetHeightfieldGridRows() const = 0;
|
||||
|
||||
//! Returns the height field min and max height bounds.
|
||||
//! @param minHeightBounds contains the minimum height that the heightfield can contain.
|
||||
//! @param maxHeightBounds contains the maximum height that the heightfield can contain.
|
||||
virtual void GetHeightfieldHeightBounds(float& minHeightBounds, float& maxHeightBounds) const = 0;
|
||||
|
||||
//! Returns the height field min height bounds.
|
||||
//! @return the minimum height that the heightfield can contain.
|
||||
virtual float GetHeightfieldMinHeight() const = 0;
|
||||
|
||||
//! Returns the height field max height bounds.
|
||||
//! @return the maximum height that the heightfield can contain.
|
||||
virtual float GetHeightfieldMaxHeight() const = 0;
|
||||
|
||||
//! Returns the AABB of the heightfield.
|
||||
//! This is provided separately from the shape AABB because the heightfield might choose to modify the AABB bounds.
|
||||
//! @return AABB of the heightfield.
|
||||
|
||||
@@ -360,6 +360,11 @@ namespace Physics
|
||||
->Field("MaterialId", &Physics::MaterialId::m_id)
|
||||
;
|
||||
}
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->Class<Physics::MaterialId>()->Attribute(AZ::Script::Attributes::Category, "Physics");
|
||||
}
|
||||
}
|
||||
|
||||
MaterialId MaterialId::Create()
|
||||
|
||||
@@ -229,6 +229,7 @@ set(FILES
|
||||
Physics/Configuration/SystemConfiguration.h
|
||||
Physics/Configuration/SystemConfiguration.cpp
|
||||
Physics/HeightfieldProviderBus.h
|
||||
Physics/HeightfieldProviderBus.cpp
|
||||
Physics/SimulatedBodies/RigidBody.h
|
||||
Physics/SimulatedBodies/RigidBody.cpp
|
||||
Physics/SimulatedBodies/StaticRigidBody.h
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
|
||||
#include <AzFramework/XcbConnectionManager.h>
|
||||
#include <AzFramework/XcbEventHandler.h>
|
||||
|
||||
Reference in New Issue
Block a user