H3D API  2.4.1
ShaderImageNode.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 __SHADERIMAGENode_H__
30 #define __SHADERIMAGENode_H__
31 
33 
34 namespace H3D {
35 
43  class H3DAPI_API ShaderImageNode :
44  public H3DSingleTextureNode {
45  public:
46 
48  ShaderImageNode( Inst< DisplayList > _displayList = 0,
49  Inst< SFNode> _metadata = 0 );
50 
53  virtual void preRender( ){};
54 
57  virtual void postRender(){};
58 
60  virtual void enableTexturing(){};
62  virtual void disableTexturing(){};
63 
64  virtual unsigned int getImageUnit ( ){
65  return image_unit;
66  }
67  virtual void setImageUnit ( unsigned int _image_unit ){
68  image_unit = _image_unit;
69  }
70 
71  virtual ~ShaderImageNode ( );
72  protected:
73 
80  GLuint image_unit;
81 
82 
83  // collection of all the current image units already used,
84  //it is be used to help generate non-identical image unit id
85  static set<unsigned int> global_image_units;
86  // lock to ensure the access to global_image_units is always safe
87  static H3DUtil::MutexLock global_image_units_lock;
88  static unsigned int max_image_unit;
89 
91  H3DUniquePtr< Field > reinitShaderImage;
92  };
93 }
94 
95 #endif
Header file for H3DSingleTextureNode, X3D scene-graph node.
This abstract node type is the base type for all texture nodes that is defined by a single texture.
Definition: H3DSingleTextureNode.h:45
This is the base node type for the child nodes of the ComposedShader node which is image node type,...
Definition: ShaderImageNode.h:44
virtual void postRender()
override postRender function to do nothing as it is not needed for shader image node
Definition: ShaderImageNode.h:57
GLuint image_unit
image unit used, will be used to bind to shader program the value of image_unit will be maintained in...
Definition: ShaderImageNode.h:80
virtual void disableTexturing()
disableTexturing is not needed for shader image node
Definition: ShaderImageNode.h:62
virtual void preRender()
override preRender function to do nothing as it is not needed for shader image node
Definition: ShaderImageNode.h:53
H3DUniquePtr< Field > reinitShaderImage
flag field to help check if shader image need to be re-initialized
Definition: ShaderImageNode.h:91
virtual void enableTexturing()
enableTexturing is not needed for shader image node
Definition: ShaderImageNode.h:60
H3D API namespace.
Definition: Anchor.h:38