diff options
author | Josh Chandler <j5d1c7@gmail.com> | 2020-04-28 11:04:07 -0400 |
---|---|---|
committer | Josh Chandler <j5d1c7@gmail.com> | 2021-07-03 15:08:17 -0400 |
commit | 879f84d8f8e7d9467bb9049b445d576916c847c0 (patch) | |
tree | e824ecb7e4670b4e0ede7de99f0f21e2254acec1 /scene/3d | |
parent | e849dc1791cd064b3b9736ac91f0ae9fae3bc8d9 (diff) |
add viewport.get_camera_2d()
* there is now a more clear distinction between camera_2d and camera_3d functions in the engine code
* simplified camera2d's exported interface - now everything happens directly with the 'current' variable and make_current and clear_current are no longer exposed- there were some situations where calling one instead of set_current would result in incomplete results
* rebased to current godot master
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/camera_3d.cpp | 20 | ||||
-rw-r--r-- | scene/3d/cpu_particles_3d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/gpu_particles_collision_3d.cpp | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 1ed8c0b4eb..0c38d85a6b 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -85,14 +85,14 @@ void Camera3D::_update_camera() { // here goes listener stuff /* if (viewport_ptr && is_inside_scene() && is_current()) - get_viewport()->_camera_transform_changed_notify(); + get_viewport()->_camera_3d_transform_changed_notify(); */ if (get_tree()->is_node_being_edited(this) || !is_current()) { return; } - get_viewport()->_camera_transform_changed_notify(); + get_viewport()->_camera_3d_transform_changed_notify(); } void Camera3D::_notification(int p_what) { @@ -104,9 +104,9 @@ void Camera3D::_notification(int p_what) { viewport = get_viewport(); ERR_FAIL_COND(!viewport); - bool first_camera = viewport->_camera_add(this); + bool first_camera = viewport->_camera_3d_add(this); if (current || first_camera) { - viewport->_camera_set(this); + viewport->_camera_3d_set(this); } } break; @@ -128,7 +128,7 @@ void Camera3D::_notification(int p_what) { } if (viewport) { - viewport->_camera_remove(this); + viewport->_camera_3d_remove(this); viewport = nullptr; } @@ -220,7 +220,7 @@ void Camera3D::make_current() { return; } - get_viewport()->_camera_set(this); + get_viewport()->_camera_3d_set(this); //get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,camera_group,"_camera_make_current",this); } @@ -231,11 +231,11 @@ void Camera3D::clear_current(bool p_enable_next) { return; } - if (get_viewport()->get_camera() == this) { - get_viewport()->_camera_set(nullptr); + if (get_viewport()->get_camera_3d() == this) { + get_viewport()->_camera_3d_set(nullptr); if (p_enable_next) { - get_viewport()->_camera_make_next_current(this); + get_viewport()->_camera_3d_make_next_current(this); } } } @@ -250,7 +250,7 @@ void Camera3D::set_current(bool p_current) { bool Camera3D::is_current() const { if (is_inside_tree() && !get_tree()->is_node_being_edited(this)) { - return get_viewport()->get_camera() == this; + return get_viewport()->get_camera_3d() == this; } else { return current; } diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp index 6dc865ec0e..3313633c0f 100644 --- a/scene/3d/cpu_particles_3d.cpp +++ b/scene/3d/cpu_particles_3d.cpp @@ -1007,7 +1007,7 @@ void CPUParticles3D::_update_particle_data_buffer() { sorter.sort(order, pc); } else if (draw_order == DRAW_ORDER_VIEW_DEPTH) { ERR_FAIL_NULL(get_viewport()); - Camera3D *c = get_viewport()->get_camera(); + Camera3D *c = get_viewport()->get_camera_3d(); if (c) { Vector3 dir = c->get_global_transform().basis.get_axis(2); //far away to close diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp index c1e71b9565..5b88a6ec9f 100644 --- a/scene/3d/gpu_particles_collision_3d.cpp +++ b/scene/3d/gpu_particles_collision_3d.cpp @@ -596,7 +596,7 @@ void GPUParticlesCollisionHeightField::_notification(int p_what) { } if (follow_camera_mode && get_viewport()) { - Camera3D *cam = get_viewport()->get_camera(); + Camera3D *cam = get_viewport()->get_camera_3d(); if (cam) { Transform3D xform = get_global_transform(); Vector3 x_axis = xform.basis.get_axis(Vector3::AXIS_X).normalized(); |