VR-Forces 4.3 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 <string>
14 #include <vector>
15 #include <map>
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 std::map<void *, int> UniformLocationMap;
32  typedef std::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 
54 
58  static void bindAttributes(osg::Node *node, int shader, int contextID);
59 
65  static bool getVPShaderVector(osg::StateSet *ss, const osg::State& state, unsigned int &shaderHash, std::vector<unsigned int> &vertShaderVector, std::vector<unsigned int> &fragShaderVector);
66 
67 
69  static void deleteShaders(std::vector<unsigned int> shaderVector);
70 
74  static bool compileShader(const char* source, unsigned int shaderType, unsigned int &shaderID);
75 
76  private:
77 
82  };
83 
84 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)