summaryrefslogtreecommitdiff
path: root/cad/plugins/NanoVision-1/src/Plugins/RenderingEngines/OpenGL/GLT/glt_material.h
blob: c107d6f531d1e84b8b3e7f153f6f0d97c31d73c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#ifndef GLT_MATERIAL_H
#define GLT_MATERIAL_H

/*

  GLT OpenGL C++ Toolkit      
  Copyright (C) 2000-2002 Nigel Stewart
  Email: nigels@nigels.com   WWW: http://www.nigels.com/glt/
      
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library 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
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

/*! \file 
    \brief OpenGL Material Class
    \ingroup GLT
    
    $Id: material.h,v 1.13 2002/10/07 16:33:35 nigels Exp $
    
    $Log: material.h,v $
    Revision 1.13  2002/10/07 16:33:35  nigels
    Added CVS info

    
*/

#include "glt_gl.h"
#include "glt_color.h"

#include <iosfwd>

/*! \class GltMaterial
    \brief OpenGL Material Class
    \ingroup GLT

    OpenGL material settings object
*/

class GltMaterial
{
public:
	
	/// Constructor
	GltMaterial(const GLenum face = GL_FRONT_AND_BACK,const bool getIt = false);

	/// Full constructor
	GltMaterial
	(
		const GltColor &ambient,
		const GltColor &diffuse,
		const GltColor &specular,
		const GltColor &emission,
		const GLfloat   shininess,
		const GLenum face  = GL_FRONT_AND_BACK
	);

	/// Construct by name
	GltMaterial(const std::string &name,const GLenum face  = GL_FRONT_AND_BACK);

	/// Destructor
	~GltMaterial();

	//

								/// Get the current OpenGL material settings
	void get();
								/// Set the current OpenGL material settings
	void set() const;

	//

										// Front and/or back face
	GLenum   &face();
										// Ambient color
	GltColor &ambient();
										// Diffuse color
	GltColor &diffuse();
										// Specular color
	GltColor &specular();
										// Emissive color
	GltColor &emission();
										// Shininess coefficient
	GLfloat  &shininess();
										// Color Index
	GLint    *colorIndex();

										// Front and/or back face
	const GLenum   &face()       const;
										// Ambient color
	const GltColor &ambient()    const;
										// Diffuse color
	const GltColor &diffuse()    const;
										// Specular color
	const GltColor &specular()   const;
										// Emissive color
	const GltColor &emission()   const;
										// Shininess coefficient
	const GLfloat  &shininess()  const;
										// Color Index
	const GLint    *colorIndex() const;

private:

	GLenum  _face;

	GltColor _ambient;
	GltColor _diffuse;
	GltColor _specular;
	GltColor _emission;
	GLfloat _shininess;

	GLint   _colorIndex[4];

	//

	static const int          _matSize;
	static const char        *_matName [];
	static const GltMaterial *_matValue[];
};

//

extern const GltMaterial blackPlasticMaterial;
extern const GltMaterial blackRubberMaterial;
extern const GltMaterial brassMaterial;
extern const GltMaterial bronzeMaterial;
extern const GltMaterial chromeMaterial;
extern const GltMaterial copperMaterial;
extern const GltMaterial emeraldMaterial;
extern const GltMaterial goldMaterial;
extern const GltMaterial jadeMaterial;
extern const GltMaterial obsidianMaterial;
extern const GltMaterial pearlMaterial;
extern const GltMaterial pewterMaterial;
extern const GltMaterial polishedBronzeMaterial;
extern const GltMaterial polishedCopperMaterial;
extern const GltMaterial polishedGoldMaterial;
extern const GltMaterial polishedSilverMaterial;
extern const GltMaterial rubyMaterial;
extern const GltMaterial silverMaterial;
extern const GltMaterial turquoiseMaterial;
extern const GltMaterial whitePlasticMaterial;

#endif