From 8eee053896747b6052de4c7966c7950d81471cfd Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 2 Nov 2018 23:03:57 +0100 Subject: [PATCH] - remove some junk --- src/lightmap/lightmap.cpp | 68 ++++------------------------------- src/lightmap/lightsurface.cpp | 52 +++------------------------ 2 files changed, 12 insertions(+), 108 deletions(-) diff --git a/src/lightmap/lightmap.cpp b/src/lightmap/lightmap.cpp index 180343f..7e1788f 100644 --- a/src/lightmap/lightmap.cpp +++ b/src/lightmap/lightmap.cpp @@ -46,10 +46,6 @@ extern int Multisample; const kexVec3 kexLightmapBuilder::gridSize(64, 64, 128); -// -// kexLightmapBuilder::kexLightmapBuilder -// - kexLightmapBuilder::kexLightmapBuilder() { this->textureWidth = 128; @@ -62,20 +58,10 @@ kexLightmapBuilder::kexLightmapBuilder() this->tracedTexels = 0; } -// -// kexLightmapBuilder::~kexLightmapBuilder -// - kexLightmapBuilder::~kexLightmapBuilder() { } -// -// kexLightmapBuilder::NewTexture -// -// Allocates a new texture pointer -// - void kexLightmapBuilder::NewTexture() { numTextures++; @@ -89,15 +75,8 @@ void kexLightmapBuilder::NewTexture() textures.Push(texture); } -// -// kexLightMapBuilder::MakeRoomForBlock -// -// 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) +// 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 j; @@ -160,10 +139,6 @@ bool kexLightmapBuilder::MakeRoomForBlock(const int width, const int height, return false; } -// -// kexLightmapBuilder::GetBoundsFromSurface -// - kexBBox kexLightmapBuilder::GetBoundsFromSurface(const surface_t *surface) { kexVec3 low(M_INFINITY, M_INFINITY, M_INFINITY); @@ -193,13 +168,7 @@ kexBBox kexLightmapBuilder::GetBoundsFromSurface(const surface_t *surface) return bounds; } -// -// kexLightmapBuilder::EmitFromCeiling -// -// Traces to the ceiling surface. Will emit -// light if the surface that was traced is a sky -// - +// 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) { float attenuation = normal.Dot(map->GetSunDirection()); @@ -233,13 +202,6 @@ bool kexLightmapBuilder::EmitFromCeiling(kexTrace &trace, const surface_t *surfa return true; } -// -// kexLightmapBuilder::LightTexelSample -// -// Traces a line from the texel's origin to the sunlight direction -// and against all nearby thing lights -// - template 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; } +// 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) { kexPlane plane = surface->plane; @@ -350,15 +313,8 @@ kexVec3 kexLightmapBuilder::LightTexelSample(kexTrace &trace, const kexVec3 &ori return color; } -// -// kexLightmapBuilder::BuildSurfaceParams -// -// 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 -// - +// 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) { kexPlane *plane; @@ -454,14 +410,8 @@ void kexLightmapBuilder::BuildSurfaceParams(surface_t *surface) surface->lightmapSteps[1] = tCoords[1] * (float)samples; } -// -// kexLightmapBuilder::TraceSurface -// // Steps through each texel and traces a line to the world. -// For each non-occluded trace, color is accumulated and saved off -// into the lightmap texture based on what block is mapped to -// - +// For each non-occluded trace, color is accumulated and saved off into the lightmap texture based on what block is mapped to void kexLightmapBuilder::TraceSurface(surface_t *surface) { 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) { float remaining; diff --git a/src/lightmap/lightsurface.cpp b/src/lightmap/lightsurface.cpp index c889d49..e66d3a2 100644 --- a/src/lightmap/lightsurface.cpp +++ b/src/lightmap/lightsurface.cpp @@ -37,30 +37,15 @@ #include "trace.h" #include "lightsurface.h" -// -// kexLightSurface::kexLightSurface -// - kexLightSurface::kexLightSurface() { } -// -// kexLightSurface::~kexLightSurface -// - kexLightSurface::~kexLightSurface() { } -// -// kexLightSurface::Init -// - -void kexLightSurface::Init(const surfaceLightDef &lightSurfaceDef, - surface_t *surface, - const bool bWall, - const bool bNoCenterPoint) +void kexLightSurface::Init(const surfaceLightDef &lightSurfaceDef, surface_t *surface, const bool bWall, const bool bNoCenterPoint) { this->intensity = lightSurfaceDef.intensity; this->distance = lightSurfaceDef.distance; @@ -70,13 +55,7 @@ void kexLightSurface::Init(const surfaceLightDef &lightSurfaceDef, this->bNoCenterPoint = bNoCenterPoint; } -// -// kexLightSurface::CreateCenterOrigin -// -// 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() { if(!bWall) @@ -98,15 +77,8 @@ void kexLightSurface::CreateCenterOrigin() } } -// -// kexLightSurface::Clip -// -// 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) +// 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 dists; kexArray sides; @@ -179,14 +151,8 @@ void kexLightSurface::Clip(vertexBatch_t &points, const kexVec3 &normal, float d } } -// -// kexLightSurface::SubdivideRecursion -// // Recursively divides the surface -// - -bool kexLightSurface::SubdivideRecursion(vertexBatch_t &surfPoints, float divide, - kexArray &points) +bool kexLightSurface::SubdivideRecursion(vertexBatch_t &surfPoints, float divide, kexArray &points) { kexBBox bounds; kexVec3 splitNormal; @@ -241,10 +207,6 @@ bool kexLightSurface::SubdivideRecursion(vertexBatch_t &surfPoints, float divide return false; } -// -// kexLightSurface::Subdivide -// - void kexLightSurface::Subdivide(const float divide) { kexArray 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) { kexVec3 normal;