Visualization Library 2.0.0-b3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
UniformSet.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2017, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef UniformSet_INCLUDE_ONCE
33 #define UniformSet_INCLUDE_ONCE
34 
36 #include <vlCore/Object.hpp>
37 #include <vlGraphics/Uniform.hpp>
38 
39 namespace vl
40 {
41  //------------------------------------------------------------------------------
42  // UniformSet
43  //------------------------------------------------------------------------------
51  {
53 
54  public:
56  {
57  VL_DEBUG_SET_OBJECT_NAME()
58  }
59 
60  UniformSet& deepCopyFrom(const UniformSet& other);
61 
62  UniformSet& shallowCopyFrom(const UniformSet& other) { *this = other; return *this; }
63 
64  // uniform getters and setters
65 
66  void setUniform(Uniform* uniform, bool check_for_doubles = true);
67 
68  const std::vector< ref<Uniform> >& uniforms() const { return mUniforms; }
69 
70  std::vector< ref<Uniform> >& uniforms() { return mUniforms; }
71 
72  void eraseUniform(const char* name);
73 
74  void eraseUniform(const Uniform* uniform);
75 
76  void eraseAllUniforms() { mUniforms.clear(); }
77 
78  Uniform* gocUniform(const char* name);
79 
80  Uniform* getUniform(const char* name);
81 
82  const Uniform* getUniform(const char* name) const;
83 
84  protected:
85  std::vector< ref<Uniform> > mUniforms;
86  };
87 }
88 
89 #endif
Wraps an OpenGL Shading Language uniform to be associated to a GLSLProgram (see vl::GLSLProgram docum...
Definition: Uniform.hpp:59
UniformSet & shallowCopyFrom(const UniformSet &other)
Definition: UniformSet.hpp:62
void eraseAllUniforms()
Definition: UniformSet.hpp:76
const std::vector< ref< Uniform > > & uniforms() const
Definition: UniformSet.hpp:68
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
Visualization Library main namespace.
std::vector< ref< Uniform > > mUniforms
Definition: UniformSet.hpp:85
std::vector< ref< Uniform > > & uniforms()
Definition: UniformSet.hpp:70
The base class for all the reference counted objects.
Definition: Object.hpp:158
A set of Uniform objects managed by a Shader.
Definition: UniformSet.hpp:50