Add ability to turn off portals on specific surfaces

This commit is contained in:
James Lambert 2023-07-14 21:33:39 -06:00
parent cf3efa84aa
commit 1e45fbc6aa
3 changed files with 12 additions and 15 deletions

View file

@ -121,8 +121,6 @@ make -f Makefile.docker
<br />
## Current New Feature TODO List
- [ ] fizzle radio/camera
- [ ] add fizller sides
- [ ] Add auto save checkpoints
- [ ] disable portal surfaces manually on some surfaces #135
- [ ] Portal not rendering recursively sometimes #138
@ -135,6 +133,8 @@ make -f Makefile.docker
- [ ] don't repeat camera destruction speech every time
- [ ] don't count boxes on buttons until it is released and stable
- [ ] dynamically load data
- [x] fizzle radio/camera
- [x] add fizller sides
- [x] flash portal opacity when other portal moves
- [x] rotate auto uv
- [x] Vertex lighting #39

View file

@ -8,12 +8,6 @@ local dynamic_collision_export = require('tools.level_scripts.dynamic_collision_
local portal_surfaces = {}
local portalable_surfaces = {
concrete_modular_wall001d = true,
concrete_modular_ceiling001a = true,
concrete_modular_floor001a = true,
}
local static_to_portable_surface_mapping = {}
local portal_surfaces = {}
@ -189,7 +183,7 @@ local function calculate_portal_single_surface(mesh, mesh_display_list)
end
for _, surface in pairs(static_export.static_nodes) do
if (surface.mesh.material and portalable_surfaces[surface.mesh.material.name]) then
if surface.accept_portals then
table.insert(static_to_portable_surface_mapping, #portal_surfaces)
table.insert(portal_surfaces, calculate_portal_single_surface(surface.mesh, surface.display_list))
else
@ -200,10 +194,6 @@ end
sk_definition_writer.add_definition("portal_surfaces", "struct PortalSurface[]", "_geo", portal_surfaces)
local function is_coplanar_portal_surface(quad, mesh, collision_bb)
if not mesh.material or not portalable_surfaces[mesh.material.name] then
return false
end
if not collision_export.is_coplanar(quad, mesh) then
return false
end
@ -229,7 +219,7 @@ for _, quad in pairs(collision_export.colliders) do
collision_with_padding.max = collision_with_padding.max + 0.1
for static_index, surface in pairs(static_export.static_nodes) do
if not surface.transform_index and is_coplanar_portal_surface(quad, surface.mesh, collision_with_padding) then
if not surface.transform_index and surface.accept_portals and is_coplanar_portal_surface(quad, surface.mesh, collision_with_padding) then
local portal_surface_index = static_to_portable_surface_mapping[static_index]
if portal_surface_index ~= -1 then

View file

@ -9,6 +9,12 @@ local animation = require('tools.level_scripts.animation')
sk_definition_writer.add_header('"../build/assets/materials/static.h"')
sk_definition_writer.add_header('"levels/level_definition.h"')
local portalable_surfaces = {
concrete_modular_wall001d = true,
concrete_modular_ceiling001a = true,
concrete_modular_floor001a = true,
}
local function proccessStaticNodes(nodes)
local result = {}
local bb_scale = sk_input.settings.fixed_point_scale
@ -49,7 +55,8 @@ local function proccessStaticNodes(nodes)
display_list = sk_definition_writer.raw(gfxName),
material_index = sk_definition_writer.raw(chunkV.material.macro_name),
transform_index = transform_index,
room_index = room_export.node_nearest_room_index(v.node) or 0
room_index = room_export.node_nearest_room_index(v.node) or 0,
accept_portals = chunkV.mesh.material and portalable_surfaces[chunkV.mesh.material.name] and not sk_scene.find_flag_argument(v.arguments, "no_portals"),
})
end
end