BsMeshImportOptions.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. #include "BsImportOptions.h"
  6. namespace BansheeEngine
  7. {
  8. /** @addtogroup Importer
  9. * @{
  10. */
  11. /** Controls what type of collision mesh should be imported during mesh import. */
  12. enum class CollisionMeshType
  13. {
  14. None, /**< No collision mesh will be imported. */
  15. Normal, /**< Normal triangle mesh will be imported. */
  16. Convex /**< A convex hull will be generated from the source mesh. */
  17. };
  18. /** Information about how to split an AnimationClip into multiple separate clips. */
  19. struct BS_CORE_EXPORT AnimationSplitInfo : IReflectable
  20. {
  21. AnimationSplitInfo() { }
  22. String name;
  23. UINT32 startFrame = 0;
  24. UINT32 endFrame = 0;
  25. bool isAdditive = false;
  26. /************************************************************************/
  27. /* SERIALIZATION */
  28. /************************************************************************/
  29. public:
  30. friend class AnimationSplitInfoRTTI;
  31. static RTTITypeBase* getRTTIStatic();
  32. RTTITypeBase* getRTTI() const override;
  33. };
  34. /**
  35. * Contains import options you may use to control how is a mesh imported from some external format into engine format.
  36. */
  37. class BS_CORE_EXPORT MeshImportOptions : public ImportOptions
  38. {
  39. public:
  40. MeshImportOptions();
  41. /** Sets whether the texture data is also stored in CPU memory. */
  42. void setCPUReadable(bool readable) { mCPUReadable = readable; }
  43. /** Retrieves whether the texture data is also stored in CPU memory. */
  44. bool getCPUReadable() const { return mCPUReadable; }
  45. /** Sets a value that controls should mesh normals be imported if available. */
  46. void setImportNormals(bool import) { mImportNormals = import; }
  47. /** Retrieves a value that controls should mesh normals be imported if available. */
  48. bool getImportNormals() const { return mImportNormals; }
  49. /** Sets a value that controls should mesh tangents/bitangents be imported if available. */
  50. void setImportTangents(bool import) { mImportTangents = import; }
  51. /** Retrieves a value that controls should mesh tangent/bitangent be imported if available. */
  52. bool getImportTangents() const { return mImportTangents; }
  53. /** Sets a value that controls should mesh blend shapes be imported if available. */
  54. void setImportBlendShapes(bool import) { mImportBlendShapes = import; }
  55. /** Retrieves a value that controls should mesh blend shapes be imported if available. */
  56. bool getImportBlendShapes() const { return mImportBlendShapes; }
  57. /**
  58. * Sets a value that controls should mesh skin data like bone weights, indices and bind poses be imported if
  59. * available.
  60. */
  61. void setImportSkin(bool import) { mImportSkin = import; }
  62. /**
  63. * Retrieves a value that controls should mesh skin data like bone weights, indices and bind poses be imported if
  64. * available.
  65. */
  66. bool getImportSkin() const { return mImportSkin; }
  67. /** Sets a value that controls should animation clips be imported if available. */
  68. void setImportAnimation(bool import) { mImportAnimation = import; }
  69. /** Retrieves a value that controls should animation clips be imported if available. */
  70. bool getImportAnimation() const { return mImportAnimation; }
  71. /** Sets a value that will uniformly scale the imported mesh by the specified value. */
  72. void setImportScale(float import) { mImportScale = import; }
  73. /** Retrieves a value that will uniformly scale the imported mesh by the specified value. */
  74. float getImportScale() const { return mImportScale; }
  75. /** Sets a value that controls what type (if any) of collision mesh should be imported. */
  76. void setCollisionMeshType(CollisionMeshType type) { mCollisionMeshType = type; }
  77. /** Retrieves a value that controls what type (if any) of collision mesh should be imported. */
  78. CollisionMeshType getCollisionMeshType() const { return mCollisionMeshType; }
  79. /**
  80. * Registers animation split infos that determine how will the source animation clip be split. If no splits
  81. * are present the data will be imported as one clip, but if splits are present the data will be split according
  82. * to the split infos. Split infos only affect the primary animation clip, other clips will not be split.
  83. */
  84. void setAnimationClipSplits(const Vector<AnimationSplitInfo>& splitInfos) { mAnimationSplits = splitInfos; }
  85. /** Returns a copy of the animation splits array. */
  86. Vector<AnimationSplitInfo> getAnimationClipSplits() const { return mAnimationSplits; }
  87. private:
  88. bool mCPUReadable;
  89. bool mImportNormals;
  90. bool mImportTangents;
  91. bool mImportBlendShapes;
  92. bool mImportSkin;
  93. bool mImportAnimation;
  94. float mImportScale;
  95. CollisionMeshType mCollisionMeshType;
  96. Vector<AnimationSplitInfo> mAnimationSplits;
  97. /************************************************************************/
  98. /* SERIALIZATION */
  99. /************************************************************************/
  100. public:
  101. friend class MeshImportOptionsRTTI;
  102. static RTTITypeBase* getRTTIStatic();
  103. RTTITypeBase* getRTTI() const override;
  104. };
  105. /** @} */
  106. }