2014-07-30 09:01:25 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-03-28 11:33:56 +00:00
|
|
|
* Copyright (C) 2014-2015 Mario Luzeiro <mrluzeiro@gmail.com>
|
2014-07-30 09:01:25 +00:00
|
|
|
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file 3d_material.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef STRUCT_3D_MATERIAL_H
|
|
|
|
#define STRUCT_3D_MATERIAL_H
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <base_struct.h>
|
2015-03-29 10:59:53 +00:00
|
|
|
#define GLM_FORCE_RADIANS
|
2015-12-08 07:31:57 +00:00
|
|
|
#include <glm/glm.hpp>
|
2014-07-30 09:01:25 +00:00
|
|
|
|
|
|
|
class S3D_MASTER;
|
|
|
|
|
2014-08-09 18:18:04 +00:00
|
|
|
class S3D_MATERIAL : public EDA_ITEM // openGL "material" data
|
2014-07-30 09:01:25 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxString m_Name;
|
2014-08-09 18:18:04 +00:00
|
|
|
|
2014-07-30 09:01:25 +00:00
|
|
|
// Material list
|
|
|
|
std::vector< glm::vec3 > m_AmbientColor;
|
|
|
|
std::vector< glm::vec3 > m_DiffuseColor;
|
|
|
|
std::vector< glm::vec3 > m_EmissiveColor;
|
|
|
|
std::vector< glm::vec3 > m_SpecularColor;
|
2015-03-28 11:33:56 +00:00
|
|
|
std::vector< float > m_Shininess;
|
|
|
|
std::vector< float > m_Transparency;
|
2015-04-16 07:43:27 +00:00
|
|
|
bool m_ColorPerVertex;
|
2014-07-30 09:01:25 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
|
|
|
|
|
|
|
|
S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
|
|
|
|
S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; }
|
|
|
|
|
2014-08-21 11:59:57 +00:00
|
|
|
/**
|
|
|
|
* Initialize the material prms.
|
|
|
|
* @param aMaterialIndex = the index in list of available materials
|
|
|
|
* @param aUseMaterial = true to use the values found in the available material
|
|
|
|
* = false to use only the color, and other prms are fixed
|
2015-03-13 19:27:25 +00:00
|
|
|
* @return true if the material is transparency
|
2014-08-21 11:59:57 +00:00
|
|
|
*/
|
2015-03-13 19:27:25 +00:00
|
|
|
bool SetOpenGLMaterial(unsigned int aMaterialIndex, bool aUseMaterial);
|
2014-07-30 09:01:25 +00:00
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
|
|
|
#endif
|
2015-03-06 08:58:32 +00:00
|
|
|
|
|
|
|
/** Get class name
|
|
|
|
* @return string "S3D_MATERIAL"
|
|
|
|
*/
|
|
|
|
virtual wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "S3D_MATERIAL" );
|
|
|
|
}
|
2014-07-30 09:01:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void SetOpenGlDefaultMaterial();
|
|
|
|
|
|
|
|
#endif
|