OsgUniform.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_OSGUNIFORM_H
17 #define SURGSIM_GRAPHICS_OSGUNIFORM_H
18 
21 
22 namespace SurgSim
23 {
24 
25 namespace Graphics
26 {
27 
30 template <class T>
31 class OsgUniform : public Uniform<T>, public OsgUniformBase
32 {
33 public:
36  explicit OsgUniform(const std::string& name);
37 
39  virtual void set(const T& value);
40 
42  virtual const T& get() const;
43 
44 private:
47 };
48 
51 template <class T>
52 class OsgUniform<std::vector<T>> : public Uniform<std::vector<T>>, public OsgUniformBase
53 {
54 public:
58  OsgUniform(const std::string& name, size_t numElements);
59 
61  virtual size_t getNumElements() const;
62 
66  virtual void setElement(size_t index, const T& value);
67 
70  virtual void set(const std::vector<T>& value);
71 
75  virtual typename std::vector<T>::const_reference getElement(size_t index) const;
76 
79  virtual const std::vector<T>& get() const;
80 
81 private:
83  std::vector<T> m_value;
84 };
85 
86 }; // namespace Graphics
87 
88 }; // namespace SurgSim
89 
91 
98 
99 #endif // SURGSIM_GRAPHICS_OSGUNIFORM_H
Definition: DriveElementFromInputBehavior.cpp:27
T m_value
Value of the uniform.
Definition: OsgUniform.h:46
STL namespace.
OSG implementation of graphics uniform with a value of type T.
Definition: OsgCamera.h:46
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
Base OSG implementation of graphics uniforms.
Definition: OsgUniformBase.h:36
Base class for a graphics uniform with a value of type T.
Definition: Uniform.h:32
OsgUniform(const std::string &name)
Constructor.
Definition: OsgUniform-inl.h:41
std::vector< T > m_value
Vector containing the values of the uniform&#39;s elements.
Definition: OsgUniform.h:83