Skip to content

Commit

Permalink
(Titanfall Engine)(#86) revising GeoSet
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-biscuits committed Sep 20, 2024
1 parent d86a415 commit d9f1206
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 31 deletions.
29 changes: 14 additions & 15 deletions bsp_tool/branches/respawn/titanfall.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,14 @@ class LUMP(enum.Enum):
# CM_* (presumed: Clip Model)
# GM_GRID holds world bounds & other metadata

# Grid -> GridCell -> GeoSet
# \-?> Primitive
# Grid -> GridCell -> GeoSet -> Primitive

# /-> UniqueContents
# GeoSet & Primitive -> .primitive.type / .type -> Brush OR Tricoll
# /-> UniqueContents
# Primitive -> .primitive.type / .type -> Brush OR Tricoll

# GeoSet appears to wrap Primitive w/ a count & stradle group (fusing primitives?)

# Primitives is parallel w/ PrimitiveBounds & GeoSets is parallel w/ GeoSetBounds
# GeoSets can contain duplicates (use same .straddle_group)
# GeoSets is parallel w/ GeoSet Bounds
# Primitives is parallel w/ PrimitiveBounds
# PrimitiveBounds & GeoSetBounds use the same "Bounds" type

# CM_BRUSH: brushwork geo
Expand All @@ -241,7 +240,7 @@ class LUMP(enum.Enum):
# len(BrushSideProperties/TextureVectors) = len(Brushes) * 6 + len(BrushSidePlaneOffsets)
# Brush.num_brush_sides (derived) is 6 + Brush.num_plane_offsets

# TRICOLL_* (presumed: Triangle Collision for patches / displacements)
# TRICOLL_* (Triangle Collision for patches / displacements)
# /-> TextureData
# /--> Vertices
# TricollHeader -> TricollTriangle -> Vertices
Expand Down Expand Up @@ -503,14 +502,14 @@ class GeoSet(base.Struct): # LUMP 87 (0057)
# Parallel w/ GeoSetBounds
straddle_group: int # CMGrid counts straddle groups
num_primitives: int # start from primitive.index?
primitive: List[int] # embedded Primitive?
# primitive.type: PrimitiveType # Brush / Tricoll
# primitive.index: int # index into Brushes / TricollHeaders
# primitive.unique_contents: int # index into UniqueContents
__slots__ = ["straddle_group", "num_primitives", "primitive"]
bitfield: List[int]
# bitfield.type: PrimitiveType # doesn't match children?
# bitfield.first_primitive: int # index into Primitives
# bitfield.unique_contents: int # index into UniqueContents
__slots__ = ["straddle_group", "num_primitives", "bitfield"]
_format = "2HI"
_bitfields = {"primitive": {"type": 8, "index": 16, "unique_contents": 8}}
_classes = {"primitive.type": PrimitiveType}
_bitfields = {"bitfield": {"type": 8, "first_primitive": 16, "unique_contents": 8}}
_classes = {"bitfield.type": PrimitiveType}


# NOTE: only one 28 byte entry per file
Expand Down
51 changes: 35 additions & 16 deletions bsp_tool/branches/respawn/titanfall2.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,33 @@ class LUMP(enum.Enum):
# CM_* LUMPS
# GM_GRID holds world bounds & other metadata

# Cell -?> Primitive | PrimitiveBounds
# \-?> GeoSet | GeoSetBounds
# Grid -> GridCell -> GeoSet -> Primitive

# Brush -> BrushSidePlane -> Plane
# \-> BrushSideProperties | BrushSideTextureVector
# /-> UniqueContents
# Primitive -> .primitive.type / .type -> Brush OR Tricoll OR StaticProp

# BrushSideProps is parallel w/ BrushTexVecs
# GeoSets can contain duplicates (use same .straddle_group)
# GeoSets is parallel w/ GeoSet Bounds
# Primitives is parallel w/ PrimitiveBounds
# GeoSets is parallel w/ GeoSetBounds
# PrimitiveBounds & GeoSetBounds use the same type (loaded w/ the same function in engine.dll)
# PrimitiveBounds & GeoSetBounds use the same "Bounds" type

# CM_BRUSH: brushwork geo
# /-> BrushSidePlaneOffset -> Plane
# Brush -> BrushSideProperties -> TextureData
# \-> BrushSideTextureVector

# BrushSideProperties is parallel w/ BrushSideTextureVector (one per brushside)
# len(BrushSideProperties/TextureVectors) = len(Brushes) * 6 + len(BrushSidePlaneOffsets)
# Brush.num_brush_sides (derived) is 6 + Brush.num_plane_offsets

# TRICOLL_* (Triangle Collision for patches / displacements)
# /-> TextureData
# /--> Vertices
# TricollHeader -> TricollTriangle -> Vertices
# \--> TricollNode -?> TricollNode / ???
# \-> TricollBevelIndices? -?> ?

# TricollBevelStarts is parallel w/ TricollTriangles

# LIGHTPROBES
# LightProbeTree -?> LightProbeRef -> LightProbe
Expand Down Expand Up @@ -245,16 +262,18 @@ class PrimitiveType(enum.IntFlag):
# classes for lumps, in alphabetical order::
class GeoSet(base.Struct): # LUMP 87 (0057)
# Parallel w/ GeoSetBounds
straddle_group: int # CMGrid counts straddle groups
num_primitives: int # start from primitive.index?
primitive: List[int] # embedded Primitive?
# primitive.type: PrimitiveType # Brush / Tricoll
# primitive.index: int # index into Brushes / TricollHeaders
# primitive.unique_contents: int # index into UniqueContents
__slots__ = ["straddle_group", "num_primitives", "primitive"]
straddle_group: int
# if == 0: only touches parent GridCell
# if != 0: touches multiple GridCells & might be cached already
num_primitives: int
bitfield: List[int]
# bitfield.type: PrimitiveType # doesn't match children?
# bitfield.index: int # index into Primitives
# bitfield.unique_contents: int # index into UniqueContents
__slots__ = ["straddle_group", "num_primitives", "bitfield"]
_format = "2HI"
_bitfields = {"primitive": {"type": 8, "index": 16, "unique_contents": 8}}
_classes = {"primitive.type": PrimitiveType}
_bitfields = {"bitfield": {"type": 8, "first_primitive": 16, "unique_contents": 8}}
_classes = {"bitfield.type": PrimitiveType}


class LightmapPage(base.Struct): # LUMP 122 (007A)
Expand Down

0 comments on commit d9f1206

Please sign in to comment.