From f8e7f9f3a3f081c9fb5dce8309c7834efab1ee1d Mon Sep 17 00:00:00 2001 From: snake-biscuits <36507175+snake-biscuits@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:08:19 +0100 Subject: [PATCH] (titanfall.respawn) preparing to visualise TriColl --- bsp_tool/branches/respawn/titanfall.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/bsp_tool/branches/respawn/titanfall.py b/bsp_tool/branches/respawn/titanfall.py index 5bd0f88c..f2296429 100644 --- a/bsp_tool/branches/respawn/titanfall.py +++ b/bsp_tool/branches/respawn/titanfall.py @@ -397,7 +397,7 @@ class PrimitiveType(enum.Enum): # classes for lumps, in alphabetical order: -class Bounds(base.Struct): # LUMP 88 & 90 (0058 & 005A) +class Bounds(base.Struct): # LUMP 68, 88 & 90 (0044, 0058 & 005A) """Identified by warmist & rexx#1287""" # dcollyawbox_t origin: vector.vec3 # uint16_t @@ -815,6 +815,10 @@ class TricollHeader(base.Struct): # LUMP 69 (0045) _classes = {"texture_flags": TextureDataFlags, "origin": vector.vec3} # TODO: "flags": TricollHeaderFlags + @property + def num_nodes(self) -> int: + return 2 * (self.num_triangles - (self.num_triangles + 3) % 6 + 3) // 3 + class TricollTriangle(base.BitField): # LUMP 66 (0042) """Identified by Fifty & RoyalBlue""" @@ -827,19 +831,6 @@ class TricollTriangle(base.BitField): # LUMP 66 (0042) # TODO: _classes = {"flags": TricollTriangleFlags} -class TricollNode(base.Struct): # LUMP 68 (0044) - """Identified by rexx#1287 & RoyalBlue""" - # dcollyawbox_t: a Z-rotated AABB w/ precaculated sin & cos - origin: vector.vec3 - cos: int # precalculated cos(yaw) - extents: vector.vec3 - sin: int # precalculated sin(yaw) - __slots__ = ["origin", "cos", "extents", "sin"] - _format = "8h" - _arrays = {"origin": [*"xyz"], "extents": [*"xyz"]} - _classes = {"origin": vector.vec3, "extents": vector.vec3} # TODO: ivec3 - - class WorldLight(source.WorldLight): # LUMP 54 (0036) """pretty basic extension of valve.source.WorldLight""" origin: vector.vec3 # origin point of this light source @@ -1107,7 +1098,7 @@ def as_bytes(self) -> bytes: "SHADOW_MESH_OPAQUE_VERTICES": {0: quake.Vertex}, "TEXTURE_DATA": {1: TextureData}, "TRICOLL_HEADERS": {1: TricollHeader}, - "TRICOLL_NODES": {1: TricollNode}, + "TRICOLL_NODES": {1: Bounds}, "VERTEX_BLINN_PHONG": {0: VertexBlinnPhong}, "VERTEX_LIT_BUMP": {1: VertexLitBump}, "VERTEX_LIT_FLAT": {1: VertexLitFlat},