Panda3D
shadowManager.h
1 /**
2  *
3  * RenderPipeline
4  *
5  * Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to deal
9  * in the Software without restriction, including without limitation the rights
10  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11  * copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in
15  * all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23  * THE SOFTWARE.
24  *
25  */
26 
27 #ifndef SHADOWMANAGER_H
28 #define SHADOWMANAGER_H
29 
30 #include "pandabase.h"
31 #include "camera.h"
32 #include "luse.h"
33 #include "matrixLens.h"
34 #include "referenceCount.h"
35 #include "nodePath.h"
36 #include "displayRegion.h"
37 #include "graphicsOutput.h"
38 
39 #include "tagStateManager.h"
40 #include "shadowSource.h"
41 #include "shadowAtlas.h"
42 
43 NotifyCategoryDecl(shadowmanager, EXPORT_CLASS, EXPORT_TEMPL);
44 
45 
46 class ShadowManager : public ReferenceCount {
47 PUBLISHED:
48  ShadowManager();
50 
51  inline void set_max_updates(size_t max_updates);
52  inline void set_scene(NodePath scene_parent);
53  inline void set_tag_state_manager(TagStateManager* tag_mgr);
54  inline void set_atlas_graphics_output(GraphicsOutput* graphics_output);
55 
56  inline void set_atlas_size(size_t atlas_size);
57  inline size_t get_atlas_size() const;
58  MAKE_PROPERTY(atlas_size, get_atlas_size, set_atlas_size);
59 
60  inline size_t get_num_update_slots_left() const;
61  MAKE_PROPERTY(num_update_slots_left, get_num_update_slots_left);
62 
63  inline ShadowAtlas* get_atlas() const;
64  MAKE_PROPERTY(atlas, get_atlas);
65 
66  void init();
67  void update();
68 
69 public:
70  inline bool add_update(const ShadowSource* source);
71 
72 private:
73  size_t _max_updates;
74  size_t _atlas_size;
75  NodePath _scene_parent;
76 
77  pvector<PT(Camera)> _cameras;
78  pvector<NodePath> _camera_nps;
79  pvector<PT(DisplayRegion)> _display_regions;
80 
81  ShadowAtlas* _atlas;
82  TagStateManager* _tag_state_mgr;
83  GraphicsOutput* _atlas_graphics_output;
84 
86  UpdateQueue _queued_updates;
87 };
88 
89 #include "shadowManager.I"
90 
91 #endif // SHADOWMANAGER_H
TagStateManager
This class handles all different tag states.
Definition: tagStateManager.h:50
nodePath.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ShadowManager::set_scene
void set_scene(NodePath scene_parent)
Sets the target scene.
Definition: shadowManager.I:113
ShadowManager::get_atlas
get_atlas
Returns a handle to the shadow atlas.
Definition: shadowManager.h:64
pvector
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
Camera
A node that can be positioned around in the scene graph to represent a point of view for rendering a ...
Definition: camera.h:35
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ReferenceCount
A base class for all things that want to be reference-counted.
Definition: referenceCount.h:38
DisplayRegion
A rectangular subregion within a window for rendering into.
Definition: displayRegion.h:57
ShadowSource
RenderPipeline.
Definition: shadowSource.h:51
ShadowManager::get_atlas_size
get_atlas_size
Returns the shadow atlas size.
Definition: shadowManager.h:58
matrixLens.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ShadowManager::~ShadowManager
~ShadowManager()
Destructs the ShadowManager.
Definition: shadowManager.cxx:51
GraphicsOutput
This is a base class for the various different classes that represent the result of a frame of render...
Definition: graphicsOutput.h:63
displayRegion.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ShadowManager::set_max_updates
void set_max_updates(size_t max_updates)
RenderPipeline.
Definition: shadowManager.I:51
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ShadowManager::init
void init()
Initializes the ShadowManager.
Definition: shadowManager.cxx:69
ShadowManager::add_update
bool add_update(const ShadowSource *source)
Adds a new shadow update.
Definition: shadowManager.I:167
ShadowManager::update
void update()
Updates the ShadowManager.
Definition: shadowManager.cxx:120
camera.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ShadowManager::set_atlas_graphics_output
void set_atlas_graphics_output(GraphicsOutput *graphics_output)
Sets the handle to the Shadow targets output.
Definition: shadowManager.I:149
NodePath
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:159
referenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ShadowManager
Definition: shadowManager.h:46
ShadowAtlas
Class which manages distributing shadow maps in an atlas.
Definition: shadowAtlas.h:41
ShadowManager::ShadowManager
ShadowManager()
Constructs a new shadow atlas.
Definition: shadowManager.cxx:39
ShadowManager::set_tag_state_manager
void set_tag_state_manager(TagStateManager *tag_mgr)
Sets the handle to the TagStageManager.
Definition: shadowManager.I:129
graphicsOutput.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ShadowManager::set_atlas_size
set_atlas_size
Sets the shadow atlas size.
Definition: shadowManager.h:58
ShadowManager::get_num_update_slots_left
get_num_update_slots_left
Returns how many update slots are left.
Definition: shadowManager.h:61