Skip to content

Commit

Permalink
light: Add support for LIGHTING_E5BGR9.
Browse files Browse the repository at this point in the history
This is not really finished. Currently mutually exclusive with
regular RGBLIGHTING, and not tested with external .lit file.
  • Loading branch information
dsvensson committed Apr 26, 2024
1 parent e61630d commit c61a853
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 49 deletions.
5 changes: 4 additions & 1 deletion include/light/light.hh
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ enum class lightfile
external = 1,
bspx = 2,
both = external | bspx,
lit2 = 4
lit2 = 4,
hdr = 8,
};

/* tracelist is a std::vector of pointers to modelinfo_t to use for LOS tests */
Expand Down Expand Up @@ -393,6 +394,8 @@ public:
setting_func bspxlux;
setting_func bspxonly;
setting_func bspx;
setting_func hdr;
setting_func bspxhdr;
setting_scalar world_units_per_luxel;
setting_bool litonly;
setting_bool nolights;
Expand Down
2 changes: 1 addition & 1 deletion include/light/write.hh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct facesup_t
twosided<uint16_t> extent;
};

void WriteLitFile(const mbsp_t *bsp, const std::vector<facesup_t> &facesup, const fs::path &filename, int version, const std::vector<uint8_t> &lit_filebase, const std::vector<uint8_t> &lux_filebase);
void WriteLitFile(const mbsp_t *bsp, const std::vector<facesup_t> &facesup, const fs::path &filename, int version, const std::vector<uint8_t> &lit_filebase, const std::vector<uint8_t> &lux_filebase, const std::vector<uint8_t> &hdr_filebase);
void WriteLuxFile(const mbsp_t *bsp, const fs::path &filename, int version, const std::vector<uint8_t> &lux_filebase);

void SaveLightmapSurfaces(bspdata_t *bspdata, const fs::path &source);
3 changes: 3 additions & 0 deletions light/light.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ light_settings::light_settings()
lux{this, "lux", [&](source) { write_luxfile |= lightfile::external; }, &experimental_group, "write .lux file"},
bspxlux{this, "bspxlux", [&](source) { write_luxfile |= lightfile::bspx; }, &experimental_group,
"writes lux data into the bsp itself"},
hdr{this, "hdr", [&](source) { write_litfile |= lightfile::external; write_litfile |= lightfile::hdr; }, &experimental_group, "write .lit file with e5bgr9 data"},
bspxhdr{this, "bspxhdr", [&](source) { write_litfile |= lightfile::bspx; write_litfile |= lightfile::hdr; }, &experimental_group,
"writes lux data into the bsp itself"},
bspxonly{this, "bspxonly",
[&](source source) {
write_litfile = lightfile::bspx;
Expand Down
8 changes: 0 additions & 8 deletions light/ltface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2453,14 +2453,6 @@ static void LightPoint_ScaleAndClamp(qvec3f &color)
c = pow(c / 255.0f, 1.0f / cfg.lightmapgamma.value()) * 255.0f;
}
}

// clamp
// FIXME: should this be a brightness clamp?
float maxcolor = qv::max(color);

if (maxcolor > 255.0f) {
color *= (255.0f / maxcolor);
}
}

static void LightPoint_ScaleAndClamp(lightgrid_samples_t &result)
Expand Down
Loading

0 comments on commit c61a853

Please sign in to comment.