diff options
author | Mikael Hermansson <mikael@hermansson.io> | 2023-09-19 22:20:39 +0200 |
---|---|---|
committer | Mikael Hermansson <mikael@hermansson.io> | 2023-09-20 12:24:32 +0200 |
commit | ee9f41a12d399611d60bbc7a11bb07b12e16dca3 (patch) | |
tree | d9a5023d96d373688a93fdcb576523108771b6e4 /scene/3d/soft_body_3d.cpp | |
parent | 571cd0eb791b37e9a8adda9f909251138170f6b7 (diff) | |
download | redot-engine-ee9f41a12d399611d60bbc7a11bb07b12e16dca3.tar.gz |
Fix bindings of `PhysicsServer3DRenderingServerHandler`
Diffstat (limited to 'scene/3d/soft_body_3d.cpp')
-rw-r--r-- | scene/3d/soft_body_3d.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/scene/3d/soft_body_3d.cpp b/scene/3d/soft_body_3d.cpp index d1753fff6c..d24dd755dc 100644 --- a/scene/3d/soft_body_3d.cpp +++ b/scene/3d/soft_body_3d.cpp @@ -78,14 +78,13 @@ void SoftBodyRenderingServerHandler::commit_changes() { RS::get_singleton()->mesh_surface_update_vertex_region(mesh, surface, 0, buffer); } -void SoftBodyRenderingServerHandler::set_vertex(int p_vertex_id, const void *p_vector3) { - memcpy(&write_buffer[p_vertex_id * stride + offset_vertices], p_vector3, sizeof(float) * 3); +void SoftBodyRenderingServerHandler::set_vertex(int p_vertex_id, const Vector3 &p_vertex) { + memcpy(&write_buffer[p_vertex_id * stride + offset_vertices], &p_vertex, sizeof(Vector3)); } -void SoftBodyRenderingServerHandler::set_normal(int p_vertex_id, const void *p_vector3) { +void SoftBodyRenderingServerHandler::set_normal(int p_vertex_id, const Vector3 &p_normal) { // Store normal vector in A2B10G10R10 format. - Vector3 n; - memcpy(&n, p_vector3, sizeof(Vector3)); + Vector3 n = p_normal; n *= Vector3(0.5, 0.5, 0.5); n += Vector3(0.5, 0.5, 0.5); Vector2 res = n.octahedron_encode(); |