Skip to content

Commit

Permalink
Undo operations works, but not operations + regions
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Aug 25, 2024
1 parent 1a18a46 commit 73ca918
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 164 deletions.
11 changes: 4 additions & 7 deletions src/terrain_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,9 @@ void Terrain3D::_destroy_containers() {

void Terrain3D::_destroy_labels() {
Array labels = _label_nodes->get_children();
LOG(DEBUG, "Destroying ", labels.size(), " region labels");
for (int i = 0; i < labels.size(); i++) {
Node *label = cast_to<Node>(labels[i]);
if (label != nullptr) {
LOG(DEBUG, "Destroying label: ", label->get_name());
}
memdelete_safely(label);
}
}
Expand Down Expand Up @@ -1033,11 +1031,10 @@ void Terrain3D::update_aabbs() {
}
}

/* Iterate over ground to find intersection point between two rays:
/* Returns the point a ray intersects the ground using the GPU depth texture
* p_src_pos (camera position)
* p_direction (camera direction looking at the terrain)
* test_dir (camera direction 0 Y, traversing terrain along height
* Returns vec3(Double max 3.402823466e+38F) on no intersection. Test w/ if (var.x < 3.4e38)
* Returns Vec3(NAN) on error or vec3(3.402823466e+38F) on no intersection. Test w/ if (var.x < 3.4e38)
*/
Vector3 Terrain3D::get_intersection(const Vector3 &p_src_pos, const Vector3 &p_direction) {
if (!is_instance_valid(_camera_instance_id)) {
Expand Down Expand Up @@ -1102,10 +1099,10 @@ void Terrain3D::set_show_region_labels(const bool p_enabled) {
}

void Terrain3D::update_region_labels() {
LOG(DEBUG, "Updating region labels");
_destroy_labels();
if (_show_region_labels && _storage != nullptr) {
Array region_locations = _storage->get_region_locations();
LOG(DEBUG, "Creating ", region_locations.size(), " region labels");
for (int i = 0; i < region_locations.size(); i++) {
Label3D *label = memnew(Label3D);
String text = region_locations[i];
Expand Down
Loading

0 comments on commit 73ca918

Please # to comment.