mirror of
https://github.com/ZDoom/ZDRay.git
synced 2024-11-12 23:54:27 +00:00
- fix floor light surfaces not working
This commit is contained in:
parent
58f2411002
commit
e046e7a508
3 changed files with 7 additions and 10 deletions
|
@ -275,7 +275,7 @@ void FLevel::CreateLights()
|
|||
desc.rgb.y = ((lightcolor >> 8) & 0xff) / 255.0f;
|
||||
desc.rgb.z = (lightcolor & 0xff) / 255.0f;
|
||||
|
||||
auto lightSurface = std::make_unique<kexLightSurface>(desc, surface, true);
|
||||
auto lightSurface = std::make_unique<kexLightSurface>(desc, surface);
|
||||
lightSurface->Subdivide(16);
|
||||
//lightSurface->CreateCenterOrigin();
|
||||
lightSurfaces.push_back(std::move(lightSurface));
|
||||
|
@ -338,7 +338,7 @@ void FLevel::CreateLights()
|
|||
desc.rgb.y = ((lightcolor >> 8) & 0xff) / 255.0f;
|
||||
desc.rgb.z = (lightcolor & 0xff) / 255.0f;
|
||||
|
||||
auto lightSurface = std::make_unique<kexLightSurface>(desc, surface, false);
|
||||
auto lightSurface = std::make_unique<kexLightSurface>(desc, surface);
|
||||
lightSurface->Subdivide(16);
|
||||
lightSurfaces.push_back(std::move(lightSurface));
|
||||
numSurfLights++;
|
||||
|
|
|
@ -36,13 +36,12 @@
|
|||
#include "level/level.h"
|
||||
#include "lightsurface.h"
|
||||
|
||||
kexLightSurface::kexLightSurface(const surfaceLightDef &lightSurfaceDef, surface_t *surface, const bool bWall)
|
||||
kexLightSurface::kexLightSurface(const surfaceLightDef &lightSurfaceDef, surface_t *surface)
|
||||
{
|
||||
this->intensity = lightSurfaceDef.intensity;
|
||||
this->distance = lightSurfaceDef.distance;
|
||||
this->rgb = lightSurfaceDef.rgb;
|
||||
this->surface = surface;
|
||||
this->bWall = bWall;
|
||||
}
|
||||
|
||||
kexLightSurface::~kexLightSurface()
|
||||
|
@ -52,7 +51,7 @@ kexLightSurface::~kexLightSurface()
|
|||
// Creates a single origin point if we're not intending on subdividing this light surface
|
||||
void kexLightSurface::CreateCenterOrigin()
|
||||
{
|
||||
if (!bWall)
|
||||
if (surface->type == ST_CEILING || surface->type == ST_FLOOR)
|
||||
{
|
||||
kexVec3 center;
|
||||
|
||||
|
@ -254,7 +253,7 @@ float kexLightSurface::TraceSurface(FLevel *map, const surface_t *surf, const ke
|
|||
{
|
||||
kexVec3 center = origins[i];
|
||||
|
||||
if (!bWall && origin.z > center.z)
|
||||
if ((surface->type == ST_CEILING && origin.z > center.z) || (surface->type == ST_FLOOR && origin.z < center.z))
|
||||
{
|
||||
// origin is not going to seen or traced by the light surface
|
||||
// so don't even bother. this also fixes some bizzare light
|
||||
|
@ -276,7 +275,7 @@ float kexLightSurface::TraceSurface(FLevel *map, const surface_t *surf, const ke
|
|||
if (attenuation <= 0.0f)
|
||||
continue; // not even facing the light surface
|
||||
|
||||
if (bWall)
|
||||
if (surface->type != ST_CEILING && surface->type != ST_FLOOR)
|
||||
{
|
||||
if (origin.z >= surface->verts[0].z && origin.z <= surface->verts[2].z)
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ struct surfaceLightDef;
|
|||
class kexLightSurface
|
||||
{
|
||||
public:
|
||||
kexLightSurface(const surfaceLightDef &lightSurfaceDef, surface_t *surface, const bool bWall);
|
||||
kexLightSurface(const surfaceLightDef &lightSurfaceDef, surface_t *surface);
|
||||
~kexLightSurface();
|
||||
|
||||
void Subdivide(const float divide);
|
||||
|
@ -45,7 +45,6 @@ public:
|
|||
const float Distance() const { return distance; }
|
||||
const float Intensity() const { return intensity; }
|
||||
const kexVec3 GetRGB() const { return rgb; }
|
||||
const bool IsAWall() const { return bWall; }
|
||||
const surface_t *Surface() const { return surface; }
|
||||
|
||||
private:
|
||||
|
@ -57,7 +56,6 @@ private:
|
|||
float distance;
|
||||
float intensity;
|
||||
kexVec3 rgb;
|
||||
bool bWall;
|
||||
vertexBatch_t origins;
|
||||
surface_t *surface;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue