Merge branch 'main' into Atom/dmcdiar/ATOM-15517

This commit is contained in:
Doug McDiarmid
2021-06-02 19:09:48 -07:00
94 changed files with 2676 additions and 887 deletions
@@ -43,7 +43,7 @@ namespace AZ
{
PrimitiveType = AZ_BIT(0),
DepthState = AZ_BIT(1),
EnableStencil = AZ_BIT(2),
StencilState = AZ_BIT(2),
FaceCullMode = AZ_BIT(3),
BlendMode = AZ_BIT(4)
};
@@ -110,8 +110,8 @@ namespace AZ
//! Set DepthState if DrawStateOptions::DepthState option is enabled
void SetDepthState(RHI::DepthState depthState);
//! Enable/disable stencil if DrawStateOptions::EnableStencil option is enabled
void SetEnableStencil(bool enable);
//! Set StencilState if DrawStateOptions::StencilState option is enabled
void SetStencilState(RHI::StencilState stencilState);
//! Set CullMode if DrawStateOptions::FaceCullMode option is enabled
void SetCullMode(RHI::CullMode cullMode);
//! Set TargetBlendState for target 0 if DrawStateOptions::BlendMode option is enabled
@@ -188,7 +188,7 @@ namespace AZ
// states available for change
RHI::CullMode m_cullMode;
RHI::DepthState m_depthState;
bool m_enableStencil;
RHI::StencilState m_stencilState;
RHI::PrimitiveTopology m_topology;
RHI::TargetBlendState m_blendState0;
@@ -35,7 +35,15 @@ namespace AZ
ModelKdTree() = default;
bool Build(const ModelAsset* model);
bool RayIntersection(const AZ::Vector3& raySrc, const AZ::Vector3& rayDir, float& distance, AZ::Vector3& normal) const;
//! Return if a ray intersected the model.
//! @param raySrc The starting point of the ray.
//! @param rayDir The direction and length of the ray (magnitude is encoded in the direction).
//! @param[out] The normalized distance of the intersection (in the range 0.0-1.0) - to calculate the actual
//! distance, multiply distanceNormalized by the magnitude of rayDir.
//! @param[out] The surface normal of the intersection with the model.
//! @return Return true if there was an intersection with the model, false otherwise.
bool RayIntersection(
const AZ::Vector3& raySrc, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const;
void GetPenetratedBoxes(const AZ::Vector3& raySrc, const AZ::Vector3& rayDir, AZStd::vector<AZ::Aabb>& outBoxes);
enum ESplitAxis
@@ -53,8 +61,14 @@ namespace AZ
private:
void BuildRecursively(ModelKdTreeNode* pNode, const AZ::Aabb& boundbox, AZStd::vector<ObjectIdTriangleIndices>& indices);
bool RayIntersectionRecursively(ModelKdTreeNode* pNode, const AZ::Vector3& raySrc, const AZ::Vector3& rayDir, float& distance, AZ::Vector3& normal) const;
void GetPenetratedBoxesRecursively(ModelKdTreeNode* pNode, const AZ::Vector3& raySrc, const AZ::Vector3& rayDir, AZStd::vector<AZ::Aabb>& outBoxes);
bool RayIntersectionRecursively(
ModelKdTreeNode* pNode,
const AZ::Vector3& raySrc,
const AZ::Vector3& rayDir,
float& distanceNormalized,
AZ::Vector3& normal) const;
void GetPenetratedBoxesRecursively(
ModelKdTreeNode* pNode, const AZ::Vector3& raySrc, const AZ::Vector3& rayDir, AZStd::vector<AZ::Aabb>& outBoxes);
void ConstructMeshList(const ModelAsset* model, const AZ::Transform& matParent);
static const int s_MinimumVertexSizeInLeafNode = 3 * 10;