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]
SceneManagerVectorGraphics.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 SceneManagerVectorGraphics_INCLUDE_ONCE
33 #define SceneManagerVectorGraphics_INCLUDE_ONCE
34 
36 #include <vlCore/Collection.hpp>
37 #include <vlGraphics/Frustum.hpp>
38 
39 namespace vl
40 {
41  class VectorGraphics;
42 //-------------------------------------------------------------------------------------------------------------------------------------------
43 // SceneManagerVectorGraphics
44 //-------------------------------------------------------------------------------------------------------------------------------------------
57  {
59 
60  public:
62 
67  void setActorRenderRankStart(int rank_start) { mActorRenderRankStart = rank_start; }
68 
71 
72  virtual void extractVisibleActors(ActorCollection& queue, const Camera*)
73  {
74  if (cullingEnabled())
75  // FIXME: implement 2d culling?
76  extractActors(queue);
77  else
78  extractActors(queue);
79  }
80 
81  virtual void extractActors(ActorCollection& queue)
82  {
83  int actor_rank = mActorRenderRankStart;
84  for(size_t i=0; i<vectorGraphicObjects()->size(); ++i)
85  {
86  for(size_t j=0; j<vectorGraphicObjects()->at(i)->actors()->size(); ++j)
87  {
88  vectorGraphicObjects()->at(i)->actors()->at(j)->setRenderRank( actor_rank++ );
89  queue.push_back( vectorGraphicObjects()->at(i)->actors()->at(j) );
90  }
91  }
92  }
93 
96 
99 
100  protected:
103  };
104 //-------------------------------------------------------------------------------------------------------------------------------------------
105 }
106 
107 #endif
virtual void extractVisibleActors(ActorCollection &queue, const Camera *)
Extracts all the enabled and visible Actors contained in the ActorTree hierarchy and appends them to ...
virtual void extractActors(ActorCollection &queue)
Appends all the Actors contained in the scene manager without performing frustum culling or checking ...
Collection< VectorGraphics > mVectorGraphicObjects
bool cullingEnabled() const
Used to enable or disable frustum culling or whichever culling system the scene manager implements...
The SceneManagerVectorGraphics class is a SceneManager that contains VectorGraphics objects...
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
Visualization Library main namespace.
void setActorRenderRankStart(int rank_start)
Defines the Actor&#39;s render rank to be used when extracting them from the scene manager during the ren...
void push_back(T *data)
Definition: Collection.hpp:79
The SceneManager class is the base class for all the scene managers.
const Collection< VectorGraphics > * vectorGraphicObjects() const
Returns the list of VectorGraphics objects bound to a SceneManagerVectorGraphics. ...
int actorRenderRankStart() const
Returns the rendering rank start value used during the rendering of the VectorGraphics objects...
Defined as a simple subclass of Collection<Actor>, see Collection for more information.
Definition: Actor.hpp:479
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
Collection< VectorGraphics > * vectorGraphicObjects()
Returns the list of VectorGraphics objects bound to a SceneManagerVectorGraphics. ...
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
Definition: Camera.hpp:49