You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.8 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015 Mario Luzeiro <mrluzeiro@ua.pt>
  5. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file c3dmodel.h
  26. * @brief define an internal structure to be used by the 3D renders
  27. */
  28. #ifndef C3DMODEL_H
  29. #define C3DMODEL_H
  30. #include "plugins/3dapi/xv3d_types.h"
  31. typedef struct
  32. {
  33. SFVEC3F m_Ambient; //
  34. SFVEC3F m_Diffuse; ///< Default diffuse color if m_Color is NULL
  35. SFVEC3F m_Emissive; //
  36. SFVEC3F m_Specular; //
  37. float m_Shininess; //
  38. float m_Transparency; ///< 1.0 is completely transparent, 0.0 completely opaque
  39. // !TODO: to be implemented
  40. /*struct textures
  41. {
  42. wxString m_Ambient; // map_Ka
  43. wxString m_Diffuse; // map_Kd
  44. wxString m_Specular; // map_Ks
  45. wxString m_Specular_highlight; // map_Ns
  46. wxString m_Bump; // map_bump, bump
  47. wxString m_Displacement; // disp
  48. wxString m_Alpha; // map_d
  49. };*/
  50. } SMATERIAL;
  51. /// Per-vertex normal/color/texcoors structure.
  52. /// CONDITIONS:
  53. /// m_Positions size == m_Normals size == m_Texcoords size == m_Color size
  54. /// m_Texcoords can be NULL, textures will not be applied in that case
  55. /// m_Color can be NULL, it will use the m_Diffuse color for every triangle
  56. /// any m_FaceIdx must be an index of a the element lists
  57. /// m_MaterialIdx must be an existent material index stored in the parent model
  58. /// SCALES:
  59. /// m_Positions units are in mm, example:
  60. /// 0.1 unit == 0.1 mm
  61. /// 1.0 unit == 1.0 mm
  62. /// 10.0 unit == 10.0 mm
  63. ///
  64. /// To convert this units to pcbunits, use the convertion facto UNITS3D_TO_UNITSPCB
  65. ///
  66. /// m_Normals, m_Color and m_Texcoords are beween 0.0f and 1.0f
  67. typedef struct
  68. {
  69. unsigned int m_VertexSize; ///< Number of vertex in the arrays
  70. SFVEC3F *m_Positions; ///< Vertex position array
  71. SFVEC3F *m_Normals; ///< Vertex normals array
  72. SFVEC2F *m_Texcoords; ///< Vertex texture coordinates array, can be NULL
  73. SFVEC3F *m_Color; ///< Vertex color array, can be NULL
  74. unsigned int m_FaceIdxSize; ///< Number of elements of the m_FaceIdx array
  75. unsigned int *m_FaceIdx; ///< Triangle Face Indexes
  76. unsigned int m_MaterialIdx; ///< Material Index to be used in this mesh (must be < m_MaterialsSize )
  77. } SMESH;
  78. /// Store the a model based on meshes and materials
  79. typedef struct
  80. {
  81. unsigned int m_MeshesSize; ///< Number of meshes in the array
  82. SMESH *m_Meshes; ///< The meshes list of this model
  83. unsigned int m_MaterialsSize; ///< Number of materials in the material array
  84. SMATERIAL *m_Materials; ///< The materials list of this model
  85. } S3DMODEL;
  86. #endif // C3DMODEL_H