mirror of
https://github.com/ZDoom/ZDRay.git
synced 2025-02-03 21:21:02 +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.y = ((lightcolor >> 8) & 0xff) / 255.0f;
|
||||||
desc.rgb.z = (lightcolor & 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->Subdivide(16);
|
||||||
//lightSurface->CreateCenterOrigin();
|
//lightSurface->CreateCenterOrigin();
|
||||||
lightSurfaces.push_back(std::move(lightSurface));
|
lightSurfaces.push_back(std::move(lightSurface));
|
||||||
|
@ -338,7 +338,7 @@ void FLevel::CreateLights()
|
||||||
desc.rgb.y = ((lightcolor >> 8) & 0xff) / 255.0f;
|
desc.rgb.y = ((lightcolor >> 8) & 0xff) / 255.0f;
|
||||||
desc.rgb.z = (lightcolor & 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);
|
lightSurface->Subdivide(16);
|
||||||
lightSurfaces.push_back(std::move(lightSurface));
|
lightSurfaces.push_back(std::move(lightSurface));
|
||||||
numSurfLights++;
|
numSurfLights++;
|
||||||
|
|
|
@ -36,13 +36,12 @@
|
||||||
#include "level/level.h"
|
#include "level/level.h"
|
||||||
#include "lightsurface.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->intensity = lightSurfaceDef.intensity;
|
||||||
this->distance = lightSurfaceDef.distance;
|
this->distance = lightSurfaceDef.distance;
|
||||||
this->rgb = lightSurfaceDef.rgb;
|
this->rgb = lightSurfaceDef.rgb;
|
||||||
this->surface = surface;
|
this->surface = surface;
|
||||||
this->bWall = bWall;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kexLightSurface::~kexLightSurface()
|
kexLightSurface::~kexLightSurface()
|
||||||
|
@ -52,7 +51,7 @@ kexLightSurface::~kexLightSurface()
|
||||||
// Creates a single origin point if we're not intending on subdividing this light surface
|
// Creates a single origin point if we're not intending on subdividing this light surface
|
||||||
void kexLightSurface::CreateCenterOrigin()
|
void kexLightSurface::CreateCenterOrigin()
|
||||||
{
|
{
|
||||||
if (!bWall)
|
if (surface->type == ST_CEILING || surface->type == ST_FLOOR)
|
||||||
{
|
{
|
||||||
kexVec3 center;
|
kexVec3 center;
|
||||||
|
|
||||||
|
@ -254,7 +253,7 @@ float kexLightSurface::TraceSurface(FLevel *map, const surface_t *surf, const ke
|
||||||
{
|
{
|
||||||
kexVec3 center = origins[i];
|
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
|
// origin is not going to seen or traced by the light surface
|
||||||
// so don't even bother. this also fixes some bizzare light
|
// 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)
|
if (attenuation <= 0.0f)
|
||||||
continue; // not even facing the light surface
|
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)
|
if (origin.z >= surface->verts[0].z && origin.z <= surface->verts[2].z)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct surfaceLightDef;
|
||||||
class kexLightSurface
|
class kexLightSurface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
kexLightSurface(const surfaceLightDef &lightSurfaceDef, surface_t *surface, const bool bWall);
|
kexLightSurface(const surfaceLightDef &lightSurfaceDef, surface_t *surface);
|
||||||
~kexLightSurface();
|
~kexLightSurface();
|
||||||
|
|
||||||
void Subdivide(const float divide);
|
void Subdivide(const float divide);
|
||||||
|
@ -45,7 +45,6 @@ public:
|
||||||
const float Distance() const { return distance; }
|
const float Distance() const { return distance; }
|
||||||
const float Intensity() const { return intensity; }
|
const float Intensity() const { return intensity; }
|
||||||
const kexVec3 GetRGB() const { return rgb; }
|
const kexVec3 GetRGB() const { return rgb; }
|
||||||
const bool IsAWall() const { return bWall; }
|
|
||||||
const surface_t *Surface() const { return surface; }
|
const surface_t *Surface() const { return surface; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -57,7 +56,6 @@ private:
|
||||||
float distance;
|
float distance;
|
||||||
float intensity;
|
float intensity;
|
||||||
kexVec3 rgb;
|
kexVec3 rgb;
|
||||||
bool bWall;
|
|
||||||
vertexBatch_t origins;
|
vertexBatch_t origins;
|
||||||
surface_t *surface;
|
surface_t *surface;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue