Program.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_PROGRAM_H
17 #define SURGSIM_GRAPHICS_PROGRAM_H
18 
19 #include <string>
21 
22 namespace SurgSim
23 {
24 
25 namespace Framework
26 {
27 class Asset;
28 }
29 
30 namespace Graphics
31 {
32 
39 class Program
40 {
41 public:
42 
44  virtual ~Program() = 0;
45 
47  virtual bool hasVertexShader() const = 0;
48 
50  virtual void clearVertexShader() = 0;
51 
55  virtual bool loadVertexShader(const std::string& filePath) = 0;
56 
59  virtual void setVertexShaderSource(const std::string& source) = 0;
60 
63  virtual bool getVertexShaderSource(std::string* source) const = 0;
64 
66  virtual bool hasGeometryShader() const = 0;
67 
69  virtual void clearGeometryShader() = 0;
70 
74  virtual bool loadGeometryShader(const std::string& filePath) = 0;
75 
78  virtual void setGeometryShaderSource(const std::string& source) = 0;
79 
82  virtual bool getGeometryShaderSource(std::string* source) const = 0;
83 
84 
86  virtual bool hasFragmentShader() const = 0;
87 
89  virtual void clearFragmentShader() = 0;
90 
94  virtual bool loadFragmentShader(const std::string& filePath) = 0;
95 
98  virtual void setFragmentShaderSource(const std::string& source) = 0;
99 
102  virtual bool getFragmentShaderSource(std::string* source) const = 0;
103 
105  virtual void clear()
106  {
107  clearVertexShader();
108  clearGeometryShader();
109  clearFragmentShader();
110  }
111 
117  virtual void setGlobalScope(bool val) = 0;
118 
121  virtual bool isGlobalScope() const = 0;
122 
123 };
124 
125 inline Program::~Program()
126 {
127 }
128 
129 }; // namespace Graphics
130 
131 }; // namespace SurgSim
132 
133 #endif // SURGSIM_GRAPHICS_PROGRAM_H
Definition: CompoundShapeToGraphics.cpp:29
virtual void clear()
Clears the entire shader, returning to fixed-function pipeline.
Definition: Program.h:105
Base class that defines the interface for graphics programs.
Definition: Program.h:39