BsMeshImportOptions.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. /** Contains information about a piece of imported animation that will be used for generating its own AnimationClip. */
  19. struct AnimationSplitInfo : IReflectable
  20. {
  21. String name;
  22. UINT32 startFrame;
  23. UINT32 endFrame;
  24. bool isAdditive;
  25. /************************************************************************/
  26. /* SERIALIZATION */
  27. /************************************************************************/
  28. public:
  29. friend class AnimationSplitInfoRTTI;
  30. static RTTITypeBase* getRTTIStatic();
  31. RTTITypeBase* getRTTI() const override;
  32. };
  33. /**
  34. * Contains import options you may use to control how is a mesh imported from some external format into engine format.
  35. */
  36. class BS_CORE_EXPORT MeshImportOptions : public ImportOptions
  37. {
  38. public:
  39. MeshImportOptions();
  40. /** Sets whether the texture data is also stored in CPU memory. */
  41. void setCPUReadable(bool readable) { mCPUReadable = readable; }
  42. /** Retrieves whether the texture data is also stored in CPU memory. */
  43. bool getCPUReadable() const { return mCPUReadable; }
  44. /** Sets a value that controls should mesh normals be imported if available. */
  45. void setImportNormals(bool import) { mImportNormals = import; }
  46. /** Retrieves a value that controls should mesh normals be imported if available. */
  47. bool getImportNormals() const { return mImportNormals; }
  48. /** Sets a value that controls should mesh tangents/bitangents be imported if available. */
  49. void setImportTangents(bool import) { mImportTangents = import; }
  50. /** Retrieves a value that controls should mesh tangent/bitangent be imported if available. */
  51. bool getImportTangents() const { return mImportTangents; }
  52. /** Sets a value that controls should mesh blend shapes be imported if available. */
  53. void setImportBlendShapes(bool import) { mImportBlendShapes = import; }
  54. /** Retrieves a value that controls should mesh blend shapes be imported if available. */
  55. bool getImportBlendShapes() const { return mImportBlendShapes; }
  56. /**
  57. * Sets a value that controls should mesh skin data like bone weights, indices and bind poses be imported if
  58. * available.
  59. */
  60. void setImportSkin(bool import) { mImportSkin = import; }
  61. /**
  62. * Retrieves a value that controls should mesh skin data like bone weights, indices and bind poses be imported if
  63. * available.
  64. */
  65. bool getImportSkin() const { return mImportSkin; }
  66. /** Sets a value that controls should animation clips be imported if available. */
  67. void setImportAnimation(bool import) { mImportAnimation = import; }
  68. /** Retrieves a value that controls should animation clips be imported if available. */
  69. bool getImportAnimation() const { return mImportAnimation; }
  70. /** Sets a value that will uniformly scale the imported mesh by the specified value. */
  71. void setImportScale(float import) { mImportScale = import; }
  72. /** Retrieves a value that will uniformly scale the imported mesh by the specified value. */
  73. float getImportScale() const { return mImportScale; }
  74. /** Sets a value that controls what type (if any) of collision mesh should be imported. */
  75. void setCollisionMeshType(CollisionMeshType type) { mCollisionMeshType = type; }
  76. /** Retrieves a value that controls what type (if any) of collision mesh should be imported. */
  77. CollisionMeshType getCollisionMeshType() const { return mCollisionMeshType; }
  78. /**
  79. * Registers an animation split info that determines how will the source animation clip be split. If not splits
  80. * are present the data will be imported as one clip, but if splits are present the data will be split according
  81. * to the split infos.
  82. */
  83. void addAnimationClipSplit(const AnimationSplitInfo& splitInfo) { mAnimationSplits.push_back(splitInfo); }
  84. /** Returns in how many pieces should the imported animation clip be split info. */
  85. UINT32 getNumAnimationClipSplits() const { return (UINT32)mAnimationSplits.size(); }
  86. /** Returns information about an animation split at the specified index. */
  87. const AnimationSplitInfo& getAnimationClipSplit(UINT32 idx) const { return mAnimationSplits[idx]; }
  88. /** Removes an animation split info at the specified index. */
  89. void removeAnimationClipSplit(UINT32 idx) { mAnimationSplits.erase(mAnimationSplits.begin() + idx); }
  90. private:
  91. bool mCPUReadable;
  92. bool mImportNormals;
  93. bool mImportTangents;
  94. bool mImportBlendShapes;
  95. bool mImportSkin;
  96. bool mImportAnimation;
  97. float mImportScale;
  98. CollisionMeshType mCollisionMeshType;
  99. Vector<AnimationSplitInfo> mAnimationSplits;
  100. /************************************************************************/
  101. /* SERIALIZATION */
  102. /************************************************************************/
  103. public:
  104. friend class MeshImportOptionsRTTI;
  105. static RTTITypeBase* getRTTIStatic();
  106. RTTITypeBase* getRTTI() const override;
  107. };
  108. /** @} */
  109. }