rplight: PSSMCameraRig::update() should accept cam node directly

Previously it would always use the first child of the given node (presumably expecting that `base.camera` is passed in), which is inconvenient when dealing with multiple cameras.
This commit is contained in:
rdb 2021-05-11 10:31:03 +02:00
parent 2ed61c91fc
commit be03011f21

View File

@ -369,8 +369,16 @@ void PSSMCameraRig::update(NodePath cam_node, const LVecBase3 &light_vector) {
LMatrix4 transform = cam_node.get_transform()->get_mat();
// Get Camera and Lens pointers
Camera* cam = DCAST(Camera, cam_node.get_child(0).node());
nassertv(cam != nullptr);
Camera *cam;
PandaNode *node = cam_node.node();
if (node->is_of_type(Camera::get_class_type())) {
cam = (Camera *)node;
}
else {
// Perhaps we passed in something like base.camera ?
cam = DCAST(Camera, cam_node.get_child(0).node());
nassertv(cam != nullptr);
}
Lens* lens = cam->get_lens();
// Extract near and far points: