light: fix unwanted phong on everything

This commit is contained in:
Eric Wasylishen 2016-07-29 19:48:28 -06:00
parent d7bb75ae97
commit 225a155efd
2 changed files with 16 additions and 2 deletions

View File

@ -626,6 +626,9 @@ public:
class modelinfo_t {
private:
static constexpr float DEFAULT_PHONG_ANGLE = 89.0f;
public:
const dmodel_t *model;
float lightmapscale;
@ -637,6 +640,17 @@ public:
lockable_vec3_t minlight_color;
settingsdict_t settings;
float getResolvedPhongAngle() const {
const float s = phong_angle.floatValue();
if (s != 0) {
return s;
}
if (phong.boolValue()) {
return DEFAULT_PHONG_ANGLE;
}
return 0;
}
public:
modelinfo_t(const dmodel_t *m, float lmscale) :
model { m },
@ -647,7 +661,7 @@ public:
shadowself { "shadowself", 0 },
dirt { "dirt", 0 },
phong { "phong", 0 },
phong_angle { "phong_angle", 89 },
phong_angle { "phong_angle", 0 },
minlight_exclude { "minlight_exclude", "" },
minlight_color { "minlight_color", 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 },
settings {{

View File

@ -590,7 +590,7 @@ CalcualateVertexNormals(const bsp2_t *bsp)
// support on func_detail/func_group
for (int i=0; i<bsp->nummodels; i++) {
const modelinfo_t *info = modelinfo.at(i);
const uint8_t phongangle_byte = (uint8_t) qmax(0, qmin(255, (int)rint(info->phong_angle.floatValue())));
const uint8_t phongangle_byte = (uint8_t) qmax(0, qmin(255, (int)rint(info->getResolvedPhongAngle())));
if (!phongangle_byte)
continue;