VR-Forces 5.0.1 Developer's Guide
 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) 2020 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  public:
47  static DtBindingManager& instance(DtDe&);
48  protected:
51 
53  virtual ~DtBindingManager();
54  private:
58  DtBindingManager& operator=(const DtBindingManager& rhs);
59  public:
60 
62  virtual GLuint binding(const std::string& name) const;
63 
65  virtual GLuint binding(const std::string& name, int index) const;
66 
70  virtual void bindBlocks(GLuint programId) const;
71 
73  virtual std::string name(const std::string& name) const;
74 
76  virtual std::string name(const std::string& name, int index) const;
77 
78  public:
79  static const int theLightBlockBase = 6; // base binding for light UBO data
80  static const int theLightBlockCount = 5; // number of light UBOs
81 
82  // Well-known names of interfaces blocks. These match names in the shaders.
83  // This avoids multiple parts of the code having an independent idea of the
84  // block names. These can be used with binding() and setBinding().
85  static const char* osgMaterialUniformBlock;
86  static const char* osgAlphaThresholdBlock;
87  static const char* osgTransformStackBlock;
88  static const char* vrvPerChannelUniformBlock;
89  static const char* vrvLightDataBlock;
90  static const char* vrvTileLightIndexList;
91 
92  protected:
94  virtual std::string indexedName(const std::string& name, int index) const;
95 
97  virtual void initializeBlockBindings();
98 
100  virtual void setBinding(const std::string& name, DtBufferType bufferType,
101  GLuint binding);
102 
104  virtual void setBinding(const std::string& name, DtBufferType bufferType,
105  int index, GLuint binding);
106 
107  protected:
110  // This type must appear before the use in public:, below.
111  // The pair is the DtBufferType, and the binding.
112  typedef std::map<std::string, std::pair<DtBufferType, GLuint> > BindingMap;
114  };
115 
116 } // namespace makVrv
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
static const char * vrvTileLightIndexList
Definition: DtBindingManager.h:90
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
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
Map of binding names to bindings.
Definition: DtBindingManager.h:112
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
Manage interface block bindings. This knowledge was previously distributed several places in the code...
Definition: DtBindingManager.h:43
Contains makVrv::DtVirtualBaseClass class.
BindingMap bindingMap
Definition: DtBindingManager.h:113
static const char * vrvPerChannelUniformBlock
Definition: DtBindingManager.h:88
Buffer Type enums.
unsigned int GLenum
Definition: DtGlTextureBufferObject.h:18
static const char * osgTransformStackBlock
Definition: DtBindingManager.h:87
Contains DLL export macros.
static const char * osgMaterialUniformBlock
Definition: DtBindingManager.h:85
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
static const char * osgAlphaThresholdBlock
Definition: DtBindingManager.h:86
static const char * vrvLightDataBlock
Definition: DtBindingManager.h:89

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)