3
0

SkinnedMeshSystemComponent.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <SkinnedMesh/SkinnedMeshSystemComponent.h>
  9. #include <SkinnedMesh/SkinnedMeshFeatureProcessor.h>
  10. #include <SkinnedMesh/SkinnedMeshComputePass.h>
  11. #include <SkinnedMesh/SkinnedMeshVertexStreamProperties.h>
  12. #include <SkinnedMesh/SkinnedMeshOutputStreamManager.h>
  13. #include <MorphTargets/MorphTargetComputePass.h>
  14. #include <Atom/RPI.Public/FeatureProcessorFactory.h>
  15. #include <Atom/RPI.Public/Pass/PassSystemInterface.h>
  16. #include <AzCore/Serialization/SerializeContext.h>
  17. namespace AZ
  18. {
  19. namespace Render
  20. {
  21. SkinnedMeshSystemComponent::SkinnedMeshSystemComponent() = default;
  22. SkinnedMeshSystemComponent::~SkinnedMeshSystemComponent() = default;
  23. void SkinnedMeshSystemComponent::Reflect(ReflectContext* context)
  24. {
  25. if (SerializeContext* serialize = azrtti_cast<SerializeContext*>(context))
  26. {
  27. serialize->Class<SkinnedMeshSystemComponent, Component>()
  28. ->Version(0)
  29. ;
  30. }
  31. SkinnedMeshFeatureProcessor::Reflect(context);
  32. }
  33. void SkinnedMeshSystemComponent::GetProvidedServices(ComponentDescriptor::DependencyArrayType& provided)
  34. {
  35. provided.push_back(AZ_CRC("SkinnedMeshService", 0xac7cea96));
  36. }
  37. void SkinnedMeshSystemComponent::GetIncompatibleServices(ComponentDescriptor::DependencyArrayType& incompatible)
  38. {
  39. incompatible.push_back(AZ_CRC("SkinnedMeshService", 0xac7cea96));
  40. }
  41. void SkinnedMeshSystemComponent::GetRequiredServices(ComponentDescriptor::DependencyArrayType& required)
  42. {
  43. required.push_back(AZ_CRC("RPISystem", 0xf2add773));
  44. }
  45. void SkinnedMeshSystemComponent::Init()
  46. {
  47. }
  48. void SkinnedMeshSystemComponent::Activate()
  49. {
  50. m_vertexStreamProperties = AZStd::make_unique<SkinnedMeshVertexStreamProperties>();
  51. m_outputStreamManager = AZStd::make_unique<SkinnedMeshOutputStreamManager>();
  52. AZ::RPI::FeatureProcessorFactory::Get()->RegisterFeatureProcessor<SkinnedMeshFeatureProcessor>();
  53. auto* passSystem = RPI::PassSystemInterface::Get();
  54. AZ_Assert(passSystem, "Cannot get the pass system.");
  55. passSystem->AddPassCreator(Name("MorphTargetComputePass"), &MorphTargetComputePass::Create);
  56. passSystem->AddPassCreator(Name("SkinnedMeshComputePass"), &SkinnedMeshComputePass::Create);
  57. }
  58. void SkinnedMeshSystemComponent::Deactivate()
  59. {
  60. AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor<SkinnedMeshFeatureProcessor>();
  61. m_outputStreamManager.reset();
  62. m_vertexStreamProperties.reset();
  63. }
  64. } // End Render namespace
  65. } // End AZ namespace