Carna  Version 3.0.1
ShaderManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef SHADERMANAGER_H_6014714286
13 #define SHADERMANAGER_H_6014714286
14 
19 #include <Carna/Carna.h>
20 #include <Carna/base/Singleton.h>
21 #include <Carna/base/noncopyable.h>
22 #include <string>
23 
24 namespace Carna
25 {
26 
27 namespace base
28 {
29 
30 
31 
32 // ----------------------------------------------------------------------------------
33 // ShaderManager
34 // ----------------------------------------------------------------------------------
35 
43 class CARNA_LIB ShaderManager : public Singleton< ShaderManager >
44 {
45 
47 
48  struct Details;
49  const std::unique_ptr< Details > pimpl;
50 
51 protected:
52 
53  friend class Singleton< ShaderManager >;
54 
58  ShaderManager();
59 
60 public:
61 
69  virtual ~ShaderManager();
70 
80  const ShaderProgram& acquireShader( const std::string& shaderName );
81 
87  void releaseShader( const ShaderProgram& shader );
88 
95  void setSource( const std::string& srcName, const std::string& src );
96 
100  void removeSource( const std::string& srcName );
101 
102 }; // ShaderManager
103 
104 
105 
106 } // namespace Carna :: base
107 
108 } // namespace Carna
109 
110 #endif // SHADERMANAGER_H_6014714286
Singleton base class
Definition: Singleton.h:59
Maintains an OpenGL shader program. Realizes the RAII-idiom.
Definition: ShaderProgram.h:47
Defines Carna::base::Singleton.
Ensures that each shader is built just once and not each time someone requests it.
Definition: ShaderManager.h:43
#define NON_COPYABLE
Features class it is placed in as non-copyable.
Definition: noncopyable.h:109