VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtBindingManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
13 
14 #include <vrvOsg/vrvOsg.h>
15 
17 
18 #include <string>
19 #include <map>
20 #include <utility>
21 
22 typedef unsigned int GLuint;
23 typedef unsigned int GLenum;
24 typedef int GLint;
25 
26 namespace makVrv
27 {
28  class DtDe;
29 
44  {
45  protected:
46  // This type must appear before the use in public:, below.
47  // The pair is the DtBufferType, and the binding.
48  typedef std::map<std::string, std::pair<DtBufferType, GLuint> > BindingMap;
49 
50  public:
53 
55  static DtBindingManager& instance(DtDe&);
56 
57  // Well-known names of interfaces blocks. These match names in the shaders.
58  // This avoids multiple parts of the code having an independent idea of the
59  // block names. These can be used with binding() and setBinding().
60  static const char* osgMaterialUniformBlock;
61  static const char* osgAlphaThresholdBlock;
62  static const char* osgTransformStackBlock;
63  static const char* vrvPerChannelUniformBlock;
64  static const char* vrvLightGridBlock;
65  static const char* vrvLightDataBlock;
66  static const char* vrvTileLightIndexList;
67 
68  static const int theLightBlockBase = 6; // base binding for light UBO data
69  static const int theLightBlockCount = 6; // number of light UBOs
70 
71  typedef BindingMap::const_iterator const_iterator;
72 
75  const_iterator cbegin() const { return bindingMap.begin(); }
78  const_iterator cend() const { return bindingMap.end(); }
79 
81  virtual GLuint binding(const std::string& name) const;
83  virtual GLuint binding(const std::string& name, int index) const;
85  virtual GLuint binding(const_iterator it) const;
86 
88  virtual DtBufferType type(const_iterator it) const;
90  virtual GLenum glBlockType(const_iterator it) const;
91 
93  void setBinding(const std::string& name, DtBufferType bufferType,
94  GLuint binding);
96  void setBinding(const std::string& name, DtBufferType bufferType,
97  int index, GLuint binding);
98 
100  static std::string name(const std::string& name);
102  static std::string name(const std::string& name, int index);
104  virtual const std::string& name(const_iterator it) const;
105 
109  virtual void bindBlocks(GLuint programId) const;
110 
111  protected:
113  static std::string indexedName(const std::string& name, int index);
114 
116  void initializeBlockBindings();
117 
121  };
122 
123 } // namespace makVrv
Virtual base class.
Definition: DtVirtualBaseClass.h:22
const_iterator cend() const
Return constant_iterator to map end.
Definition: DtBindingManager.h:78
static const char * vrvTileLightIndexList
Definition: DtBindingManager.h:66
static const char * vrvLightGridBlock
Definition: DtBindingManager.h:64
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
BindingMap::const_iterator const_iterator
Definition: DtBindingManager.h:71
DtBufferType
An abstract buffer type (vertex buffer, index buffer, etc) Used, for example, to create DtGlBuffers o...
Definition: DtBufferType.h:15
int GLint
Definition: DtBindingManager.h:24
std::map< std::string, std::pair< DtBufferType, GLuint > > BindingMap
Definition: DtBindingManager.h:48
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
Manage interface block bindings.
Definition: DtBindingManager.h:43
Contains makVrv::DtVirtualBaseClass class.
BindingMap bindingMap
Map of binding names to bindings.
Definition: DtBindingManager.h:120
static const char * vrvPerChannelUniformBlock
Definition: DtBindingManager.h:63
Buffer Type enums.
unsigned int GLenum
Definition: DtGlTextureBufferObject.h:18
static const char * osgTransformStackBlock
Definition: DtBindingManager.h:62
const_iterator cbegin() const
Return constant_iterator to map begin.
Definition: DtBindingManager.h:75
Contains DLL export macros.
static const char * osgMaterialUniformBlock
Definition: DtBindingManager.h:60
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
static const char * osgAlphaThresholdBlock
Definition: DtBindingManager.h:61
static const char * vrvLightDataBlock
Definition: DtBindingManager.h:65

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)