gramods
CoordinatesMapper.hh
1 
2 #ifndef GRAMODS_GRAPHICS_COORDINATESMAPPER
3 #define GRAMODS_GRAPHICS_COORDINATESMAPPER
4 
5 #include <gmCore/Object.hh>
6 #include <gmCore/OFactory.hh>
7 
8 #include <gmGraphics/Camera.hh>
9 
10 #include <GL/glew.h>
11 #include <GL/gl.h>
12 
13 BEGIN_NAMESPACE_GMGRAPHICS;
14 
23  : public gmCore::Object {
24 
25 public:
26 
28  virtual ~CoordinatesMapper();
29 
34  virtual std::string getCommonCode() { return ""; }
35 
49  virtual std::string getTo2DCode() {
51  "caller wants mapTo2D but this is not imlemented");
52  }
53 
67  virtual std::string getTo3DCode() {
69  "caller wants mapTo3D but this is not imlemented");
70  }
71 
76  virtual void setCommonUniforms(GLuint program) {}
77 
82  virtual void setTo2DUniforms(GLuint program) {}
83 
88  virtual void setTo3DUniforms(GLuint program) {}
89 
94  virtual std::string getDefaultKey() override { return "coordinatesMapper"; }
95 
96 protected:
97  const std::string withVarId(std::string) const;
98  const std::string var_id;
99 };
100 
101 END_NAMESPACE_GMGRAPHICS;
102 
103 #endif
Base type for objects in the Gramods package for standardized handling of construction,...
Definition: Object.hh:42
A CoordinatesMapper provides a mapping between 2D and 3D.
Definition: CoordinatesMapper.hh:23
virtual void setTo2DUniforms(GLuint program)
Called by the code that is using this CoordinatesMapper object, to let it set the uniforms used by th...
Definition: CoordinatesMapper.hh:82
virtual std::string getCommonCode()
Returns shader "common" code, lines of code that are needed once regardless if 2D or 3D mapping code ...
Definition: CoordinatesMapper.hh:34
virtual std::string getTo2DCode()
Returns shader code that implements the 3D to 2D mapping for the specific coordinates mapper.
Definition: CoordinatesMapper.hh:49
virtual std::string getTo3DCode()
Returns shader code that implements the 2D to 3D mapping for the specific coordinates mapper.
Definition: CoordinatesMapper.hh:67
virtual std::string getDefaultKey() override
Returns the default key, in Configuration, for the Object.
Definition: CoordinatesMapper.hh:94
virtual void setCommonUniforms(GLuint program)
Called by the code that is using this CoordinatesMapper object, to let it set the uniforms used by th...
Definition: CoordinatesMapper.hh:76
virtual void setTo3DUniforms(GLuint program)
Called by the code that is using this CoordinatesMapper object, to let it set the uniforms used by th...
Definition: CoordinatesMapper.hh:88
Standard exception for runtime problems and base type for more detailed problems.
Definition: RuntimeException.hh:15