VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgShaderUtils.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
14 
16 
17 #include <boost/unordered_map.hpp>
18 
19 #include <osg/StateAttribute>
20 
21 // forward declarations
22 namespace osg
23 {
24  class State;
25  class StateSet;
26  class Texture;
27  class Node;
28  class Uniform;
29 }
30 
31 namespace makVrv
32 {
33  class DtOsgFileCache;
35  {
37  int location;
38  int modCount;
39  void * uniform;
40  };
41  typedef boost::unordered_map<unsigned int, CachedUniformData > UniformLocationMap;
42  typedef boost::unordered_map<int, UniformLocationMap> ShaderUniLocMap;
43 
45  {
46 
47  public:
52  static void bindAttributes(const osg::GLExtensions * ext, const osg::StateSet *ss, int shader, int contextID);
53 
59  static bool getVPShaderVector(osg::StateSet *ss, osg::State& state, unsigned int &shaderHash,
60  std::vector<unsigned int> &vertShaderVector, std::vector<unsigned int> &fragShaderVector, bool skip_shadow_shaders = false);
61 
63  static bool addDegenerateShadersIfNeeded(osg::StateSet *ss, osg::State& state,
64  std::vector<unsigned int> &vertShaderVector, std::vector<unsigned int> &fragShaderVector, bool skip_shadow_shaders = false);
65 
66  static void restoreEverything(osg::State& state);
67 
68  static void restoreOpenGLMode(osg::State& state, int stateToSet);
69  static void restoreOpenGLStateAttribute(osg::State& state, osg::StateAttribute::Type type);
70  static void restoreOpenGLProgram(osg::State& state);
71  static void restoreOpenGLFBO(osg::State& state);
72  static void markAllTextureAttributesDirty(osg::State & state);
73 
78  static void generateModelInstanceShaders(osg::Node *node, const std::string& shaderName);
79 
81  static unsigned getNumGPUTextureImageUnits();
82 
85  static void clearCachedProgramsAndUniformLocations(void);
86 
87  private:
88 
93  };
94 
95 
96 
97 }
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
boost::unordered_map< unsigned int, CachedUniformData > UniformLocationMap
Definition: DtOsgShaderUtils.h:41
Contains makVrv::DtVirtualBaseClass class.
void * uniform
Definition: DtOsgShaderUtils.h:39
boost::unordered_map< int, UniformLocationMap > ShaderUniLocMap
Definition: DtOsgShaderUtils.h:42
int location
Definition: DtOsgShaderUtils.h:37
Definition: DtOsgShaderUtils.h:44
static ShaderUniLocMap s_shaderUniLocMap
used to cache the shader uniform locations to avoid glGetUniformLocation calls Saves somewhere betwee...
Definition: DtOsgShaderUtils.h:92
Definition: DtOsgShaderUtils.h:34
int modCount
Definition: DtOsgShaderUtils.h:38
Contains DLL export macros.
CachedUniformData()
Definition: DtOsgShaderUtils.h:36

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)