/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #pragma once #include #include #include #include #include #include #include #include #include namespace AZ { namespace RPI { class Model; class Scene; } namespace Render { class SkinnedMeshFeatureProcessor; class SkinnedMeshRenderProxy final : public SkinnedMeshRenderProxyInterface { friend SkinnedMeshFeatureProcessor; public: AZ_RTTI(AZ::Render::SkinnedMeshRenderProxy, "{C77A21E7-113A-4DC9-972F-923E1BEFBC9A}", AZ::Render::SkinnedMeshRenderProxyInterface); explicit SkinnedMeshRenderProxy(const SkinnedMeshFeatureProcessorInterface::SkinnedMeshRenderProxyDesc& desc); void SetTransform(const Transform& transform) override; void SetSkinningMatrices(const AZStd::vector& data) override; void SetMorphTargetWeights(uint32_t lodIndex, const AZStd::vector& weights) override; AZStd::array_view< AZStd::unique_ptr> GetDispatchItems() const; private: AZ_DISABLE_COPY_MOVE(SkinnedMeshRenderProxy); bool Init(const RPI::Scene& scene, SkinnedMeshFeatureProcessor* featureProcessor); bool BuildDispatchItem(const RPI::Scene& scene, size_t modelLodIndex, const SkinnedMeshShaderOptions& shaderOptions); Vector3 m_position = Vector3(0.0f, 0.0f, 0.0f); //!< Cached position so SkinnedMeshFeatureProcessor can make faster LOD calculations AZStd::fixed_vector, RPI::ModelLodAsset::LodCountMax> m_dispatchItemsByLod; AZStd::fixed_vector>, RPI::ModelLodAsset::LodCountMax> m_morphTargetDispatchItemsByLod; Data::Instance m_inputBuffers; Data::Instance m_morphTargetInputBuffers; AZStd::intrusive_ptr m_instance; AZStd::shared_ptr m_meshHandle; SkinnedMeshShaderOptions m_shaderOptions; Data::Instance m_boneTransforms; SkinnedMeshFeatureProcessor* m_featureProcessor = nullptr; bool m_isQueuedForCompile = false; }; using SkinnedMeshRenderProxyHandle = StableDynamicArrayHandle; } // namespace Render } // namespace AZ