28 #include "shadowManager.h" 30 NotifyCategoryDef(shadowmanager,
"");
43 _tag_state_mgr =
nullptr;
44 _atlas_graphics_output =
nullptr;
71 nassertv(_tag_state_mgr !=
nullptr);
72 nassertv(_atlas_graphics_output !=
nullptr);
74 _cameras.resize(_max_updates);
75 _display_regions.resize(_max_updates);
76 _camera_nps.reserve(_max_updates);
79 for(
size_t i = 0; i < _max_updates; ++i) {
82 PT(
Camera) camera =
new Camera(
"ShadowCam-" + format_string(i));
84 camera->set_active(
false);
85 camera->set_scene(_scene_parent);
93 region->set_clear_depth_active(
true);
94 region->set_clear_depth(1.0);
95 region->set_clear_color_active(
false);
96 region->set_camera(_camera_nps[i]);
97 region->set_active(
false);
98 _display_regions[i] = region;
105 _queued_updates.reserve(_max_updates);
121 nassertv(_atlas !=
nullptr);
122 nassertv(_queued_updates.size() <= _max_updates);
125 for (
size_t i = _queued_updates.size(); i < _max_updates; ++i) {
126 _cameras[i]->set_active(
false);
127 _display_regions[i]->set_active(
false);
131 for (
size_t i = 0; i < _queued_updates.size(); ++i) {
135 _cameras[i]->set_active(
true);
136 _display_regions[i]->set_active(
true);
146 _display_regions[i]->set_dimensions(
148 uv.get_x() + uv.get_z(),
150 uv.get_y() + uv.get_w()
155 _queued_updates.clear();
156 _queued_updates.reserve(_max_updates);
A completely generic linear lens.
bool is_empty() const
Returns true if the NodePath contains no nodes.
void update()
Updates the ShadowManager.
DisplayRegion * make_display_region()
Creates a new DisplayRegion that covers the entire window.
const LVecBase4 & get_uv_region() const
Returns the assigned region of the source in UV space.
~ShadowManager()
Destructs the ShadowManager.
NodePath attach_new_node(PandaNode *node, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Attaches a new node, with or without existing parents, to the scene graph below the referenced node o...
Class which manages distributing shadow maps in an atlas.
ShadowManager()
Constructs a new shadow atlas.
A rectangular subregion within a window for rendering into.
void init()
Initializes the ShadowManager.
A node that can be positioned around in the scene graph to represent a point of view for rendering a ...
set_sort
Sets the sort value associated with the DisplayRegion.
const LMatrix4 & get_mvp() const
Returns the View-Projection matrix of the source.