|
@@ -43,11 +43,13 @@ namespace GeomNodes
|
|
explicit GNRenderMesh(AZ::EntityId entityId);
|
|
explicit GNRenderMesh(AZ::EntityId entityId);
|
|
~GNRenderMesh();
|
|
~GNRenderMesh();
|
|
|
|
|
|
- // RenderMeshInterface ...
|
|
|
|
- void BuildMesh(const GNModelData& renderData, const AZ::Transform& worldFromLocal);
|
|
|
|
|
|
+ //! For building the mesh.
|
|
|
|
+ void BuildMesh(const GNModelData& renderData);
|
|
|
|
+ //! Updates the models transform
|
|
void UpdateTransform(const AZ::Transform& worldFromLocal, const AZ::Vector3& scale = AZ::Vector3::CreateOne());
|
|
void UpdateTransform(const AZ::Transform& worldFromLocal, const AZ::Vector3& scale = AZ::Vector3::CreateOne());
|
|
- //void UpdateMaterial(const GNMaterial& material);
|
|
|
|
|
|
+ //! Returns if the Model/Mesh is visible or not.
|
|
bool IsVisible() const;
|
|
bool IsVisible() const;
|
|
|
|
+ //! Sets the visibility of the Model/Mesh
|
|
void SetVisiblity(bool visibility);
|
|
void SetVisiblity(bool visibility);
|
|
|
|
|
|
// AZ::TickBus overrides ...
|
|
// AZ::TickBus overrides ...
|
|
@@ -63,9 +65,12 @@ namespace GeomNodes
|
|
// MaterialComponentNotificationBus::Handler overrides...
|
|
// MaterialComponentNotificationBus::Handler overrides...
|
|
void OnMaterialsUpdated(const AZ::Render::MaterialAssignmentMap& materials) override;
|
|
void OnMaterialsUpdated(const AZ::Render::MaterialAssignmentMap& materials) override;
|
|
|
|
|
|
|
|
+ //! Returns the Model's data instance
|
|
AZ::Data::Instance<AZ::RPI::Model> GetModel() const;
|
|
AZ::Data::Instance<AZ::RPI::Model> GetModel() const;
|
|
|
|
|
|
- void SetMaterialList(const AZStd::vector<AZStd::string>& materials);
|
|
|
|
|
|
+ //! Sets the material paths used by the model. These are full paths with the azmaterial extension.
|
|
|
|
+ void SetMaterialPathList(const AZStd::vector<AZStd::string>& materialPaths);
|
|
|
|
+
|
|
private:
|
|
private:
|
|
//! Creates an attribute buffer in the slot dictated by AttributeTypeT.
|
|
//! Creates an attribute buffer in the slot dictated by AttributeTypeT.
|
|
template<AttributeType AttributeTypeT, typename VertexStreamDataType>
|
|
template<AttributeType AttributeTypeT, typename VertexStreamDataType>
|
|
@@ -87,28 +92,45 @@ namespace GeomNodes
|
|
// MeshHandleStateRequestBus overrides ...
|
|
// MeshHandleStateRequestBus overrides ...
|
|
const AZ::Render::MeshFeatureProcessorInterface::MeshHandle* GetMeshHandle() const override;
|
|
const AZ::Render::MeshFeatureProcessorInterface::MeshHandle* GetMeshHandle() const override;
|
|
|
|
|
|
|
|
+ //! Creates the attribute mesh buffers
|
|
bool CreateMeshBuffers(const GNModelData& modelData);
|
|
bool CreateMeshBuffers(const GNModelData& modelData);
|
|
|
|
+ //! Creates everything related to the model for Atom Rendering.
|
|
bool CreateMesh(const GNModelData& modelData);
|
|
bool CreateMesh(const GNModelData& modelData);
|
|
|
|
+ //! Using the ModelLodAssetCreator creates the Model LOD asset and the meshes.
|
|
bool CreateLodAsset(const GNModelData& modelData);
|
|
bool CreateLodAsset(const GNModelData& modelData);
|
|
|
|
+ //! Using the ModelAssetCreator creates the model asset and sets the material slots.
|
|
void CreateModelAsset();
|
|
void CreateModelAsset();
|
|
|
|
+ //! Final step for create the model by acquiring the mesh handle from the mesh feature processor
|
|
bool CreateModel();
|
|
bool CreateModel();
|
|
|
|
+ //! Add LOD buffers to ModelLodAsset
|
|
void AddLodBuffers(AZ::RPI::ModelLodAssetCreator& modelLodCreator);
|
|
void AddLodBuffers(AZ::RPI::ModelLodAssetCreator& modelLodCreator);
|
|
|
|
+ //! Add Mesh Buffers to ModelLodAsset
|
|
void AddMeshBuffers(AZ::RPI::ModelLodAssetCreator& modelLodCreator, const GNMeshData& meshData);
|
|
void AddMeshBuffers(AZ::RPI::ModelLodAssetCreator& modelLodCreator, const GNMeshData& meshData);
|
|
|
|
+ //! Checks if attributes are valid.
|
|
bool AreAttributesValid() const;
|
|
bool AreAttributesValid() const;
|
|
bool DoesMeshRequireFullRebuild(const GNMeshData& meshData) const;
|
|
bool DoesMeshRequireFullRebuild(const GNMeshData& meshData) const;
|
|
-
|
|
|
|
|
|
+ //! Set the material map in the mesh feature processor.
|
|
void SetMaterials();
|
|
void SetMaterials();
|
|
|
|
|
|
|
|
+ //! Stores the assigned EntityId.
|
|
AZ::EntityId m_entityId;
|
|
AZ::EntityId m_entityId;
|
|
|
|
+ //! Reference to a ModelLodAsset
|
|
AZ::Data::Asset<AZ::RPI::ModelLodAsset> m_lodAsset;
|
|
AZ::Data::Asset<AZ::RPI::ModelLodAsset> m_lodAsset;
|
|
|
|
+ //! Reference to a ModelAsset
|
|
AZ::Data::Asset<AZ::RPI::ModelAsset> m_modelAsset;
|
|
AZ::Data::Asset<AZ::RPI::ModelAsset> m_modelAsset;
|
|
|
|
+ //! Reference to a Model instance
|
|
AZ::Data::Instance<AZ::RPI::Model> m_model;
|
|
AZ::Data::Instance<AZ::RPI::Model> m_model;
|
|
|
|
+ //! Reference to MeshFeatureProcessor
|
|
AZ::Render::MeshFeatureProcessorInterface* m_meshFeatureProcessor = nullptr;
|
|
AZ::Render::MeshFeatureProcessorInterface* m_meshFeatureProcessor = nullptr;
|
|
|
|
+ //! Reference to MeshHandle
|
|
AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
|
|
AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
|
|
|
|
+ //! Material map
|
|
AZ::Render::MaterialAssignmentMap m_materialMap;
|
|
AZ::Render::MaterialAssignmentMap m_materialMap;
|
|
- AZStd::vector<AZStd::string> m_materialList;
|
|
|
|
- uint32_t m_vertexCount = 0;
|
|
|
|
|
|
+ //! List of Material paths (i.e. azmodel)
|
|
|
|
+ AZStd::vector<AZStd::string> m_materialPathList;
|
|
|
|
+ //! LOD Index buffer
|
|
AZStd::unique_ptr<IndexBuffer> m_indexBuffer;
|
|
AZStd::unique_ptr<IndexBuffer> m_indexBuffer;
|
|
|
|
+ //! Buffers
|
|
AZStd::array<
|
|
AZStd::array<
|
|
AZStd::variant<
|
|
AZStd::variant<
|
|
AZStd::unique_ptr<PositionAttribute>,
|
|
AZStd::unique_ptr<PositionAttribute>,
|
|
@@ -119,12 +141,15 @@ namespace GeomNodes
|
|
AZStd::unique_ptr<ColorAttribute>>,
|
|
AZStd::unique_ptr<ColorAttribute>>,
|
|
NumAttributes>
|
|
NumAttributes>
|
|
m_attributes;
|
|
m_attributes;
|
|
|
|
+ //! For toggling visibility
|
|
bool m_visible = true;
|
|
bool m_visible = true;
|
|
|
|
|
|
//! model name.
|
|
//! model name.
|
|
static constexpr AZStd::string_view ModelName = "GeomNodesMesh";
|
|
static constexpr AZStd::string_view ModelName = "GeomNodesMesh";
|
|
|
|
|
|
|
|
+ //! current model transform
|
|
AZ::Transform m_transform;
|
|
AZ::Transform m_transform;
|
|
|
|
+ //! current model scale
|
|
AZ::Vector3 m_scale;
|
|
AZ::Vector3 m_scale;
|
|
};
|
|
};
|
|
}
|
|
}
|