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]
RenderingAbstract.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 RenderingAbstract_INCLUDE_ONCE
33 #define RenderingAbstract_INCLUDE_ONCE
34 
36 #include <vlCore/Collection.hpp>
37 #include <vlGraphics/Actor.hpp>
38 #include <vlCore/vlnamespace.hpp>
39 
40 namespace vl
41 {
42  class RenderEventCallback;
43 
46  {
48 
49  public:
52 
54  virtual void render() = 0;
55 
56  RenderingAbstract& operator=(const RenderingAbstract& other);
57 
59  void dispatchOnRenderingStarted();
60 
62  void dispatchOnRenderingFinished();
63 
65  Collection<RenderEventCallback>* onStartedCallbacks() { return mOnStartedCallbacks.get(); }
66 
68  const Collection<RenderEventCallback>* onStartedCallbacks() const { return mOnStartedCallbacks.get(); }
69 
71  Collection<RenderEventCallback>* onFinishedCallbacks() { return mOnFinishedCallbacks.get(); }
72 
74  const Collection<RenderEventCallback>* onFinishedCallbacks() const { return mOnFinishedCallbacks.get(); }
75 
79  void setEnableMask(unsigned int mask) { mEnableMask = mask; }
80 
82  unsigned int enableMask() const { return mEnableMask; }
83 
84  bool isEnabled(unsigned int mask) { return (mask & mEnableMask) != 0; }
85  bool isEnabled(const Actor* actor) { return actor->isEnabled() && (actor->enableMask() & mEnableMask) != 0; }
86 
88  void setFrameClock(real cur_time) { mFrameClock = cur_time; }
89 
91  real frameClock() const { return mFrameClock; }
92 
93  protected:
97  unsigned int mEnableMask;
98  };
99 }
100 
101 #endif
Associates a Renderable object to an Effect and Transform.
Definition: Actor.hpp:130
Collection< RenderEventCallback > * onFinishedCallbacks()
Returns the list of RenderEventCallback objects registered to the onRenderingFinished() event notific...
bool isEnabled(const Actor *actor)
ref< Collection< RenderEventCallback > > mOnFinishedCallbacks
bool isEnabled() const
Whether an Actor should be considered for rendering, picking, scene bounding box calculation etc...
Definition: Actor.hpp:277
The RenderingAbstract class is the base of all the rendering related sub-classes. ...
Collection< RenderEventCallback > * onStartedCallbacks()
Returns the list of RenderEventCallback objects registered to the onRenderingStarted() event notifica...
const Collection< RenderEventCallback > * onStartedCallbacks() const
Returns the list of RenderEventCallback objects registered to the onRenderingStarted() event notifica...
void setFrameClock(real cur_time)
The update time of the current rendering frame.
unsigned int enableMask() const
The enable mask of an Actor is usually used to defines whether the actor should be rendered or not de...
Definition: Actor.hpp:270
Visualization Library main namespace.
void setEnableMask(unsigned int mask)
The enable mask of the Rendering, used to define wheter the rendering is enabled or not...
unsigned int enableMask() const
The enable mask of the Rendering, used to define wheter the rendering is enabled or not...
real frameClock() const
The update time of the current rendering frame.
The base class for all the reference counted objects.
Definition: Object.hpp:158
const Collection< RenderEventCallback > * onFinishedCallbacks() const
Returns the list of RenderEventCallback objects registered to the onRenderingFinished() event notific...
#define VL_INSTRUMENT_ABSTRACT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:145
It&#39;s basically an std::vector for Objects that is itself an Object so it can be reference counted and...
Definition: Collection.hpp:49
ref< Collection< RenderEventCallback > > mOnStartedCallbacks
The ref<> class is used to reference-count an Object.
Definition: Object.hpp:55
Visualization Library&#39;s enums in the &#39;vl&#39; namespace.
bool isEnabled(unsigned int mask)