Addressed feedback from PR 4874. (#4915)
* Addressed feedback from PR 4874. * Removed second copy of HeightfieldProviderBus.h from cmake file * Changed CookedMeshShapeConfiguration and HeightfieldShapeConfiguration to have less messy implementations, instead opting for the slightly less messy const_cast inside of Utils.cpp and DebugDraw.cpp. * Changed InitHeightfieldShapeConfiguraiton to CreateHeightfieldShapeConfiguration with a better API signature. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Fixed indentation Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
This commit is contained in:
@@ -286,12 +286,17 @@ namespace Physics
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void* CookedMeshShapeConfiguration::GetCachedNativeMesh() const
|
||||
const void* CookedMeshShapeConfiguration::GetCachedNativeMesh() const
|
||||
{
|
||||
return m_cachedNativeMesh;
|
||||
}
|
||||
|
||||
void CookedMeshShapeConfiguration::SetCachedNativeMesh(void* cachedNativeMesh) const
|
||||
void* CookedMeshShapeConfiguration::GetCachedNativeMesh()
|
||||
{
|
||||
return m_cachedNativeMesh;
|
||||
}
|
||||
|
||||
void CookedMeshShapeConfiguration::SetCachedNativeMesh(void* cachedNativeMesh)
|
||||
{
|
||||
m_cachedNativeMesh = cachedNativeMesh;
|
||||
}
|
||||
@@ -353,12 +358,17 @@ namespace Physics
|
||||
return *this;
|
||||
}
|
||||
|
||||
void* HeightfieldShapeConfiguration::GetCachedNativeHeightfield() const
|
||||
const void* HeightfieldShapeConfiguration::GetCachedNativeHeightfield() const
|
||||
{
|
||||
return m_cachedNativeHeightfield;
|
||||
}
|
||||
|
||||
void HeightfieldShapeConfiguration::SetCachedNativeHeightfield(void* cachedNativeHeightfield) const
|
||||
void* HeightfieldShapeConfiguration::GetCachedNativeHeightfield()
|
||||
{
|
||||
return m_cachedNativeHeightfield;
|
||||
}
|
||||
|
||||
void HeightfieldShapeConfiguration::SetCachedNativeHeightfield(void* cachedNativeHeightfield)
|
||||
{
|
||||
if (m_cachedNativeHeightfield)
|
||||
{
|
||||
@@ -427,4 +437,5 @@ namespace Physics
|
||||
{
|
||||
m_maxHeightBounds = maxBounds;
|
||||
}
|
||||
}
|
||||
} // namespace Physics
|
||||
|
||||
|
||||
@@ -187,8 +187,9 @@ namespace Physics
|
||||
|
||||
MeshType GetMeshType() const;
|
||||
|
||||
void* GetCachedNativeMesh() const;
|
||||
void SetCachedNativeMesh(void* cachedNativeMesh) const;
|
||||
void* GetCachedNativeMesh();
|
||||
const void* GetCachedNativeMesh() const;
|
||||
void SetCachedNativeMesh(void* cachedNativeMesh);
|
||||
|
||||
private:
|
||||
void ReleaseCachedNativeMesh();
|
||||
@@ -197,7 +198,7 @@ namespace Physics
|
||||
MeshType m_type = MeshType::TriangleMesh;
|
||||
|
||||
//! Cached native mesh object (e.g. PxConvexMesh or PxTriangleMesh). This data is not serialized.
|
||||
mutable void* m_cachedNativeMesh = nullptr;
|
||||
void* m_cachedNativeMesh = nullptr;
|
||||
};
|
||||
|
||||
class HeightfieldShapeConfiguration
|
||||
@@ -217,8 +218,9 @@ namespace Physics
|
||||
return ShapeType::Heightfield;
|
||||
}
|
||||
|
||||
void* GetCachedNativeHeightfield() const;
|
||||
void SetCachedNativeHeightfield(void* cachedNativeHeightfield) const;
|
||||
const void* GetCachedNativeHeightfield() const;
|
||||
void* GetCachedNativeHeightfield();
|
||||
void SetCachedNativeHeightfield(void* cachedNativeHeightfield);
|
||||
AZ::Vector2 GetGridResolution() const;
|
||||
void SetGridResolution(const AZ::Vector2& gridSpacing);
|
||||
int32_t GetNumColumns() const;
|
||||
@@ -246,6 +248,6 @@ namespace Physics
|
||||
//! The grid of sample points for the heightfield.
|
||||
AZStd::vector<Physics::HeightMaterialPoint> m_samples;
|
||||
//! An optional storage pointer for the physics system to cache its native heightfield representation.
|
||||
mutable void* m_cachedNativeHeightfield{ nullptr };
|
||||
void* m_cachedNativeHeightfield{ nullptr };
|
||||
};
|
||||
} // namespace Physics
|
||||
|
||||
@@ -252,7 +252,6 @@ set(FILES
|
||||
Physics/Shape.h
|
||||
Physics/ShapeConfiguration.h
|
||||
Physics/ShapeConfiguration.cpp
|
||||
Physics/HeightfieldProviderBus.h
|
||||
Physics/SystemBus.h
|
||||
Physics/ColliderComponentBus.h
|
||||
Physics/RagdollPhysicsBus.h
|
||||
|
||||
Reference in New Issue
Block a user