您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

104 行
3.6 KiB

  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2012, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. /** @file Defines the helper data structures for importing 3DS files.
  34. http://www.jalix.org/ressources/graphics/3DS/_unofficials/3ds-unofficial.txt */
  35. #ifndef AI_SMOOTHINGGROUPS_H_INC
  36. #define AI_SMOOTHINGGROUPS_H_INC
  37. // ---------------------------------------------------------------------------
  38. /** Helper structure representing a face with smoothing groups assigned */
  39. struct FaceWithSmoothingGroup
  40. {
  41. FaceWithSmoothingGroup() : iSmoothGroup(0)
  42. {
  43. // let the rest uninitialized for performance - in release builds.
  44. // in debug builds set all indices to a common magic value
  45. #ifdef ASSIMP_BUILD_DEBUG
  46. this->mIndices[0] = 0xffffffff;
  47. this->mIndices[1] = 0xffffffff;
  48. this->mIndices[2] = 0xffffffff;
  49. #endif
  50. }
  51. //! Indices. .3ds is using uint16. However, after
  52. //! an unique vrtex set has been generated,
  53. //! individual index values might exceed 2^16
  54. uint32_t mIndices[3];
  55. //! specifies to which smoothing group the face belongs to
  56. uint32_t iSmoothGroup;
  57. };
  58. // ---------------------------------------------------------------------------
  59. /** Helper structure representing a mesh whose faces have smoothing
  60. groups assigned. This allows us to reuse the code for normal computations
  61. from smoothings groups for several loaders (3DS, ASE). All of them
  62. use face structures which inherit from #FaceWithSmoothingGroup,
  63. but as they add extra members and need to be copied by value we
  64. need to use a template here.
  65. */
  66. template <class T>
  67. struct MeshWithSmoothingGroups
  68. {
  69. //! Vertex positions
  70. std::vector<aiVector3D> mPositions;
  71. //! Face lists
  72. std::vector<T> mFaces;
  73. //! List of normal vectors
  74. std::vector<aiVector3D> mNormals;
  75. };
  76. // ---------------------------------------------------------------------------
  77. /** Computes normal vectors for the mesh
  78. */
  79. template <class T>
  80. void ComputeNormalsWithSmoothingsGroups(MeshWithSmoothingGroups<T>& sMesh);
  81. // include implementations
  82. #include "SmoothingGroups.inl"
  83. #endif // !! AI_SMOOTHINGGROUPS_H_INC