diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-07-19 22:47:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-19 22:47:57 +0200 |
commit | db010bd71d4a388f0a9dbb1c31ca0923b0f054ed (patch) | |
tree | 49f7daa9b362409aa77f6a27340fa89d6717eac1 | |
parent | 5440fe14da2430a41958bb4632792e1e03a6c2a5 (diff) | |
parent | 09f0596eb22a7931f008d2da79f9c4fe2af230ab (diff) |
Merge pull request #50604 from aaronfranke/float-array-cast
Explicitly cast real_t to float when creating a float array
-rw-r--r-- | scene/3d/sprite_3d.cpp | 8 | ||||
-rw-r--r-- | servers/rendering_server.cpp | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 13f8002721..2a53dd6aca 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -583,10 +583,10 @@ void Sprite3D::_draw() { aabb.expand_to(vtx); } - float v_uv[2] = { uvs[i].x, uvs[i].y }; + float v_uv[2] = { (float)uvs[i].x, (float)uvs[i].y }; memcpy(&attribute_write_buffer[i * attrib_stride + mesh_surface_offsets[RS::ARRAY_TEX_UV]], v_uv, 8); - float v_vertex[3] = { vtx.x, vtx.y, vtx.z }; + float v_vertex[3] = { (float)vtx.x, (float)vtx.y, (float)vtx.z }; memcpy(&vertex_write_buffer[i * vertex_stride + mesh_surface_offsets[RS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3); memcpy(&vertex_write_buffer[i * vertex_stride + mesh_surface_offsets[RS::ARRAY_NORMAL]], &v_normal, 4); @@ -949,10 +949,10 @@ void AnimatedSprite3D::_draw() { aabb.expand_to(vtx); } - float v_uv[2] = { uvs[i].x, uvs[i].y }; + float v_uv[2] = { (float)uvs[i].x, (float)uvs[i].y }; memcpy(&attribute_write_buffer[i * attrib_stride + mesh_surface_offsets[RS::ARRAY_TEX_UV]], v_uv, 8); - float v_vertex[3] = { vtx.x, vtx.y, vtx.z }; + float v_vertex[3] = { (float)vtx.x, (float)vtx.y, (float)vtx.z }; memcpy(&vertex_write_buffer[i * vertex_stride + mesh_surface_offsets[RS::ARRAY_VERTEX]], &v_vertex, sizeof(float) * 3); memcpy(&vertex_write_buffer[i * vertex_stride + mesh_surface_offsets[RS::ARRAY_NORMAL]], &v_normal, 4); memcpy(&vertex_write_buffer[i * vertex_stride + mesh_surface_offsets[RS::ARRAY_TANGENT]], &v_tangent, 4); diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 748b372c62..a88fad9fe1 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -350,7 +350,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint { for (int i = 0; i < p_vertex_array_len; i++) { - float vector[2] = { src[i].x, src[i].y }; + float vector[2] = { (float)src[i].x, (float)src[i].y }; memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, sizeof(float) * 2); @@ -375,7 +375,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint { for (int i = 0; i < p_vertex_array_len; i++) { - float vector[3] = { src[i].x, src[i].y, src[i].z }; + float vector[3] = { (float)src[i].x, (float)src[i].y, (float)src[i].z }; memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], vector, sizeof(float) * 3); @@ -461,7 +461,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint const Vector2 *src = array.ptr(); for (int i = 0; i < p_vertex_array_len; i++) { - float uv[2] = { src[i].x, src[i].y }; + float uv[2] = { (float)src[i].x, (float)src[i].y }; memcpy(&aw[p_offsets[ai] + i * p_attrib_stride], uv, 2 * 4); } @@ -478,7 +478,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint const Vector2 *src = array.ptr(); for (int i = 0; i < p_vertex_array_len; i++) { - float uv[2] = { src[i].x, src[i].y }; + float uv[2] = { (float)src[i].x, (float)src[i].y }; memcpy(&aw[p_offsets[ai] + i * p_attrib_stride], uv, 2 * 4); } } break; |