UVsRule.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. #pragma once
  9. #include <AzCore/Memory/SystemAllocator.h>
  10. #include <SceneAPI/SceneCore/DataTypes/Rules/IRule.h>
  11. #include <SceneAPI/SceneData/SceneDataConfiguration.h>
  12. namespace AZ
  13. {
  14. class ReflectContext;
  15. namespace SceneAPI
  16. {
  17. namespace Containers
  18. {
  19. class Scene;
  20. }
  21. namespace DataTypes
  22. {
  23. class IMeshVertexUVData;
  24. enum class UVsGenerationMethod
  25. {
  26. LeaveSceneDataAsIs = 0, //! don't do anything to the scene
  27. SphericalProjection = 1 //! generate UVs using simple spherical positional projection
  28. };
  29. }
  30. namespace SceneData
  31. {
  32. //! The UVsRule class contains the settings for one particular instance of the "Generate UVs" modifier
  33. //! on one particular mesh group in the scene.
  34. class SCENE_DATA_CLASS UVsRule
  35. : public DataTypes::IRule
  36. {
  37. public:
  38. AZ_RTTI(UVsRule, "{79FB186C-E9B2-4569-9172-84B85DF81DB9}", DataTypes::IRule);
  39. AZ_CLASS_ALLOCATOR(UVsRule, AZ::SystemAllocator)
  40. SCENE_DATA_API UVsRule();
  41. SCENE_DATA_API ~UVsRule() override = default;
  42. SCENE_DATA_API AZ::SceneAPI::DataTypes::UVsGenerationMethod GetGenerationMethod() const;
  43. SCENE_DATA_API bool GetReplaceExisting() const;
  44. static void Reflect(ReflectContext* context);
  45. // it can be useful to have a different default for when there is no rule ("do nothing" for example)
  46. // versus if the user actually clicks a button or something to cause a rule to exist now, ie, actually do something
  47. // useful.
  48. //! Return the default method for UV Generation when a Generate UVs rule is attached as a modifier to a mesh group.
  49. SCENE_DATA_API static AZ::SceneAPI::DataTypes::UVsGenerationMethod GetDefaultGenerationMethodWhenAddingNewRule();
  50. //! Return the default method for when there is no Generate UVs rule attached to the mesh group.
  51. //! this should probably be left as "do nothing" unless you want to auto-generate UVs for everything without UVs
  52. SCENE_DATA_API static AZ::SceneAPI::DataTypes::UVsGenerationMethod GetDefaultGenerationMethodWithNoRule();
  53. protected:
  54. AZ::SceneAPI::DataTypes::UVsGenerationMethod m_generationMethod = AZ::SceneAPI::DataTypes::UVsGenerationMethod::LeaveSceneDataAsIs;
  55. bool m_replaceExisting = false;
  56. };
  57. } // SceneData
  58. } // SceneAPI
  59. } // AZ