Merge branch 'main' into Atom/antonmic/PassChanges
This commit is contained in:
@@ -112,6 +112,8 @@ namespace AZ
|
||||
AZStd::mutex m_pendingUploadMutex;
|
||||
|
||||
RHI::BufferViewDescriptor m_bufferViewDescriptor;
|
||||
|
||||
RHI::AttachmentId m_attachmentId;
|
||||
};
|
||||
|
||||
template <class structureType>
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace AZ
|
||||
// BufferSystemInterface overrides...
|
||||
RHI::Ptr<RHI::BufferPool> GetCommonBufferPool(CommonBufferPoolType poolType) override;
|
||||
Data::Instance<Buffer> CreateBufferFromCommonPool(const CommonBufferDescriptor& descriptor) override;
|
||||
Data::Instance<Buffer> FindCommonBuffer(AZStd::string_view bufferName) override;
|
||||
Data::Instance<Buffer> FindCommonBuffer(AZStd::string_view uniqueBufferName) override;
|
||||
|
||||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
@@ -53,6 +53,9 @@ namespace AZ
|
||||
RHI::Format m_elementFormat = RHI::Format::Unknown; //<! [optional] If it's specified with a valid format, the size of this format will be used instead of m_elementSize
|
||||
AZ::u64 m_byteCount = 0;
|
||||
const void* m_bufferData = nullptr; //<! [optional] Initial data content of this buffer. This data buffer size needs to be same as m_bufferSizeInbytes
|
||||
//! Set to true if you want this buffer to be discoverable by BufferSystemInterface::FindCommonBuffer using m_bufferName.
|
||||
//! Note that create buffer may fail if there is a buffer with the same name.
|
||||
bool m_isUniqueName = false;
|
||||
};
|
||||
|
||||
class BufferSystemInterface
|
||||
@@ -78,7 +81,7 @@ namespace AZ
|
||||
virtual Data::Instance<Buffer> CreateBufferFromCommonPool(const CommonBufferDescriptor& descriptor) = 0;
|
||||
|
||||
//! Find a buffer by name. The buffer has to be created by CreateBufferFromCommonPool function
|
||||
virtual Data::Instance<Buffer> FindCommonBuffer(AZStd::string_view bufferName) = 0;
|
||||
virtual Data::Instance<Buffer> FindCommonBuffer(AZStd::string_view uniqueBufferName) = 0;
|
||||
};
|
||||
} // namespace RPI
|
||||
} // namespace AZ
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <AzFramework/Visibility/IVisibilitySystem.h>
|
||||
|
||||
#include <Atom/RPI.Public/View.h>
|
||||
|
||||
#include <Atom/RHI/DrawList.h>
|
||||
|
||||
#include <AtomCore/std/parallel/concurrency_checker.h>
|
||||
@@ -97,6 +96,9 @@ namespace AZ
|
||||
};
|
||||
LodData m_lodData;
|
||||
|
||||
//! Flag indicating if the object is visible, i.e., was not culled out in the last frame
|
||||
bool m_isVisible = true;
|
||||
|
||||
void SetDebugName([[maybe_unused]] const AZ::Name& debugName)
|
||||
{
|
||||
#ifdef AZ_CULL_DEBUG_ENABLED
|
||||
@@ -213,6 +215,21 @@ namespace AZ
|
||||
void Activate(const class Scene* parentScene);
|
||||
void Deactivate();
|
||||
|
||||
struct OcclusionPlane
|
||||
{
|
||||
// World space corners of the occluson plane
|
||||
Vector3 m_cornerBL;
|
||||
Vector3 m_cornerTL;
|
||||
Vector3 m_cornerTR;
|
||||
Vector3 m_cornerBR;
|
||||
|
||||
Aabb m_aabb;
|
||||
};
|
||||
using OcclusionPlaneVector = AZStd::vector<OcclusionPlane>;
|
||||
|
||||
//! Sets a list of occlusion planes to be used during the culling process.
|
||||
void SetOcclusionPlanes(const OcclusionPlaneVector& occlusionPlanes) { m_occlusionPlanes = occlusionPlanes; }
|
||||
|
||||
//! Notifies the CullingScene that culling will begin for this frame.
|
||||
void BeginCulling(const AZStd::vector<ViewPtr>& views);
|
||||
|
||||
@@ -251,12 +268,9 @@ namespace AZ
|
||||
|
||||
const Scene* m_parentScene = nullptr;
|
||||
AzFramework::IVisibilityScene* m_visScene = nullptr;
|
||||
|
||||
CullingDebugContext m_debugCtx;
|
||||
|
||||
AZStd::concurrency_checker m_cullDataConcurrencyCheck;
|
||||
|
||||
AZStd::mutex m_mutex;
|
||||
OcclusionPlaneVector m_occlusionPlanes;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/Name/Name.h>
|
||||
|
||||
class MaskedOcclusionCulling;
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace RHI
|
||||
@@ -57,7 +59,7 @@ namespace AZ
|
||||
//! Only use this function to create a new view object. And force using smart pointer to manage view's life time
|
||||
static ViewPtr CreateView(const AZ::Name& name, UsageFlags usage);
|
||||
|
||||
~View() = default;
|
||||
~View();
|
||||
|
||||
void SetDrawListMask(const RHI::DrawListMask& drawListMask);
|
||||
RHI::DrawListMask GetDrawListMask() const { return m_drawListMask; }
|
||||
@@ -126,6 +128,12 @@ namespace AZ
|
||||
//! Notifies consumers when the world to clip matrix has changed.
|
||||
void ConnectWorldToClipMatrixChangedHandler(MatrixChangedEvent::Handler& handler);
|
||||
|
||||
//! Prepare for view culling
|
||||
void BeginCulling();
|
||||
|
||||
//! Returns the masked occlusion culling interface
|
||||
MaskedOcclusionCulling* GetMaskedOcclusionCulling();
|
||||
|
||||
private:
|
||||
View() = delete;
|
||||
View(const AZ::Name& name, UsageFlags usage);
|
||||
@@ -193,6 +201,9 @@ namespace AZ
|
||||
|
||||
MatrixChangedEvent m_onWorldToClipMatrixChange;
|
||||
MatrixChangedEvent m_onWorldToViewMatrixChange;
|
||||
|
||||
// Masked Occlusion Culling interface
|
||||
MaskedOcclusionCulling* m_maskedOcclusionCulling = nullptr;
|
||||
};
|
||||
|
||||
AZ_DEFINE_ENUM_BITWISE_OPERATORS(View::UsageFlags);
|
||||
|
||||
@@ -60,11 +60,15 @@ namespace AZ
|
||||
const Data::Asset<ResourcePoolAsset>& GetPoolAsset() const;
|
||||
|
||||
CommonBufferPoolType GetCommonPoolType() const;
|
||||
|
||||
const AZStd::string& GetName() const;
|
||||
|
||||
private:
|
||||
// Called by asset creators to assign the asset to a ready state.
|
||||
void SetReady();
|
||||
|
||||
AZStd::string m_name;
|
||||
|
||||
AZStd::vector<uint8_t> m_buffer;
|
||||
|
||||
RHI::BufferDescriptor m_bufferDescriptor;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user