diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-10 07:41:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-10 07:41:46 +0200 |
commit | 536950f9f35f48633c6c2c57ae2473bb906221d2 (patch) | |
tree | 659cb6a83ab8f4d76ae3b11486987c51825a849e /scene/resources/height_map_shape_3d.cpp | |
parent | f3ddc14d3829ed09d6eab81811bcfb1314626ddf (diff) | |
parent | 430ad75963a0e6837ef460e78fb99565714b4418 (diff) |
Merge pull request #21922 from aaronfranke/double
Some work on double-precision support
Diffstat (limited to 'scene/resources/height_map_shape_3d.cpp')
-rw-r--r-- | scene/resources/height_map_shape_3d.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/scene/resources/height_map_shape_3d.cpp b/scene/resources/height_map_shape_3d.cpp index de5da944bc..d1a958ad38 100644 --- a/scene/resources/height_map_shape_3d.cpp +++ b/scene/resources/height_map_shape_3d.cpp @@ -41,7 +41,7 @@ Vector<Vector3> HeightMapShape3D::get_debug_mesh_lines() const { Vector2 size(map_width - 1, map_depth - 1); Vector2 start = size * -0.5; - const float *r = map_data.ptr(); + const real_t *r = map_data.ptr(); // reserve some memory for our points.. points.resize(((map_width - 1) * map_depth * 2) + (map_width * (map_depth - 1) * 2) + ((map_width - 1) * (map_depth - 1) * 2)); @@ -105,7 +105,7 @@ void HeightMapShape3D::set_map_width(int p_new) { int new_size = map_width * map_depth; map_data.resize(map_width * map_depth); - float *w = map_data.ptrw(); + real_t *w = map_data.ptrw(); while (was_size < new_size) { w[was_size++] = 0.0; } @@ -129,7 +129,7 @@ void HeightMapShape3D::set_map_depth(int p_new) { int new_size = map_width * map_depth; map_data.resize(new_size); - float *w = map_data.ptrw(); + real_t *w = map_data.ptrw(); while (was_size < new_size) { w[was_size++] = 0.0; } @@ -143,7 +143,7 @@ int HeightMapShape3D::get_map_depth() const { return map_depth; } -void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) { +void HeightMapShape3D::set_map_data(Vector<real_t> p_new) { int size = (map_width * map_depth); if (p_new.size() != size) { // fail @@ -151,10 +151,10 @@ void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) { } // copy - float *w = map_data.ptrw(); - const float *r = p_new.ptr(); + real_t *w = map_data.ptrw(); + const real_t *r = p_new.ptr(); for (int i = 0; i < size; i++) { - float val = r[i]; + real_t val = r[i]; w[i] = val; if (i == 0) { min_height = val; @@ -174,7 +174,7 @@ void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) { notify_change_to_owners(); } -PackedFloat32Array HeightMapShape3D::get_map_data() const { +Vector<real_t> HeightMapShape3D::get_map_data() const { return map_data; } @@ -194,7 +194,7 @@ void HeightMapShape3D::_bind_methods() { HeightMapShape3D::HeightMapShape3D() : Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_HEIGHTMAP)) { map_data.resize(map_width * map_depth); - float *w = map_data.ptrw(); + real_t *w = map_data.ptrw(); w[0] = 0.0; w[1] = 0.0; w[2] = 0.0; |