Skip to content

Commit

Permalink
Fix slope sculpting heights
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Feb 16, 2024
1 parent 80cf786 commit 118630f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/terrain_3d_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ void Terrain3DEditor::Brush::set_data(Dictionary p_data) {
}
_image = p_data["image"];
if (_image.is_valid()) {
_img_size = Vector2(_image->get_size());
_img_size = _image->get_size();
} else {
_img_size = Vector2(0, 0);
_img_size = Vector2i(0, 0);
}
_texture = p_data["texture"];

Expand Down Expand Up @@ -133,7 +133,7 @@ void Terrain3DEditor::_operate_map(Vector3 p_global_position, real_t p_camera_di
Ref<Image> map = storage->get_map_region(map_type, region_index);
int brush_size = _brush.get_size();
int texture_id = _brush.get_texture_index();
Vector2 img_size = _brush.get_image_size();
Vector2i img_size = _brush.get_image_size();
real_t opacity = _brush.get_opacity();
real_t height = _brush.get_height();
Color color = _brush.get_color();
Expand Down Expand Up @@ -188,7 +188,7 @@ void Terrain3DEditor::_operate_map(Vector3 p_global_position, real_t p_camera_di
Vector2 brush_uv = Vector2(x, y) / real_t(brush_size);
Vector2i brush_pixel_position = Vector2i(_rotate_uv(brush_uv, rot) * img_size);

if (!_is_in_bounds(brush_pixel_position, Vector2i(img_size))) {
if (!_is_in_bounds(brush_pixel_position, img_size)) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/terrain_3d_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Terrain3DEditor : public Object {
class Brush {
private:
Ref<Image> _image;
Vector2 _img_size;
Vector2i _img_size;
Ref<ImageTexture> _texture;

int _size = 0;
Expand All @@ -89,7 +89,7 @@ class Terrain3DEditor : public Object {

Ref<ImageTexture> get_texture() const { return _texture; }
Ref<Image> get_image() const { return _image; }
Vector2 get_image_size() const { return _img_size; }
Vector2i get_image_size() const { return _img_size; }

int get_size() const { return _size; }
real_t get_opacity() const { return _opacity; }
Expand Down

0 comments on commit 118630f

Please sign in to comment.