From a60a02a31e16ebac9cc333baee2d6dad9ae6cb00 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 8 Dec 2017 19:15:26 -1000 Subject: [PATCH] Add flip flag for collision triangles --- hecl/blender/hecl/hmdl/__init__.py | 5 ++++- hecl/extern/boo | 2 +- hecl/include/hecl/Blender/BlenderConnection.hpp | 1 + hecl/lib/Blender/BlenderConnection.cpp | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hecl/blender/hecl/hmdl/__init__.py b/hecl/blender/hecl/hmdl/__init__.py index 8707018b1..b88a70a78 100644 --- a/hecl/blender/hecl/hmdl/__init__.py +++ b/hecl/blender/hecl/hmdl/__init__.py @@ -329,7 +329,10 @@ def cookcol(writebuf, mesh_obj): edge_idxs = [] for loopi in p.loop_indices: edge_idxs.append(copy_mesh.loops[loopi].edge_index) - writebuf(struct.pack('IIII', edge_idxs[0], edge_idxs[1], edge_idxs[2], p.material_index)) + l0 = copy_mesh.loops[p.loop_indices[0]] + e0 = copy_mesh.edges[l0.edge_index] + flip = l0.vertex_index != e0.vertices[0] + writebuf(struct.pack('IIIIb', edge_idxs[0], edge_idxs[1], edge_idxs[2], p.material_index, flip)) # Delete copied mesh from scene bpy.context.scene.objects.unlink(copy_obj) diff --git a/hecl/extern/boo b/hecl/extern/boo index 1259255f3..2db777eea 160000 --- a/hecl/extern/boo +++ b/hecl/extern/boo @@ -1 +1 @@ -Subproject commit 1259255f34f3b5bf370fd8b1a87d52a3de87ec57 +Subproject commit 2db777eead15d599d774820b8065c8125bfa2907 diff --git a/hecl/include/hecl/Blender/BlenderConnection.hpp b/hecl/include/hecl/Blender/BlenderConnection.hpp index 718a9bb17..8dd7402fe 100644 --- a/hecl/include/hecl/Blender/BlenderConnection.hpp +++ b/hecl/include/hecl/Blender/BlenderConnection.hpp @@ -671,6 +671,7 @@ public: { uint32_t edges[3]; uint32_t matIdx; + bool flip; Triangle(BlenderConnection& conn); }; std::vector trianges; diff --git a/hecl/lib/Blender/BlenderConnection.cpp b/hecl/lib/Blender/BlenderConnection.cpp index 7831706ff..f4fcdb3bf 100644 --- a/hecl/lib/Blender/BlenderConnection.cpp +++ b/hecl/lib/Blender/BlenderConnection.cpp @@ -1092,7 +1092,7 @@ BlenderConnection::DataStream::ColMesh::Edge::Edge(BlenderConnection& conn) BlenderConnection::DataStream::ColMesh::Triangle::Triangle(BlenderConnection& conn) { - conn._readBuf(this, 16); + conn._readBuf(this, 17); } BlenderConnection::DataStream::World::Area::Dock::Dock(BlenderConnection& conn)