Skip to content

Commit

Permalink
Fix bbox and reorganize code
Browse files Browse the repository at this point in the history
  • Loading branch information
Konclan committed Oct 6, 2023
1 parent 1e64368 commit fb7d77a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
31 changes: 24 additions & 7 deletions src/precomp/skybox.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,34 @@

LOGGER = srctools.logger.get_logger(__name__)

def generate(vmf : VMF, coll):
# Generate our walls
EX_SIZE_MAX = Vec(8832, 8832, 8832)
EX_SIZE_MIN = Vec(5632, 5632, 5632)

def make_skybox(vmf : VMF, coll):
if not precomp.options.get(bool, 'extend_chamber'):
return None

size_max = Vec(8832, 8832, 8832)
# Make the box that contains the map
make_skybox_shell(vmf)

# Move Elevators to valid location if possible and then generate elevator shell

# Open Walls and add square beams

# Add exterior decoration

def make_skybox_shell(vmf : VMF):
# Generate our walls
size_pad = Vec(2048, 2048, 128)

pos_min,pos_max = Vec.bbox(POS.min, POS.max)
bbox_origin = (POS.min + POS.max) / 2
bbox_lower = min(-(size_max/2), (POS.min - bbox_origin) - size_pad) + bbox_origin
bbox_upper = min(size_max/2, (POS.max - bbox_origin) + size_pad) + bbox_origin
bbox_lower, bbox_upper = Vec.bbox(
-max(EX_SIZE_MIN / 2, min(EX_SIZE_MAX / 2, -(pos_min - bbox_origin) + size_pad)),
max(EX_SIZE_MIN / 2, min(EX_SIZE_MAX / 2, (pos_max - bbox_origin) + size_pad))
)

for solid in vmf.make_hollow(bbox_lower + bbox_origin, bbox_upper + bbox_origin, 16, consts.Tools.NODRAW, consts.Tools.BLACK):
vmf.add_brush(solid)

for solid in vmf.make_hollow(bbox_lower, bbox_upper, 16, consts.Tools.NODRAW, consts.Tools.BLACK):
vmf.add_brush(solid)
# vmf.add_brush(vmf.make_prism(pos_min, pos_max, consts.Tools.SKIP).solid)
2 changes: 1 addition & 1 deletion src/vbsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ async def main() -> None:
conditions.check_all(vmf, coll, info)
add_extra_ents(vmf, info)

skybox.generate(vmf, coll)
skybox.make_skybox(vmf, coll)

tiling.generate_brushes(vmf)
faithplate.gen_faithplates(vmf, info.has_attr('superposition'))
Expand Down

0 comments on commit fb7d77a

Please sign in to comment.