mirror of
https://github.com/ZDoom/ZDRay.git
synced 2024-11-12 23:54:27 +00:00
Minor file structure cleanup
This commit is contained in:
parent
8b26826cee
commit
4cb0f59f66
9 changed files with 93 additions and 82 deletions
|
@ -124,27 +124,46 @@ set( SOURCES
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/commandline/getopt.c
|
src/commandline/getopt.c
|
||||||
src/commandline/getopt1.c
|
src/commandline/getopt1.c
|
||||||
|
src/commandline/getopt.h
|
||||||
src/framework/halffloat.cpp
|
src/framework/halffloat.cpp
|
||||||
src/framework/binfile.cpp
|
src/framework/binfile.cpp
|
||||||
src/framework/zstring.cpp
|
src/framework/zstring.cpp
|
||||||
src/framework/zstrformat.cpp
|
src/framework/zstrformat.cpp
|
||||||
src/framework/utf8.cpp
|
src/framework/utf8.cpp
|
||||||
src/framework/utf8.h
|
src/framework/utf8.h
|
||||||
|
src/framework/tarray.h
|
||||||
|
src/framework/templates.h
|
||||||
|
src/framework/zdray.h
|
||||||
|
src/framework/xs_Float.h
|
||||||
|
src/framework/halffloat.h
|
||||||
|
src/framework/binfile.h
|
||||||
src/blockmapbuilder/blockmapbuilder.cpp
|
src/blockmapbuilder/blockmapbuilder.cpp
|
||||||
|
src/blockmapbuilder/blockmapbuilder.h
|
||||||
src/level/level.cpp
|
src/level/level.cpp
|
||||||
src/level/level_udmf.cpp
|
src/level/level_udmf.cpp
|
||||||
src/level/level_light.cpp
|
src/level/level_light.cpp
|
||||||
|
src/level/doomdata.h
|
||||||
|
src/level/level.h
|
||||||
|
src/level/workdata.h
|
||||||
src/parse/sc_man.cpp
|
src/parse/sc_man.cpp
|
||||||
|
src/parse/sc_man.h
|
||||||
src/wad/wad.cpp
|
src/wad/wad.cpp
|
||||||
|
src/wad/wad.h
|
||||||
src/nodebuilder/nodebuild.cpp
|
src/nodebuilder/nodebuild.cpp
|
||||||
src/nodebuilder/nodebuild_events.cpp
|
src/nodebuilder/nodebuild_events.cpp
|
||||||
src/nodebuilder/nodebuild_extract.cpp
|
src/nodebuilder/nodebuild_extract.cpp
|
||||||
src/nodebuilder/nodebuild_gl.cpp
|
src/nodebuilder/nodebuild_gl.cpp
|
||||||
src/nodebuilder/nodebuild_utility.cpp
|
src/nodebuilder/nodebuild_utility.cpp
|
||||||
src/nodebuilder/nodebuild_classify_nosse2.cpp
|
src/nodebuilder/nodebuild_classify_nosse2.cpp
|
||||||
|
src/nodebuilder/nodebuild.h
|
||||||
src/lightmap/pngwriter.cpp
|
src/lightmap/pngwriter.cpp
|
||||||
src/lightmap/surfaces.cpp
|
src/lightmap/pngwriter.h
|
||||||
|
src/lightmap/levelmesh.cpp
|
||||||
|
src/lightmap/levelmesh.h
|
||||||
|
src/lightmap/lightmaptexture.cpp
|
||||||
|
src/lightmap/lightmaptexture.h
|
||||||
src/lightmap/collision.cpp
|
src/lightmap/collision.cpp
|
||||||
|
src/lightmap/collision.h
|
||||||
src/lightmap/delauneytriangulator.cpp
|
src/lightmap/delauneytriangulator.cpp
|
||||||
src/lightmap/delauneytriangulator.h
|
src/lightmap/delauneytriangulator.h
|
||||||
src/lightmap/vulkandevice.cpp
|
src/lightmap/vulkandevice.cpp
|
||||||
|
@ -171,6 +190,10 @@ set( SOURCES
|
||||||
src/math/angle.cpp
|
src/math/angle.cpp
|
||||||
src/math/bounds.cpp
|
src/math/bounds.cpp
|
||||||
src/math/mathlib.cpp
|
src/math/mathlib.cpp
|
||||||
|
src/math/mat.h
|
||||||
|
src/math/quaternion.h
|
||||||
|
src/math/vec.h
|
||||||
|
src/math/mathlib.h
|
||||||
src/models/model.cpp
|
src/models/model.cpp
|
||||||
src/models/model.h
|
src/models/model.h
|
||||||
src/models/model_md2.h
|
src/models/model_md2.h
|
||||||
|
@ -183,31 +206,7 @@ set( SOURCES
|
||||||
src/models/models_obj.cpp
|
src/models/models_obj.cpp
|
||||||
src/models/models_ue1.cpp
|
src/models/models_ue1.cpp
|
||||||
src/models/tab_anorms.h
|
src/models/tab_anorms.h
|
||||||
)
|
|
||||||
|
|
||||||
set( HEADERS
|
|
||||||
src/commandline/getopt.h
|
|
||||||
src/blockmapbuilder/blockmapbuilder.h
|
|
||||||
src/nodebuilder/nodebuild.h
|
|
||||||
src/level/doomdata.h
|
|
||||||
src/level/level.h
|
|
||||||
src/level/workdata.h
|
|
||||||
src/parse/sc_man.h
|
|
||||||
src/wad/wad.h
|
|
||||||
src/platform/windows/resource.h
|
src/platform/windows/resource.h
|
||||||
src/framework/tarray.h
|
|
||||||
src/framework/templates.h
|
|
||||||
src/framework/zdray.h
|
|
||||||
src/framework/xs_Float.h
|
|
||||||
src/framework/halffloat.h
|
|
||||||
src/framework/binfile.h
|
|
||||||
src/lightmap/pngwriter.h
|
|
||||||
src/lightmap/surfaces.h
|
|
||||||
src/lightmap/collision.h
|
|
||||||
src/math/mat.h
|
|
||||||
src/math/quaternion.h
|
|
||||||
src/math/vec.h
|
|
||||||
src/math/mathlib.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(THIRDPARTY_SOURCES
|
set(THIRDPARTY_SOURCES
|
||||||
|
@ -412,7 +411,7 @@ set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${REL_C_FLAGS}" )
|
||||||
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${REL_C_FLAGS}" )
|
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${REL_C_FLAGS}" )
|
||||||
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEB_C_FLAGS} -D_DEBUG" )
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEB_C_FLAGS} -D_DEBUG" )
|
||||||
|
|
||||||
add_executable( zdray ${SOURCES} ${HEADERS} ${THIRDPARTY_SOURCES} )
|
add_executable( zdray ${SOURCES} ${THIRDPARTY_SOURCES} )
|
||||||
target_link_libraries( zdray ${ZDRAY_LIBS} ${PROF_LIB} ${PLATFORM_LIB} )
|
target_link_libraries( zdray ${ZDRAY_LIBS} ${PROF_LIB} ${PLATFORM_LIB} )
|
||||||
include_directories( src "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty" )
|
include_directories( src "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty" )
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "framework/tarray.h"
|
#include "framework/tarray.h"
|
||||||
#include "nodebuilder/nodebuild.h"
|
#include "nodebuilder/nodebuild.h"
|
||||||
#include "blockmapbuilder/blockmapbuilder.h"
|
#include "blockmapbuilder/blockmapbuilder.h"
|
||||||
#include "lightmap/surfaces.h"
|
#include "lightmap/levelmesh.h"
|
||||||
#include <miniz/miniz.h>
|
#include <miniz/miniz.h>
|
||||||
|
|
||||||
#define DEFINE_SPECIAL(name, num, min, max, map) name = num,
|
#define DEFINE_SPECIAL(name, num, min, max, map) name = num,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
#include "math/mathlib.h"
|
#include "math/mathlib.h"
|
||||||
#include "surfaces.h"
|
#include "levelmesh.h"
|
||||||
#include "level/level.h"
|
#include "level/level.h"
|
||||||
#include "cpuraytracer.h"
|
#include "cpuraytracer.h"
|
||||||
#include "framework/binfile.h"
|
#include "framework/binfile.h"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include "collision.h"
|
||||||
|
|
||||||
class LevelMesh;
|
class LevelMesh;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
#include "math/mathlib.h"
|
#include "math/mathlib.h"
|
||||||
#include "surfaces.h"
|
#include "levelmesh.h"
|
||||||
#include "level/level.h"
|
#include "level/level.h"
|
||||||
#include "gpuraytracer.h"
|
#include "gpuraytracer.h"
|
||||||
#include "framework/binfile.h"
|
#include "framework/binfile.h"
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "framework/halffloat.h"
|
#include "framework/halffloat.h"
|
||||||
#include "framework/binfile.h"
|
#include "framework/binfile.h"
|
||||||
#include "level/level.h"
|
#include "level/level.h"
|
||||||
#include "surfaces.h"
|
#include "levelmesh.h"
|
||||||
#include "pngwriter.h"
|
#include "pngwriter.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
#include "framework/tarray.h"
|
#include "framework/tarray.h"
|
||||||
#include "framework/halffloat.h"
|
#include "framework/halffloat.h"
|
||||||
#include "lightmap/collision.h"
|
#include "lightmaptexture.h"
|
||||||
|
|
||||||
struct MapSubsectorEx;
|
struct MapSubsectorEx;
|
||||||
struct IntSector;
|
struct IntSector;
|
||||||
|
@ -75,57 +75,6 @@ struct Surface
|
||||||
std::string material;
|
std::string material;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LightmapTexture
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LightmapTexture(int width, int height) : textureWidth(width), textureHeight(height)
|
|
||||||
{
|
|
||||||
#ifdef _DEBUG
|
|
||||||
mPixels.resize(width * height * 3, floatToHalf(0.5f));
|
|
||||||
#else
|
|
||||||
mPixels.resize(width * height * 3, 0);
|
|
||||||
#endif
|
|
||||||
allocBlocks.resize(width);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MakeRoomForBlock(const int width, const int height, int* x, int* y)
|
|
||||||
{
|
|
||||||
int startY = 0;
|
|
||||||
int startX = 0;
|
|
||||||
for (int i = 0; i < textureHeight; i++)
|
|
||||||
{
|
|
||||||
startX = std::max(startX, allocBlocks[i]);
|
|
||||||
int available = textureWidth - startX;
|
|
||||||
if (available < width)
|
|
||||||
{
|
|
||||||
startY = i + 1;
|
|
||||||
startX = 0;
|
|
||||||
}
|
|
||||||
else if (i - startY + 1 == height)
|
|
||||||
{
|
|
||||||
for (int yy = 0; yy < height; yy++)
|
|
||||||
{
|
|
||||||
allocBlocks[startY + yy] = startX + width;
|
|
||||||
}
|
|
||||||
*x = startX;
|
|
||||||
*y = startY;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Width() const { return textureWidth; }
|
|
||||||
int Height() const { return textureHeight; }
|
|
||||||
uint16_t* Pixels() { return mPixels.data(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int textureWidth;
|
|
||||||
int textureHeight;
|
|
||||||
std::vector<uint16_t> mPixels;
|
|
||||||
std::vector<int> allocBlocks;
|
|
||||||
};
|
|
||||||
|
|
||||||
class LightProbeSample
|
class LightProbeSample
|
||||||
{
|
{
|
||||||
public:
|
public:
|
40
src/lightmap/lightmaptexture.cpp
Normal file
40
src/lightmap/lightmaptexture.cpp
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
#include "lightmaptexture.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
LightmapTexture::LightmapTexture(int width, int height) : textureWidth(width), textureHeight(height)
|
||||||
|
{
|
||||||
|
#ifdef _DEBUG
|
||||||
|
mPixels.resize(width * height * 3, floatToHalf(0.5f));
|
||||||
|
#else
|
||||||
|
mPixels.resize(width * height * 3, 0);
|
||||||
|
#endif
|
||||||
|
allocBlocks.resize(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LightmapTexture::MakeRoomForBlock(const int width, const int height, int* x, int* y)
|
||||||
|
{
|
||||||
|
int startY = 0;
|
||||||
|
int startX = 0;
|
||||||
|
for (int i = 0; i < textureHeight; i++)
|
||||||
|
{
|
||||||
|
startX = std::max(startX, allocBlocks[i]);
|
||||||
|
int available = textureWidth - startX;
|
||||||
|
if (available < width)
|
||||||
|
{
|
||||||
|
startY = i + 1;
|
||||||
|
startX = 0;
|
||||||
|
}
|
||||||
|
else if (i - startY + 1 == height)
|
||||||
|
{
|
||||||
|
for (int yy = 0; yy < height; yy++)
|
||||||
|
{
|
||||||
|
allocBlocks[startY + yy] = startX + width;
|
||||||
|
}
|
||||||
|
*x = startX;
|
||||||
|
*y = startY;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
22
src/lightmap/lightmaptexture.h
Normal file
22
src/lightmap/lightmaptexture.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class LightmapTexture
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LightmapTexture(int width, int height);
|
||||||
|
|
||||||
|
bool MakeRoomForBlock(const int width, const int height, int* x, int* y);
|
||||||
|
|
||||||
|
int Width() const { return textureWidth; }
|
||||||
|
int Height() const { return textureHeight; }
|
||||||
|
uint16_t* Pixels() { return mPixels.data(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
int textureWidth;
|
||||||
|
int textureHeight;
|
||||||
|
std::vector<uint16_t> mPixels;
|
||||||
|
std::vector<int> allocBlocks;
|
||||||
|
};
|
Loading…
Reference in a new issue