Skip to content

Commit

Permalink
Fix AkGeometry reflections and right-handed to left-handed Transformc…
Browse files Browse the repository at this point in the history
…onversion (#124)

(cherry picked from 61d37e3)
  • Loading branch information
alessandrofama committed Nov 21, 2024
1 parent cafc026 commit cbb41ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
7 changes: 4 additions & 3 deletions addons/Wwise/native/src/core/wwise_gdextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,10 +1003,11 @@ bool Wwise::set_geometry_instance(const Object* associated_geometry, const Trans

AkWorldTransform position_and_orientation{};
position_and_orientation.SetPosition(AK::ConvertAkVectorToAkVector64(position));
position_and_orientation.SetOrientation(orientation_front * -1.0f, orientation_top);
position_and_orientation.SetOrientation(orientation_front, orientation_top);
params.PositionAndOrientation = position_and_orientation;

vector3_to_akvector(transform.get_basis().get_scale(), params.Scale);

Vector3 scale = transform.get_basis().get_scale();
params.Scale = { scale.x, scale.y, scale.z };

params.RoomID = associated_room ? static_cast<AkRoomID>(associated_room->get_instance_id())
: static_cast<AkRoomID>(INVALID_ROOM_ID);
Expand Down
14 changes: 2 additions & 12 deletions addons/Wwise/native/src/scene/ak_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ void AkGeometry::_notification(int p_what, bool reversed)
}
}

void AkGeometry::add_indices(int a, int b, int c, int d)
{
indices.append(a);
indices.append(c);
indices.append(d);
indices.append(a);
indices.append(b);
indices.append(c);
}

AkGeometry::AkGeometry()
{
acoustic_texture["name"] = "";
Expand Down Expand Up @@ -112,7 +102,7 @@ bool AkGeometry::set_geometry(const MeshInstance3D* mesh_instance)
for (int i = 0; i < mdt->get_vertex_count(); ++i)
{
Vector3 vertex = mdt->get_vertex(i);
vertices.append(vertex);
vertices.append(Vector3(vertex.x, vertex.y, -vertex.z));
}

for (int i = 0; i < mdt->get_face_count(); ++i)
Expand All @@ -121,8 +111,8 @@ bool AkGeometry::set_geometry(const MeshInstance3D* mesh_instance)
int point_1 = mdt->get_face_vertex(i, 1);
int point_2 = mdt->get_face_vertex(i, 2);
triangles.append(point_0);
triangles.append(point_1);
triangles.append(point_2);
triangles.append(point_1);
}

if (!associated_room.is_empty())
Expand Down
1 change: 0 additions & 1 deletion addons/Wwise/native/src/scene/ak_geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class AkGeometry : public Node3D
Array triangles{};
MeshInstance3D* mesh_instance{};
Object* geometry_instance{};
void add_indices(int a, int b, int c, int d);

public:
AkGeometry();
Expand Down

0 comments on commit cbb41ac

Please sign in to comment.