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.

83 lines
2.6 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2014-2015 Mario Luzeiro <mrluzeiro@gmail.com>
  5. * Copyright (C) 1992-2014 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 3d_material.h
  26. */
  27. #ifndef STRUCT_3D_MATERIAL_H
  28. #define STRUCT_3D_MATERIAL_H
  29. #include <common.h>
  30. #include <base_struct.h>
  31. #define GLM_FORCE_RADIANS
  32. #include <glm/glm.hpp>
  33. class S3D_MASTER;
  34. class S3D_MATERIAL : public EDA_ITEM // openGL "material" data
  35. {
  36. public:
  37. wxString m_Name;
  38. // Material list
  39. std::vector< glm::vec3 > m_AmbientColor;
  40. std::vector< glm::vec3 > m_DiffuseColor;
  41. std::vector< glm::vec3 > m_EmissiveColor;
  42. std::vector< glm::vec3 > m_SpecularColor;
  43. std::vector< float > m_Shininess;
  44. std::vector< float > m_Transparency;
  45. bool m_ColorPerVertex;
  46. public:
  47. S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
  48. S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
  49. S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; }
  50. /**
  51. * Initialize the material prms.
  52. * @param aMaterialIndex = the index in list of available materials
  53. * @param aUseMaterial = true to use the values found in the available material
  54. * = false to use only the color, and other prms are fixed
  55. * @return true if the material is transparency
  56. */
  57. bool SetOpenGLMaterial(unsigned int aMaterialIndex, bool aUseMaterial);
  58. #if defined(DEBUG)
  59. void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
  60. #endif
  61. /** Get class name
  62. * @return string "S3D_MATERIAL"
  63. */
  64. virtual wxString GetClass() const
  65. {
  66. return wxT( "S3D_MATERIAL" );
  67. }
  68. };
  69. void SetOpenGlDefaultMaterial();
  70. #endif