light: fix minlight color on surface lights
- extra `* 255` was unnecessary, setting_color already does this - don't use qvec3b as it was causing colors to wrap around the 0..255 range
This commit is contained in:
parent
108d299482
commit
3d0c756b4f
|
|
@ -51,6 +51,6 @@ struct surfacelight_t
|
|||
|
||||
void ResetSurflight();
|
||||
std::vector<surfacelight_t> &GetSurfaceLights();
|
||||
std::optional<std::tuple<int32_t, int32_t, qvec3b>> IsSurfaceLitFace(const mbsp_t *bsp, const mface_t *face);
|
||||
std::optional<std::tuple<int32_t, int32_t, qvec3d>> IsSurfaceLitFace(const mbsp_t *bsp, const mface_t *face);
|
||||
const std::vector<int> &SurfaceLightsForFaceNum(int facenum);
|
||||
void MakeRadiositySurfaceLights(const settings::worldspawn_keys &cfg, const mbsp_t *bsp);
|
||||
|
|
|
|||
|
|
@ -147,20 +147,20 @@ static void MakeSurfaceLight(const mbsp_t *bsp, const settings::worldspawn_keys
|
|||
surfacelightsByFacenum[Face_GetNum(bsp, face)].push_back(index);
|
||||
}
|
||||
|
||||
std::optional<std::tuple<int32_t, int32_t, qvec3b>> IsSurfaceLitFace(const mbsp_t *bsp, const mface_t *face)
|
||||
std::optional<std::tuple<int32_t, int32_t, qvec3d>> IsSurfaceLitFace(const mbsp_t *bsp, const mface_t *face)
|
||||
{
|
||||
if (bsp->loadversion->game->id == GAME_QUAKE_II) {
|
||||
// first, check if it's a Q2 surface
|
||||
const mtexinfo_t *info = Face_Texinfo(bsp, face);
|
||||
|
||||
if (info != nullptr && (info->flags.native & Q2_SURF_LIGHT) && info->value > 0) {
|
||||
return std::make_tuple(info->value, 0, Face_LookupTextureColor(bsp, face));
|
||||
return std::make_tuple(info->value, 0, qvec3d(Face_LookupTextureColor(bsp, face)));
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &surflight : GetSurfaceLightTemplates()) {
|
||||
if (FaceMatchesSurfaceLightTemplate(bsp, face, ModelInfoForFace(bsp, face - bsp->dfaces.data()), *surflight, SURFLIGHT_RAD)) {
|
||||
return std::make_tuple(surflight->light.value(), surflight->style.value(), surflight->color.isChanged() ? qvec3b(surflight->color.value() * 255) : Face_LookupTextureColor(bsp, face));
|
||||
return std::make_tuple(surflight->light.value(), surflight->style.value(), surflight->color.isChanged() ? surflight->color.value() : qvec3d(Face_LookupTextureColor(bsp, face)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -452,4 +452,8 @@ TEST_CASE("surface lights minlight") {
|
|||
|
||||
auto *surflight = BSP_FindFaceAtPoint(&bsp, &bsp.dmodels[0], {-3264, -1664, -560});
|
||||
REQUIRE(surflight);
|
||||
|
||||
CheckFaceLuxels(bsp, *surflight, [](qvec3b sample) {
|
||||
CHECK(sample == qvec3b(255, 224, 214));
|
||||
}, &lit);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue