Visualization Library 2.1.0

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

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Clear.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, 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 Clear_INCLUDE_ONCE
33 #define Clear_INCLUDE_ONCE
34 
36 #include <vlCore/Vector4.hpp>
38 
39 namespace vl
40 {
41  //------------------------------------------------------------------------------
42  // Clear
43  //------------------------------------------------------------------------------
70  {
72 
73  public:
74  Clear();
75 
76  virtual void render_Implementation(const Actor*, const Shader*, const Camera*, OpenGLContext*) const;
77 
78  void setClearColorBuffer(bool clear) { mClearColorBuffer = clear; }
79 
80  void setClearDepthBuffer(bool clear) { mClearDepthBuffer = clear; }
81 
82  void setClearStencilBuffer(bool clear) { mClearStencilBuffer = clear; }
83 
84  void setClearColorValue(const fvec4& clear_val) { mClearColorValue = clear_val; }
85 
86  void setClearColorValueInt(const ivec4& clear_val) { mClearColorValueInt = clear_val; }
87 
88  void setClearColorValueUInt(const uvec4& clear_val) { mClearColorValueUInt = clear_val; }
89 
90  void setClearDepthValue(float clear_val) { mClearDepthValue = clear_val; }
91 
92  void setClearStencilValue(int clear_val) { mClearStencilValue = clear_val; }
93 
94  void setClearColorMode(EClearColorMode mode) { mClearColorMode = mode; }
95 
96  EClearColorMode clearColorMode() const { return mClearColorMode; }
97 
102  void setScissorBox(int x, int y, int w, int h) { mScissorBox[0] = x; mScissorBox[1] = y; mScissorBox[2] = w; mScissorBox[3] = h; }
103 
104  void getScissorBox(int& x, int& y, int& w, int& h) { x = mScissorBox[0]; y = mScissorBox[1]; w = mScissorBox[2]; h = mScissorBox[3]; }
105 
106  // Renderable interface implementation.
107 
109 
110  virtual void deleteBufferObject() {}
111 
112  protected:
113  virtual void computeBounds_Implementation() { setBoundingBox(AABB()); setBoundingSphere(Sphere()); }
114 
115  protected:
119  int mScissorBox[4];
126  };
127 }
128 
129 #endif
Associates a Renderable object to an Effect and Transform.
Definition: Actor.hpp:130
void setClearColorValueInt(const ivec4 &clear_val)
Definition: Clear.hpp:86
uvec4 mClearColorValueUInt
Definition: Clear.hpp:118
float mClearDepthValue
Definition: Clear.hpp:121
ivec4 mClearColorValueInt
Definition: Clear.hpp:117
bool mClearDepthBuffer
Definition: Clear.hpp:124
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard...
void setClearDepthValue(float clear_val)
Definition: Clear.hpp:90
virtual void computeBounds_Implementation()
Definition: Clear.hpp:113
void getScissorBox(int &x, int &y, int &w, int &h)
Definition: Clear.hpp:104
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
Visualization Library main namespace.
void setClearDepthBuffer(bool clear)
Definition: Clear.hpp:80
fvec4 mClearColorValue
Definition: Clear.hpp:116
The AABB class implements an axis-aligned bounding box using vl::real precision.
Definition: AABB.hpp:44
void setClearColorValue(const fvec4 &clear_val)
Definition: Clear.hpp:84
void setClearColorMode(EClearColorMode mode)
Definition: Clear.hpp:94
An abstract class that represents all the objects that can be rendered.
Definition: Renderable.hpp:58
bool mClearColorBuffer
Definition: Clear.hpp:123
The Clear class is a Renderable used to clear the whole or a portion of the color, stencil or depth buffer.
Definition: Clear.hpp:69
EClearColorMode
EBufferObjectUpdateMode
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
Definition: Shader.hpp:1830
The Sphere class defines a sphere using a center and a radius using vl::real precision.
Definition: Sphere.hpp:43
bool mClearStencilBuffer
Definition: Clear.hpp:125
void setClearColorBuffer(bool clear)
Definition: Clear.hpp:78
EClearColorMode mClearColorMode
Definition: Clear.hpp:120
virtual void updateDirtyBufferObject(EBufferObjectUpdateMode)
Uploads the data stored in the local buffers on the GPU memory.
Definition: Clear.hpp:108
virtual void deleteBufferObject()
Destroys the BufferObject (vertex buffer objects) associated to this a Renderable.
Definition: Clear.hpp:110
void setClearColorValueUInt(const uvec4 &clear_val)
Definition: Clear.hpp:88
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
Definition: Camera.hpp:49
void setClearStencilBuffer(bool clear)
Definition: Clear.hpp:82
EClearColorMode clearColorMode() const
Definition: Clear.hpp:96
void setClearStencilValue(int clear_val)
Definition: Clear.hpp:92
int mClearStencilValue
Definition: Clear.hpp:122
void setScissorBox(int x, int y, int w, int h)
Defines which portion of the rendering buffers should be cleared.
Definition: Clear.hpp:102