H3D API  2.4.1
ShaderAtomicCounter.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 __SHADERATOMICCOUNTER_H__
30 #define __SHADERATOMICCOUNTER_H__
31 
32 #include <H3D/ShaderChildNode.h>
33 #include <H3D/SFInt32.h>
34 #include <H3D/SFString.h>
35 
36 namespace H3D {
37 
50  class H3DAPI_API ShaderAtomicCounter :
51  public ShaderChildNode {
52  public:
53 
55  ShaderAtomicCounter( Inst< DisplayList > _displayList = 0,
56  Inst< SFNode > _metadata = 0,
57  Inst< SFInt32 > _initialValue = 0
58  );
59 
61  H3DUniquePtr<SFInt32> initialValue;
62 
64  virtual void preRender( unsigned int program );
65 
66  virtual void postRender();
67 
69  virtual void render ( );
70 
71  virtual void prepareAtomicCounterBuffer ();
72 
73  virtual void initialize ( );
74 
75  virtual ~ShaderAtomicCounter ( );
76 
78  virtual void traverseSG( TraverseInfo &ti );
79 
82 
83  protected:
84 
88  void applyInitialValue();
89 
91  unsigned int program_handle;
92 
94  int buffer_id;
95 
101 
104  };
105 }
106 
107 #endif
Contains the SFInt32 field class.
Contains the SFString field class.
Header file for ShaderChildNode.
A ShaderAtomicCounter is a atomic counter can be used in GLSL shader.
Definition: ShaderAtomicCounter.h:51
unsigned int atomic_counter_binding
the atomic counter binding point for atomic counter buffer will be used by the shader to access the d...
Definition: ShaderAtomicCounter.h:100
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: ShaderAtomicCounter.h:81
H3DUniquePtr< SFInt32 > initialValue
initial value for the atomic counter
Definition: ShaderAtomicCounter.h:61
int buffer_id
buffer id, generated by openGL
Definition: ShaderAtomicCounter.h:94
unsigned int program_handle
shader program that this shader storage buffer will be attached
Definition: ShaderAtomicCounter.h:91
bool do_init_value
A flag to indicate that the counter should be reset.
Definition: ShaderAtomicCounter.h:103
This is the base node type for the child nodes of the ComposedShader node.
Definition: ShaderChildNode.h:44
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.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