H3D API  2.4.1
Material.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __MATERIAL_H__
30 #define __MATERIAL_H__
31 
32 #include <H3D/X3DMaterialNode.h>
33 #include <H3D/SFFloat.h>
34 #include <H3D/SFColor.h>
35 
36 namespace H3D {
37 
79  class H3DAPI_API Material : public X3DMaterialNode {
80  public:
81 
83  Material( Inst< DisplayList > _displayList = 0,
84  Inst< SFFloat > _ambientIntensity = 0,
85  Inst< SFColor > _diffuseColor = 0,
86  Inst< SFColor > _emissiveColor = 0,
87  Inst< SFNode > _metadata = 0,
88  Inst< SFFloat > _shininess = 0,
89  Inst< SFColor > _specularColor = 0,
90  Inst< SFFloat > _transparency = 0 );
91 
93  virtual void render();
94 
98  virtual GLbitfield getAffectedGLAttribs() {
99  return GL_COLOR_BUFFER_BIT | GL_LIGHTING_BIT;
100  }
101 
104  virtual bool isTransparent() {
105  return transparency->getValue() > 0;
106  }
107 
119  H3DUniquePtr< SFFloat > ambientIntensity;
120 
130  H3DUniquePtr< SFColor > diffuseColor;
131 
141  H3DUniquePtr< SFColor > emissiveColor;
142 
152  H3DUniquePtr< SFFloat > shininess;
153 
161  H3DUniquePtr< SFColor > specularColor;
162 
171  H3DUniquePtr< SFFloat > transparency;
172 
175  };
176 }
177 
178 #endif
Contains the SFColor field class.
Contains the SFFloat field class.
Header file for X3DMaterialNode, X3D scene-graph node.
The Material node specifies surface material properties for associated geometry nodes and is used by ...
Definition: Material.h:79
H3DUniquePtr< SFFloat > ambientIntensity
The ambientIntensity field specifies how much ambient light from light sources this surface shall ref...
Definition: Material.h:119
virtual GLbitfield getAffectedGLAttribs()
Returns a bitmask of the OpenGL attrib bits that will be affected by this node.
Definition: Material.h:98
H3DUniquePtr< SFFloat > shininess
Shininess effect the specular highlights.
Definition: Material.h:152
H3DUniquePtr< SFFloat > transparency
The transparency field specifies how "clear" an object is, with 1.0 being completely transparent,...
Definition: Material.h:171
H3DUniquePtr< SFColor > diffuseColor
The diffuseColor field reflects all light sources depending on the angle of the surface with respect ...
Definition: Material.h:130
H3DUniquePtr< SFColor > specularColor
The color of the specular highlights.
Definition: Material.h:161
virtual bool isTransparent()
This function checks the transparency field to determine if the material requires that the geometry i...
Definition: Material.h:104
H3DUniquePtr< SFColor > emissiveColor
The emissiveColor field models "glowing" objects.
Definition: Material.h:141
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: Material.h:174
This is the base node type for all Material nodes.
Definition: X3DMaterialNode.h:41
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194