- rename classes and enums that used the _t typedef convention

This commit is contained in:
Magnus Norddahl 2018-11-09 21:55:07 +01:00
parent 75e18b10e1
commit 908c048464
10 changed files with 50 additions and 50 deletions

View file

@ -246,7 +246,7 @@ class BBox;
class Vec3;
class Vec2;
struct vertex_t;
struct surface_t;
struct Surface;
struct thingLight_t;
struct FloatVertex

View file

@ -36,6 +36,9 @@
#pragma warning(disable: 4244) // warning C4244: '=': conversion from '__int64' to 'int', possible loss of data
#endif
// convert from fixed point(FRACUNIT) to floating point
#define F(x) (((float)(x))/65536.0f)
static const Vec3 defaultSunColor(1, 1, 1);
static const Vec3 defaultSunDirection(0.45f, 0.3f, 0.9f);

View file

@ -126,7 +126,7 @@ bool LightmapBuilder::MakeRoomForBlock(const int width, const int height, int *x
return false;
}
BBox LightmapBuilder::GetBoundsFromSurface(const surface_t *surface)
BBox LightmapBuilder::GetBoundsFromSurface(const Surface *surface)
{
Vec3 low(M_INFINITY, M_INFINITY, M_INFINITY);
Vec3 hi(-M_INFINITY, -M_INFINITY, -M_INFINITY);
@ -156,7 +156,7 @@ BBox LightmapBuilder::GetBoundsFromSurface(const surface_t *surface)
}
// Traces to the ceiling surface. Will emit light if the surface that was traced is a sky
bool LightmapBuilder::EmitFromCeiling(const surface_t *surface, const Vec3 &origin, const Vec3 &normal, Vec3 &color)
bool LightmapBuilder::EmitFromCeiling(const Surface *surface, const Vec3 &origin, const Vec3 &normal, Vec3 &color)
{
float attenuation = surface ? normal.Dot(map->GetSunDirection()) : 1.0f;
@ -202,7 +202,7 @@ static float radians(float degrees)
}
// Traces a line from the texel's origin to the sunlight direction and against all nearby thing lights
Vec3 LightmapBuilder::LightTexelSample(const Vec3 &origin, surface_t *surface)
Vec3 LightmapBuilder::LightTexelSample(const Vec3 &origin, Surface *surface)
{
Plane plane;
if (surface)
@ -303,13 +303,13 @@ Vec3 LightmapBuilder::LightTexelSample(const Vec3 &origin, surface_t *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 LightmapBuilder::BuildSurfaceParams(surface_t *surface)
void LightmapBuilder::BuildSurfaceParams(Surface *surface)
{
Plane *plane;
BBox bounds;
Vec3 roundedSize;
int i;
Plane::planeAxis_t axis;
Plane::PlaneAxis axis;
Vec3 tCoords[2];
Vec3 tOrigin;
int width;
@ -399,7 +399,7 @@ void LightmapBuilder::BuildSurfaceParams(surface_t *surface)
// 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
void LightmapBuilder::TraceSurface(surface_t *surface)
void LightmapBuilder::TraceSurface(Surface *surface)
{
int sampleWidth;
int sampleHeight;
@ -561,7 +561,7 @@ static Vec3 ImportanceSampleGGX(Vec2 Xi, Vec3 N, float roughness)
return Vec3::Normalize(sampleVec);
}
void LightmapBuilder::TraceIndirectLight(surface_t *surface)
void LightmapBuilder::TraceIndirectLight(Surface *surface)
{
if (surface->lightmapNum == -1)
return;
@ -683,7 +683,7 @@ void LightmapBuilder::CreateLightSurfaces()
{
for (size_t j = 0; j < mesh->surfaces.size(); ++j)
{
surface_t *surface = mesh->surfaces[j].get();
Surface *surface = mesh->surfaces[j].get();
if (surface->type >= ST_MIDDLESIDE && surface->type <= ST_LOWERSIDE)
{

View file

@ -73,13 +73,13 @@ public:
private:
void NewTexture();
bool MakeRoomForBlock(const int width, const int height, int *x, int *y, int *num);
BBox GetBoundsFromSurface(const surface_t *surface);
Vec3 LightTexelSample(const Vec3 &origin, surface_t *surface);
bool EmitFromCeiling(const surface_t *surface, const Vec3 &origin, const Vec3 &normal, Vec3 &color);
BBox GetBoundsFromSurface(const Surface *surface);
Vec3 LightTexelSample(const Vec3 &origin, Surface *surface);
bool EmitFromCeiling(const Surface *surface, const Vec3 &origin, const Vec3 &normal, Vec3 &color);
void BuildSurfaceParams(surface_t *surface);
void TraceSurface(surface_t *surface);
void TraceIndirectLight(surface_t *surface);
void BuildSurfaceParams(Surface *surface);
void TraceSurface(Surface *surface);
void TraceIndirectLight(Surface *surface);
void SetupLightCellGrid();
void LightBlock(int blockid);
void LightSurfacex(const int surfid);

View file

@ -29,7 +29,7 @@
#include "level/level.h"
#include "lightsurface.h"
LightSurface::LightSurface(const surfaceLightDef &lightSurfaceDef, surface_t *surface)
LightSurface::LightSurface(const surfaceLightDef &lightSurfaceDef, Surface *surface)
{
this->intensity = lightSurfaceDef.intensity;
this->distance = lightSurfaceDef.distance;
@ -42,7 +42,7 @@ LightSurface::~LightSurface()
}
// Splits surface vertices into two groups while adding new ones caused by the split
void LightSurface::Clip(vertexBatch_t &points, const Vec3 &normal, float dist, vertexBatch_t *frontPoints, vertexBatch_t *backPoints)
void LightSurface::Clip(VertexBatch &points, const Vec3 &normal, float dist, VertexBatch *frontPoints, VertexBatch *backPoints)
{
std::vector<float> dists;
std::vector<char> sides;
@ -116,7 +116,7 @@ void LightSurface::Clip(vertexBatch_t &points, const Vec3 &normal, float dist, v
}
// Recursively divides the surface
bool LightSurface::SubdivideRecursion(vertexBatch_t &surfPoints, float divide, std::vector<std::unique_ptr<vertexBatch_t>> &points)
bool LightSurface::SubdivideRecursion(VertexBatch &surfPoints, float divide, std::vector<std::unique_ptr<VertexBatch>> &points)
{
BBox bounds;
Vec3 splitNormal;
@ -138,8 +138,8 @@ bool LightSurface::SubdivideRecursion(vertexBatch_t &surfPoints, float divide, s
dist = (bounds.max[i] + bounds.min[i]) * 0.5f;
auto frontPoints = std::make_unique<vertexBatch_t>();
auto backPoints = std::make_unique<vertexBatch_t>();
auto frontPoints = std::make_unique<VertexBatch>();
auto backPoints = std::make_unique<VertexBatch>();
// start clipping
Clip(surfPoints, splitNormal, dist, frontPoints.get(), backPoints.get());
@ -165,8 +165,8 @@ void LightSurface::Subdivide(const float divide)
{
if (surface->type == ST_CEILING || surface->type == ST_FLOOR)
{
std::vector<std::unique_ptr<vertexBatch_t>> points;
vertexBatch_t surfPoints;
std::vector<std::unique_ptr<VertexBatch>> points;
VertexBatch surfPoints;
for (int i = 0; i < surface->numVerts; ++i)
{
@ -179,7 +179,7 @@ void LightSurface::Subdivide(const float divide)
// creating a origin point based on the center of that group
for (size_t i = 0; i < points.size(); ++i)
{
vertexBatch_t *vb = points[i].get();
VertexBatch *vb = points[i].get();
Vec3 center;
for (unsigned int j = 0; j < vb->size(); ++j)
@ -234,7 +234,7 @@ void LightSurface::Subdivide(const float divide)
}
}
float LightSurface::TraceSurface(LevelMesh *mesh, const surface_t *fragmentSurface, const Vec3 &fragmentPos)
float LightSurface::TraceSurface(LevelMesh *mesh, const Surface *fragmentSurface, const Vec3 &fragmentPos)
{
if (fragmentSurface == surface)
return 1.0f; // light surface will always be fullbright

View file

@ -35,26 +35,26 @@ struct surfaceLightDef;
class LightSurface
{
public:
LightSurface(const surfaceLightDef &lightSurfaceDef, surface_t *surface);
LightSurface(const surfaceLightDef &lightSurfaceDef, Surface *surface);
~LightSurface();
void Subdivide(const float divide);
float TraceSurface(LevelMesh *map, const surface_t *surface, const Vec3 &origin);
float TraceSurface(LevelMesh *map, const Surface *surface, const Vec3 &origin);
const float Distance() const { return distance; }
const float Intensity() const { return intensity; }
const Vec3 GetRGB() const { return rgb; }
const surface_t *Surface() const { return surface; }
const Surface *GetSurface() const { return surface; }
private:
typedef std::vector<Vec3> vertexBatch_t;
typedef std::vector<Vec3> VertexBatch;
bool SubdivideRecursion(vertexBatch_t &surfPoints, float divide, std::vector<std::unique_ptr<vertexBatch_t>> &points);
void Clip(vertexBatch_t &points, const Vec3 &normal, float dist, vertexBatch_t *frontPoints, vertexBatch_t *backPoints);
bool SubdivideRecursion(VertexBatch &surfPoints, float divide, std::vector<std::unique_ptr<VertexBatch>> &points);
void Clip(VertexBatch &points, const Vec3 &normal, float dist, VertexBatch *frontPoints, VertexBatch *backPoints);
float distance;
float intensity;
Vec3 rgb;
vertexBatch_t origins;
surface_t *surface;
VertexBatch origins;
Surface *surface;
};

View file

@ -145,7 +145,7 @@ void LevelMesh::CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
if (bothSides)
continue;
auto surf = std::make_unique<surface_t>();
auto surf = std::make_unique<Surface>();
surf->type = ST_MIDDLESIDE;
surf->typeIndex = typeIndex;
surf->controlSector = xfloor;
@ -180,7 +180,7 @@ void LevelMesh::CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
{
if (side->bottomtexture[0] != '-')
{
auto surf = std::make_unique<surface_t>();
auto surf = std::make_unique<Surface>();
surf->numVerts = 4;
surf->verts.resize(4);
@ -221,7 +221,7 @@ void LevelMesh::CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
if (side->toptexture[0] != '-' || bSky)
{
auto surf = std::make_unique<surface_t>();
auto surf = std::make_unique<Surface>();
surf->numVerts = 4;
surf->verts.resize(4);
@ -252,7 +252,7 @@ void LevelMesh::CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
// middle seg
if (back == nullptr)
{
auto surf = std::make_unique<surface_t>();
auto surf = std::make_unique<Surface>();
surf->numVerts = 4;
surf->verts.resize(4);
@ -277,7 +277,7 @@ void LevelMesh::CreateSideSurfaces(FLevel &doomMap, IntSideDef *side)
void LevelMesh::CreateFloorSurface(FLevel &doomMap, MapSubsectorEx *sub, IntSector *sector, int typeIndex, bool is3DFloor)
{
auto surf = std::make_unique<surface_t>();
auto surf = std::make_unique<Surface>();
surf->numVerts = sub->numlines;
surf->verts.resize(surf->numVerts);
@ -309,7 +309,7 @@ void LevelMesh::CreateFloorSurface(FLevel &doomMap, MapSubsectorEx *sub, IntSect
void LevelMesh::CreateCeilingSurface(FLevel &doomMap, MapSubsectorEx *sub, IntSector *sector, int typeIndex, bool is3DFloor)
{
auto surf = std::make_unique<surface_t>();
auto surf = std::make_unique<Surface>();
surf->numVerts = sub->numlines;
surf->verts.resize(surf->numVerts);
surf->bSky = sector->skySector;
@ -427,7 +427,7 @@ void LevelMesh::WriteMeshToOBJ()
{
FILE *f = fopen("mesh.obj", "w");
std::map<int, std::vector<surface_t*>> sortedSurfs;
std::map<int, std::vector<Surface*>> sortedSurfs;
for (unsigned int i = 0; i < surfaces.size(); i++)
sortedSurfs[surfaces[i]->lightmapNum].push_back(surfaces[i].get());

View file

@ -38,7 +38,7 @@ struct IntSector;
struct IntSideDef;
struct FLevel;
enum surfaceType_t
enum SurfaceType
{
ST_UNKNOWN,
ST_MIDDLESIDE,
@ -48,10 +48,7 @@ enum surfaceType_t
ST_FLOOR
};
// convert from fixed point(FRACUNIT) to floating point
#define F(x) (((float)(x))/65536.0f)
struct surface_t
struct Surface
{
Plane plane;
int lightmapNum;
@ -64,7 +61,7 @@ struct surface_t
int numVerts;
std::vector<Vec3> verts;
std::vector<float> lightmapCoords;
surfaceType_t type;
SurfaceType type;
int typeIndex;
IntSector *controlSector;
bool bSky;
@ -76,7 +73,7 @@ struct LevelTraceHit
Vec3 end;
float fraction;
surface_t *hitSurface;
Surface *hitSurface;
int indices[3];
float b, c;
};
@ -91,7 +88,7 @@ public:
void WriteMeshToOBJ();
std::vector<std::unique_ptr<surface_t>> surfaces;
std::vector<std::unique_ptr<Surface>> surfaces;
TArray<Vec3> MeshVertices;
TArray<int> MeshUVIndex;

View file

@ -351,7 +351,7 @@ public:
Plane(const Vec3 &normal, const Vec3 &point);
Plane(const Plane &plane);
enum planeAxis_t
enum PlaneAxis
{
AXIS_YZ = 0,
AXIS_XZ,
@ -370,7 +370,7 @@ public:
Quat ToQuat();
const Vec4 &ToVec4() const;
Vec4 &ToVec4();
const planeAxis_t BestAxis() const;
const PlaneAxis BestAxis() const;
Vec3 GetInclination();
static Plane Inverse(const Plane &p) { return Plane(-p.a, -p.b, -p.c, -p.d); }

View file

@ -144,7 +144,7 @@ Vec4 &Plane::ToVec4()
return *reinterpret_cast<Vec4*>(&a);
}
const Plane::planeAxis_t Plane::BestAxis() const
const Plane::PlaneAxis Plane::BestAxis() const
{
float na = Math::Fabs(a);
float nb = Math::Fabs(b);