- remove some junk

This commit is contained in:
Magnus Norddahl 2018-11-02 23:03:57 +01:00
parent 7efc998f6e
commit 8eee053896
2 changed files with 12 additions and 108 deletions

View file

@ -46,10 +46,6 @@ extern int Multisample;
const kexVec3 kexLightmapBuilder::gridSize(64, 64, 128); const kexVec3 kexLightmapBuilder::gridSize(64, 64, 128);
//
// kexLightmapBuilder::kexLightmapBuilder
//
kexLightmapBuilder::kexLightmapBuilder() kexLightmapBuilder::kexLightmapBuilder()
{ {
this->textureWidth = 128; this->textureWidth = 128;
@ -62,20 +58,10 @@ kexLightmapBuilder::kexLightmapBuilder()
this->tracedTexels = 0; this->tracedTexels = 0;
} }
//
// kexLightmapBuilder::~kexLightmapBuilder
//
kexLightmapBuilder::~kexLightmapBuilder() kexLightmapBuilder::~kexLightmapBuilder()
{ {
} }
//
// kexLightmapBuilder::NewTexture
//
// Allocates a new texture pointer
//
void kexLightmapBuilder::NewTexture() void kexLightmapBuilder::NewTexture()
{ {
numTextures++; numTextures++;
@ -89,15 +75,8 @@ void kexLightmapBuilder::NewTexture()
textures.Push(texture); textures.Push(texture);
} }
// // Determines where to map a new block on to the lightmap texture
// kexLightMapBuilder::MakeRoomForBlock bool kexLightmapBuilder::MakeRoomForBlock(const int width, const int height, int *x, int *y, int *num)
//
// Determines where to map a new block on to
// the lightmap texture
//
bool kexLightmapBuilder::MakeRoomForBlock(const int width, const int height,
int *x, int *y, int *num)
{ {
int i; int i;
int j; int j;
@ -160,10 +139,6 @@ bool kexLightmapBuilder::MakeRoomForBlock(const int width, const int height,
return false; return false;
} }
//
// kexLightmapBuilder::GetBoundsFromSurface
//
kexBBox kexLightmapBuilder::GetBoundsFromSurface(const surface_t *surface) kexBBox kexLightmapBuilder::GetBoundsFromSurface(const surface_t *surface)
{ {
kexVec3 low(M_INFINITY, M_INFINITY, M_INFINITY); kexVec3 low(M_INFINITY, M_INFINITY, M_INFINITY);
@ -193,13 +168,7 @@ kexBBox kexLightmapBuilder::GetBoundsFromSurface(const surface_t *surface)
return bounds; return bounds;
} }
// // Traces to the ceiling surface. Will emit light if the surface that was traced is a sky
// kexLightmapBuilder::EmitFromCeiling
//
// Traces to the ceiling surface. Will emit
// light if the surface that was traced is a sky
//
bool kexLightmapBuilder::EmitFromCeiling(kexTrace &trace, const surface_t *surface, const kexVec3 &origin, const kexVec3 &normal, kexVec3 &color) bool kexLightmapBuilder::EmitFromCeiling(kexTrace &trace, const surface_t *surface, const kexVec3 &origin, const kexVec3 &normal, kexVec3 &color)
{ {
float attenuation = normal.Dot(map->GetSunDirection()); float attenuation = normal.Dot(map->GetSunDirection());
@ -233,13 +202,6 @@ bool kexLightmapBuilder::EmitFromCeiling(kexTrace &trace, const surface_t *surfa
return true; return true;
} }
//
// kexLightmapBuilder::LightTexelSample
//
// Traces a line from the texel's origin to the sunlight direction
// and against all nearby thing lights
//
template<class T> template<class T>
T smoothstep(const T edge0, const T edge1, const T x) T smoothstep(const T edge0, const T edge1, const T x)
{ {
@ -252,6 +214,7 @@ static float radians(float degrees)
return degrees * 3.14159265359f / 180.0f; return degrees * 3.14159265359f / 180.0f;
} }
// Traces a line from the texel's origin to the sunlight direction and against all nearby thing lights
kexVec3 kexLightmapBuilder::LightTexelSample(kexTrace &trace, const kexVec3 &origin, surface_t *surface) kexVec3 kexLightmapBuilder::LightTexelSample(kexTrace &trace, const kexVec3 &origin, surface_t *surface)
{ {
kexPlane plane = surface->plane; kexPlane plane = surface->plane;
@ -350,15 +313,8 @@ kexVec3 kexLightmapBuilder::LightTexelSample(kexTrace &trace, const kexVec3 &ori
return color; return color;
} }
// // Determines a lightmap block in which to map to the lightmap texture.
// kexLightmapBuilder::BuildSurfaceParams // Width and height of the block is calcuated and steps are computed to determine where each texel will be positioned on the surface
//
// Determines a lightmap block in which to map to
// the lightmap texture. Width and height of the block
// is calcuated and steps are computed to determine where
// each texel will be positioned on the surface
//
void kexLightmapBuilder::BuildSurfaceParams(surface_t *surface) void kexLightmapBuilder::BuildSurfaceParams(surface_t *surface)
{ {
kexPlane *plane; kexPlane *plane;
@ -454,14 +410,8 @@ void kexLightmapBuilder::BuildSurfaceParams(surface_t *surface)
surface->lightmapSteps[1] = tCoords[1] * (float)samples; surface->lightmapSteps[1] = tCoords[1] * (float)samples;
} }
//
// kexLightmapBuilder::TraceSurface
//
// Steps through each texel and traces a line to the world. // Steps through each texel and traces a line to the world.
// For each non-occluded trace, color is accumulated and saved off // For each non-occluded trace, color is accumulated and saved off into the lightmap texture based on what block is mapped to
// into the lightmap texture based on what block is mapped to
//
void kexLightmapBuilder::TraceSurface(surface_t *surface) void kexLightmapBuilder::TraceSurface(surface_t *surface)
{ {
static thread_local kexVec3 colorSamples[1024 * 1024]; static thread_local kexVec3 colorSamples[1024 * 1024];
@ -596,10 +546,6 @@ void kexLightmapBuilder::TraceSurface(surface_t *surface)
} }
} }
//
// kexLightmapBuilder::LightSurface
//
void kexLightmapBuilder::LightSurface(const int surfid) void kexLightmapBuilder::LightSurface(const int surfid)
{ {
float remaining; float remaining;

View file

@ -37,30 +37,15 @@
#include "trace.h" #include "trace.h"
#include "lightsurface.h" #include "lightsurface.h"
//
// kexLightSurface::kexLightSurface
//
kexLightSurface::kexLightSurface() kexLightSurface::kexLightSurface()
{ {
} }
//
// kexLightSurface::~kexLightSurface
//
kexLightSurface::~kexLightSurface() kexLightSurface::~kexLightSurface()
{ {
} }
// void kexLightSurface::Init(const surfaceLightDef &lightSurfaceDef, surface_t *surface, const bool bWall, const bool bNoCenterPoint)
// kexLightSurface::Init
//
void kexLightSurface::Init(const surfaceLightDef &lightSurfaceDef,
surface_t *surface,
const bool bWall,
const bool bNoCenterPoint)
{ {
this->intensity = lightSurfaceDef.intensity; this->intensity = lightSurfaceDef.intensity;
this->distance = lightSurfaceDef.distance; this->distance = lightSurfaceDef.distance;
@ -70,13 +55,7 @@ void kexLightSurface::Init(const surfaceLightDef &lightSurfaceDef,
this->bNoCenterPoint = bNoCenterPoint; this->bNoCenterPoint = bNoCenterPoint;
} }
// // Creates a single origin point if we're not intending on subdividing this light surface
// kexLightSurface::CreateCenterOrigin
//
// Creates a single origin point if we're not
// intending on subdividing this light surface
//
void kexLightSurface::CreateCenterOrigin() void kexLightSurface::CreateCenterOrigin()
{ {
if(!bWall) if(!bWall)
@ -98,15 +77,8 @@ void kexLightSurface::CreateCenterOrigin()
} }
} }
// // Splits surface vertices into two groups while adding new ones caused by the split
// kexLightSurface::Clip void kexLightSurface::Clip(vertexBatch_t &points, const kexVec3 &normal, float dist, vertexBatch_t *frontPoints, vertexBatch_t *backPoints)
//
// Splits surface vertices into two groups while adding new ones
// caused by the split
//
void kexLightSurface::Clip(vertexBatch_t &points, const kexVec3 &normal, float dist,
vertexBatch_t *frontPoints, vertexBatch_t *backPoints)
{ {
kexArray<float> dists; kexArray<float> dists;
kexArray<char> sides; kexArray<char> sides;
@ -179,14 +151,8 @@ void kexLightSurface::Clip(vertexBatch_t &points, const kexVec3 &normal, float d
} }
} }
//
// kexLightSurface::SubdivideRecursion
//
// Recursively divides the surface // Recursively divides the surface
// bool kexLightSurface::SubdivideRecursion(vertexBatch_t &surfPoints, float divide, kexArray<vertexBatch_t*> &points)
bool kexLightSurface::SubdivideRecursion(vertexBatch_t &surfPoints, float divide,
kexArray<vertexBatch_t*> &points)
{ {
kexBBox bounds; kexBBox bounds;
kexVec3 splitNormal; kexVec3 splitNormal;
@ -241,10 +207,6 @@ bool kexLightSurface::SubdivideRecursion(vertexBatch_t &surfPoints, float divide
return false; return false;
} }
//
// kexLightSurface::Subdivide
//
void kexLightSurface::Subdivide(const float divide) void kexLightSurface::Subdivide(const float divide)
{ {
kexArray<vertexBatch_t*> points; kexArray<vertexBatch_t*> points;
@ -281,10 +243,6 @@ void kexLightSurface::Subdivide(const float divide)
} }
} }
//
// kexLightSurface::TraceSurface
//
bool kexLightSurface::TraceSurface(FLevel *doomMap, kexTrace &trace, const surface_t *surf, const kexVec3 &origin, float *dist) bool kexLightSurface::TraceSurface(FLevel *doomMap, kexTrace &trace, const surface_t *surf, const kexVec3 &origin, float *dist)
{ {
kexVec3 normal; kexVec3 normal;