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 /** 26 * @file c3dmodel.h 27 * @brief define an internal structure to be used by the 3D renders 28 */ 29 30 31 #ifndef C3DMODEL_H 32 #define C3DMODEL_H 33 34 #include "plugins/3dapi/xv3d_types.h" 35 36 37 struct SMATERIAL 38 { 39 SFVEC3F m_Ambient; // 40 SFVEC3F m_Diffuse; ///< Default diffuse color if m_Color is NULL 41 SFVEC3F m_Emissive; // 42 SFVEC3F m_Specular; // 43 float m_Shininess; // 44 float m_Transparency; ///< 1.0 is completely transparent, 0.0 completely opaque 45 46 // !TODO: to be implemented 47 /*struct textures 48 { 49 wxString m_Ambient; // map_Ka 50 wxString m_Diffuse; // map_Kd 51 wxString m_Specular; // map_Ks 52 wxString m_Specular_highlight; // map_Ns 53 wxString m_Bump; // map_bump, bump 54 wxString m_Displacement; // disp 55 wxString m_Alpha; // map_d 56 };*/ 57 }; 58 59 60 /// Per-vertex normal/color/texcoors structure. 61 /// CONDITIONS: 62 /// m_Positions size == m_Normals size == m_Texcoords size == m_Color size 63 /// m_Texcoords can be NULL, textures will not be applied in that case 64 /// m_Color can be NULL, it will use the m_Diffuse color for every triangle 65 /// any m_FaceIdx must be an index of a the element lists 66 /// m_MaterialIdx must be an existent material index stored in the parent model 67 /// SCALES: 68 /// m_Positions units are in mm, example: 69 /// 0.1 unit == 0.1 mm 70 /// 1.0 unit == 1.0 mm 71 /// 10.0 unit == 10.0 mm 72 /// 73 /// To convert this units to pcbunits, use the conversion facto UNITS3D_TO_UNITSPCB 74 /// 75 /// m_Normals, m_Color and m_Texcoords are between 0.0f and 1.0f 76 struct SMESH 77 { 78 unsigned int m_VertexSize; ///< Number of vertex in the arrays 79 SFVEC3F *m_Positions; ///< Vertex position array 80 SFVEC3F *m_Normals; ///< Vertex normals array 81 SFVEC2F *m_Texcoords; ///< Vertex texture coordinates array, can be NULL 82 SFVEC3F *m_Color; ///< Vertex color array, can be NULL 83 unsigned int m_FaceIdxSize; ///< Number of elements of the m_FaceIdx array 84 unsigned int *m_FaceIdx; ///< Triangle Face Indexes 85 unsigned int m_MaterialIdx; ///< Material Index to be used in this mesh (must be < m_MaterialsSize ) 86 }; 87 88 89 /// Store the a model based on meshes and materials 90 struct S3DMODEL 91 { 92 unsigned int m_MeshesSize; ///< Number of meshes in the array 93 SMESH *m_Meshes; ///< The meshes list of this model 94 95 unsigned int m_MaterialsSize; ///< Number of materials in the material array 96 SMATERIAL *m_Materials; ///< The materials list of this model 97 }; 98 99 #endif // C3DMODEL_H 100