mirror of https://github.com/godotengine/godot
Merge pull request #51388 from lawnjelly/portals_fix_secondary_pvs
Portals - Fix secondary PVS bug
This commit is contained in:
commit
7b718dc36b
|
|
@ -164,11 +164,6 @@ void RoomManager::_preview_camera_update() {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (camera_pos != _godot_camera_pos) {
|
if (camera_pos != _godot_camera_pos) {
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
// update gameplay monitor
|
|
||||||
Vector<Vector3> camera_positions;
|
|
||||||
camera_positions.push_back(camera_pos);
|
|
||||||
VisualServer::get_singleton()->rooms_update_gameplay_monitor(scenario, camera_positions);
|
|
||||||
}
|
}
|
||||||
// check planes
|
// check planes
|
||||||
if (!changed) {
|
if (!changed) {
|
||||||
|
|
|
||||||
|
|
@ -104,20 +104,23 @@ void PortalGameplayMonitor::update_gameplay(PortalRenderer &p_portal_renderer, c
|
||||||
for (int n = 0; n < p_num_source_rooms; n++) {
|
for (int n = 0; n < p_num_source_rooms; n++) {
|
||||||
const VSRoom &source_room = p_portal_renderer.get_room(p_source_room_ids[n]);
|
const VSRoom &source_room = p_portal_renderer.get_room(p_source_room_ids[n]);
|
||||||
|
|
||||||
|
if (_use_secondary_pvs) {
|
||||||
|
int pvs_size = source_room._secondary_pvs_size;
|
||||||
|
int pvs_first = source_room._secondary_pvs_first;
|
||||||
|
|
||||||
|
for (int r = 0; r < pvs_size; r++) {
|
||||||
|
int room_id = pvs.get_secondary_pvs_room_id(pvs_first + r);
|
||||||
|
_update_gameplay_room(p_portal_renderer, room_id, source_rooms_changed);
|
||||||
|
} // for r through the rooms hit in the pvs
|
||||||
|
} else {
|
||||||
int pvs_size = source_room._pvs_size;
|
int pvs_size = source_room._pvs_size;
|
||||||
int pvs_first = source_room._pvs_first;
|
int pvs_first = source_room._pvs_first;
|
||||||
if (_use_secondary_pvs) {
|
|
||||||
pvs_size = source_room._secondary_pvs_size;
|
|
||||||
pvs_first = source_room._secondary_pvs_first;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int r = 0; r < pvs_size; r++) {
|
for (int r = 0; r < pvs_size; r++) {
|
||||||
int room_id = pvs.get_pvs_room_id(pvs_first + r);
|
int room_id = pvs.get_pvs_room_id(pvs_first + r);
|
||||||
|
|
||||||
_update_gameplay_room(p_portal_renderer, room_id, source_rooms_changed);
|
_update_gameplay_room(p_portal_renderer, room_id, source_rooms_changed);
|
||||||
|
|
||||||
} // for r through the rooms hit in the pvs
|
} // for r through the rooms hit in the pvs
|
||||||
|
}
|
||||||
} // for n through source rooms
|
} // for n through source rooms
|
||||||
|
|
||||||
// find any moving that were active last tick that are no longer active, and send notifications
|
// find any moving that were active last tick that are no longer active, and send notifications
|
||||||
|
|
|
||||||
|
|
@ -272,8 +272,8 @@ void PVSBuilder::calculate_pvs(PortalRenderer &p_portal_renderer, String p_filen
|
||||||
|
|
||||||
log("pvs from room : " + itos(n));
|
log("pvs from room : " + itos(n));
|
||||||
|
|
||||||
// trace_rooms_recursive_simple(0, n, n, -1, false, -1, dummy_planes, bf);
|
trace_rooms_recursive_simple(0, n, n, -1, false, -1, dummy_planes, bf);
|
||||||
trace_rooms_recursive(0, n, n, -1, false, -1, dummy_planes, bf);
|
// trace_rooms_recursive(0, n, n, -1, false, -1, dummy_planes, bf);
|
||||||
|
|
||||||
create_secondary_pvs(n, neighbors, bf);
|
create_secondary_pvs(n, neighbors, bf);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue