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  {
110  }
111 
117  virtual void setGlobalScope(bool val) = 0;
118 
121  virtual bool isGlobalScope() const = 0;
122 
123 };
124 
126 {
127 }
128 
129 }; // namespace Graphics
130 
131 }; // namespace SurgSim
132 
133 #endif // SURGSIM_GRAPHICS_PROGRAM_H
SurgSim::Graphics::Program::loadFragmentShader
virtual bool loadFragmentShader(const std::string &filePath)=0
Loads the fragment shader source code from a file.
SurgSim::Graphics::Program::clearFragmentShader
virtual void clearFragmentShader()=0
SurgSim::Graphics::Program::setFragmentShaderSource
virtual void setFragmentShaderSource(const std::string &source)=0
Set the fragment shader source code.
SurgSim::Graphics::Program::loadVertexShader
virtual bool loadVertexShader(const std::string &filePath)=0
Loads the vertex shader source code from a file.
SurgSim::Graphics::Program::getFragmentShaderSource
virtual bool getFragmentShaderSource(std::string *source) const =0
Gets the fragment shader source code.
SurgSim::Graphics::Program::setGlobalScope
virtual void setGlobalScope(bool val)=0
When this is set to true, this shader should be used instead of other shaders that might apply,...
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Graphics::Program::hasGeometryShader
virtual bool hasGeometryShader() const =0
SurgSim::Graphics::Program
Base class that defines the interface for graphics programs.
Definition: Program.h:39
SurgSim::Graphics::Program::hasFragmentShader
virtual bool hasFragmentShader() const =0
SurgSim::Graphics::Program::setVertexShaderSource
virtual void setVertexShaderSource(const std::string &source)=0
Set the vertex shader source code.
SurgSim::Graphics::Program::loadGeometryShader
virtual bool loadGeometryShader(const std::string &filePath)=0
Loads the geometry shader source code from a file.
SurgSim::Graphics::Program::clearGeometryShader
virtual void clearGeometryShader()=0
Removes the geometry shader, returning that portion of the shader program to fixed-function.
SurgSim::Graphics::Program::hasVertexShader
virtual bool hasVertexShader() const =0
Accessible.h
SurgSim::Graphics::Program::getVertexShaderSource
virtual bool getVertexShaderSource(std::string *source) const =0
Gets the vertex shader source code.
SurgSim::Graphics::Program::~Program
virtual ~Program()=0
Destructor.
Definition: Program.h:125
SurgSim::Graphics::Program::isGlobalScope
virtual bool isGlobalScope() const =0
Query if this shader is of global scope.
SurgSim::Graphics::Program::setGeometryShaderSource
virtual void setGeometryShaderSource(const std::string &source)=0
Set the geometry shader source code.
SurgSim::Graphics::Program::clear
virtual void clear()
Clears the entire shader, returning to fixed-function pipeline.
Definition: Program.h:105
SurgSim::Graphics::Program::getGeometryShaderSource
virtual bool getGeometryShaderSource(std::string *source) const =0
Gets the geometry shader source code.
SurgSim::Graphics::Program::clearVertexShader
virtual void clearVertexShader()=0
Removes the vertex shader, returning that portion of the shader program to fixed-function.