VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtOsgShaderUtils.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 #include <boost/unordered_map.hpp>
14 #include <string>
15 #include <vector>
16 
17 // forward declarations
18 namespace osg
19 {
20  class State;
21  class StateSet;
22  class Texture;
23  class Node;
24  class Uniform;
25 }
26 
27 namespace makVrv
28 {
30 
31  typedef boost::unordered_map<void *, int> UniformLocationMap;
32  typedef boost::unordered_map<int, UniformLocationMap> ShaderUniLocMap;
33 
34 
36  {
37 
38 
39  public:
41  static std::string loadShaderSource(const std::string& strFileName);
42 
44  static void saveShaderSource(const std::string& strFileName, const std::string& strSource);
45 
47  static unsigned getNumGPUTextureImageUnits();
48 
50  // hashPtr is just a pointer to use for the location hash. it should be unique for each uniform set this way
51  // for an example look at how DtSpeedTreeForest uses this
52  static void bindSingleAttribute(int shader, std::string uniName, bool value, void *hashPtr);
53 
57  static void bindAttributes(osg::Node *node, int shader, int contextID);
58 
64  static bool getVPShaderVector(osg::StateSet *ss, osg::State& state, unsigned int &shaderHash, std::vector<unsigned int> &vertShaderVector, std::vector<unsigned int> &fragShaderVector);
65 
66 
68  static void deleteShaders(std::vector<unsigned int> shaderVector);
69 
73  static bool compileShader(const char* source, unsigned int shaderType, unsigned int &shaderID);
74 
75  private:
76 
81  };
82 
83 }

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)