H3D API  2.4.1
EnvironmentMapShader.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 __ENVIRONMENTMAPSHADER_H__
30 #define __ENVIRONMENTMAPSHADER_H__
31 
33 #include <H3D/X3DTexture2DNode.h>
35 #include <H3D/SFMatrix4f.h>
36 
37 namespace H3D {
38 
76  public:
77 
84  true >
86 
88  EnvironmentMapShader( Inst< DisplayList > _displayList = 0,
89  Inst< SFNode > _metadata = 0,
90  Inst< SFBool > _isSelected = 0,
91  Inst< SFBool > _isValid = 0,
92  Inst< SFBool > _activate = 0,
93  Inst< SFString > _language = 0,
94  Inst< MFShaderPart > _parts = 0,
95  Inst< SFBool > _suppressUniformWarnings = 0,
96  Inst< MFString > _fragmentShaderString = 0,
97  Inst< MFString > _vertexShaderString = 0,
98  Inst< SFEnvironmentTextureNode > _environmentMap = 0,
99  Inst< SFFloat > _fresnel = 0,
100  Inst< SFString > _type = 0 );
101 
108  H3DUniquePtr< SFEnvironmentTextureNode > environmentMap;
109 
124  H3DUniquePtr< SFFloat > fresnel;
125 
142  H3DUniquePtr< SFString > type;
143 
146 
147  protected:
152  virtual string addUniformFields( ComposedShader *shader );
153 
155  virtual void getVaryingVariables( vector< VaryingVariable > &variables );
156 
158  virtual string getFragmentShaderString();
159 
160  };
161 }
162 
163 #endif
Header file for H3DGeneratedFragmentShaderNode.
Contains the SFMatrix4f field class.
Header file for X3DEnvironmentTextureNode, X3D abstract scene-graph node.
Header file for X3DTexture2DNode, X3D scene-graph node.
The ComposedShader node defines a shader where the individual source files are not individually progr...
Definition: ComposedShader.h:77
DependentSFNode are modified TypedSFNode fields where the field dirty status is dependent on fields i...
Definition: DependentNodeFields.h:294
The EnvironmentMapShader node defines a shader for environment mapping of shiny objects.
Definition: EnvironmentMapShader.h:75
virtual string addUniformFields(ComposedShader *shader)
Adds uniform fields to the shader.
Definition: EnvironmentMapShader.cpp:142
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: EnvironmentMapShader.h:145
virtual void getVaryingVariables(vector< VaryingVariable > &variables)
Get the varying variables used by the shader generator.
Definition: EnvironmentMapShader.cpp:87
EnvironmentMapShader(Inst< DisplayList > _displayList=0, Inst< SFNode > _metadata=0, Inst< SFBool > _isSelected=0, Inst< SFBool > _isValid=0, Inst< SFBool > _activate=0, Inst< SFString > _language=0, Inst< MFShaderPart > _parts=0, Inst< SFBool > _suppressUniformWarnings=0, Inst< MFString > _fragmentShaderString=0, Inst< MFString > _vertexShaderString=0, Inst< SFEnvironmentTextureNode > _environmentMap=0, Inst< SFFloat > _fresnel=0, Inst< SFString > _type=0)
Constructor.
Definition: EnvironmentMapShader.cpp:49
H3DUniquePtr< SFEnvironmentTextureNode > environmentMap
Contains the X3DEnvironmentTextureNode to use for environment mapping.
Definition: EnvironmentMapShader.h:108
virtual string getFragmentShaderString()
Returns the shader code for the fragment shader.
Definition: EnvironmentMapShader.cpp:104
H3DUniquePtr< SFFloat > fresnel
The fresnel field specifies if the fresnel effect should be used in the reflection model and if so ho...
Definition: EnvironmentMapShader.h:124
H3DUniquePtr< SFString > type
The type field determines how to lookup into the environment map.
Definition: EnvironmentMapShader.h:142
DependentSFNode< X3DEnvironmentTextureNode, FieldRef< H3DDisplayListObject, H3DDisplayListObject::DisplayList, &H3DDisplayListObject::displayList >, true > SFEnvironmentTextureNode
The SFEnvironmentTextureNode field is dependent on the displayList field of the containing X3DEnviron...
Definition: EnvironmentMapShader.h:85
Class used for specifying a field member of a node in a DependentSFNode or DependentMFNode specificat...
Definition: DependentNodeFields.h:48
We use the Field's lazy evaluation mechanisms to manage the GL display lists for rendering,...
Definition: H3DDisplayListObject.h:60
H3DUniquePtr< DisplayList > displayList
The DisplayList instance handling the OpenGL caching of this object.
Definition: H3DDisplayListObject.h:256
H3DDisplayListObject(Inst< DisplayList > _displayList=0)
Constructor.
Definition: H3DDisplayListObject.cpp:70
The H3DGeneratedFragmentShaderNode node is the base class for shader generator nodes that specify a f...
Definition: H3DGeneratedFragmentShaderNode.h:44
This abstract node type is the base type for all node types that specify cubic environment map source...
Definition: X3DEnvironmentTextureNode.h:57
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