mirror of
https://github.com/ZDoom/ZDRay.git
synced 2025-02-03 13:11:04 +00:00
- Change dlight to consume FLevel data
This commit is contained in:
parent
0aa918dcea
commit
be1ada81a6
11 changed files with 433 additions and 73 deletions
|
@ -220,6 +220,20 @@ struct IntVertex
|
||||||
TArray<UDMFKey> props;
|
TArray<UDMFKey> props;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class kexBBox;
|
||||||
|
class kexVec3;
|
||||||
|
class kexVec2;
|
||||||
|
class kexLightSurface;
|
||||||
|
struct vertex_t;
|
||||||
|
struct surface_t;
|
||||||
|
struct thingLight_t;
|
||||||
|
|
||||||
|
struct leaf_t
|
||||||
|
{
|
||||||
|
vertex_t *vertex;
|
||||||
|
MapSegGLEx *seg;
|
||||||
|
};
|
||||||
|
|
||||||
struct FLevel
|
struct FLevel
|
||||||
{
|
{
|
||||||
FLevel ();
|
FLevel ();
|
||||||
|
@ -260,6 +274,42 @@ struct FLevel
|
||||||
int NumLines() const { return Lines.Size(); }
|
int NumLines() const { return Lines.Size(); }
|
||||||
int NumSectors() const { return Sectors.Size(); }
|
int NumSectors() const { return Sectors.Size(); }
|
||||||
int NumThings() const { return Things.Size(); }
|
int NumThings() const { return Things.Size(); }
|
||||||
|
|
||||||
|
// Dlight helpers
|
||||||
|
|
||||||
|
leaf_t *leafs;
|
||||||
|
uint8_t *mapPVS;
|
||||||
|
|
||||||
|
bool *bSkySectors;
|
||||||
|
bool *bSSectsVisibleToSky;
|
||||||
|
|
||||||
|
int numLeafs;
|
||||||
|
|
||||||
|
int *segLeafLookup;
|
||||||
|
int *ssLeafLookup;
|
||||||
|
int *ssLeafCount;
|
||||||
|
kexBBox *ssLeafBounds;
|
||||||
|
|
||||||
|
kexBBox *nodeBounds;
|
||||||
|
|
||||||
|
surface_t **segSurfaces[3];
|
||||||
|
surface_t **leafSurfaces[2];
|
||||||
|
|
||||||
|
TArray<thingLight_t*> thingLights;
|
||||||
|
TArray<kexLightSurface*> lightSurfaces;
|
||||||
|
|
||||||
|
const kexVec3 &GetSunColor() const;
|
||||||
|
const kexVec3 &GetSunDirection() const;
|
||||||
|
|
||||||
|
IntSideDef *GetSideDef(const MapSegGLEx *seg);
|
||||||
|
IntSector *GetFrontSector(const MapSegGLEx *seg);
|
||||||
|
IntSector *GetBackSector(const MapSegGLEx *seg);
|
||||||
|
IntSector *GetSectorFromSubSector(const MapSubsectorEx *sub);
|
||||||
|
MapSubsectorEx *PointInSubSector(const int x, const int y);
|
||||||
|
bool PointInsideSubSector(const float x, const float y, const MapSubsectorEx *sub);
|
||||||
|
bool LineIntersectSubSector(const kexVec3 &start, const kexVec3 &end, const MapSubsectorEx *sub, kexVec2 &out);
|
||||||
|
vertex_t *GetSegVertex(int index);
|
||||||
|
bool CheckPVS(MapSubsectorEx *s1, MapSubsectorEx *s2);
|
||||||
};
|
};
|
||||||
|
|
||||||
const int BLOCKSIZE = 128;
|
const int BLOCKSIZE = 128;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "lightmap.h"
|
#include "lightmap.h"
|
||||||
#include "worker.h"
|
#include "worker.h"
|
||||||
#include "kexlib/binFile.h"
|
#include "kexlib/binFile.h"
|
||||||
|
#include "wad.h"
|
||||||
|
|
||||||
//#define EXPORT_TEXELS_OBJ
|
//#define EXPORT_TEXELS_OBJ
|
||||||
|
|
||||||
|
@ -269,7 +270,7 @@ kexVec3 kexLightmapBuilder::LightTexelSample(kexTrace &trace, const kexVec3 &ori
|
||||||
color.Clear();
|
color.Clear();
|
||||||
|
|
||||||
// check all thing lights
|
// check all thing lights
|
||||||
for(unsigned int i = 0; i < map->thingLights.Length(); i++)
|
for(unsigned int i = 0; i < map->thingLights.Size(); i++)
|
||||||
{
|
{
|
||||||
thingLight_t *tl = map->thingLights[i];
|
thingLight_t *tl = map->thingLights[i];
|
||||||
|
|
||||||
|
@ -282,8 +283,8 @@ kexVec3 kexLightmapBuilder::LightTexelSample(kexTrace &trace, const kexVec3 &ori
|
||||||
lightOrigin.Set(tl->origin.x,
|
lightOrigin.Set(tl->origin.x,
|
||||||
tl->origin.y,
|
tl->origin.y,
|
||||||
!tl->bCeiling ?
|
!tl->bCeiling ?
|
||||||
tl->sector->floorheight + tl->height :
|
tl->sector->data.floorheight + tl->height :
|
||||||
tl->sector->ceilingheight - tl->height);
|
tl->sector->data.ceilingheight - tl->height);
|
||||||
|
|
||||||
if(plane.Distance(lightOrigin) - plane.d < 0)
|
if(plane.Distance(lightOrigin) - plane.d < 0)
|
||||||
{
|
{
|
||||||
|
@ -330,7 +331,7 @@ kexVec3 kexLightmapBuilder::LightTexelSample(kexTrace &trace, const kexVec3 &ori
|
||||||
tracedTexels++;
|
tracedTexels++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(surface->type != ST_CEILING && map->bSSectsVisibleToSky[surface->subSector - map->mapSSects])
|
if(surface->type != ST_CEILING && map->bSSectsVisibleToSky[surface->subSector - map->GLSubsectors])
|
||||||
{
|
{
|
||||||
// see if it's exposed to sunlight
|
// see if it's exposed to sunlight
|
||||||
if(EmitFromCeiling(trace, surface, origin, plane.Normal(), &dist))
|
if(EmitFromCeiling(trace, surface, origin, plane.Normal(), &dist))
|
||||||
|
@ -346,7 +347,7 @@ kexVec3 kexLightmapBuilder::LightTexelSample(kexTrace &trace, const kexVec3 &ori
|
||||||
}
|
}
|
||||||
|
|
||||||
// trace against surface lights
|
// trace against surface lights
|
||||||
for(unsigned int i = 0; i < map->lightSurfaces.Length(); ++i)
|
for(unsigned int i = 0; i < map->lightSurfaces.Size(); ++i)
|
||||||
{
|
{
|
||||||
kexLightSurface *surfaceLight = map->lightSurfaces[i];
|
kexLightSurface *surfaceLight = map->lightSurfaces[i];
|
||||||
|
|
||||||
|
@ -650,8 +651,7 @@ void kexLightmapBuilder::LightSurface(const int surfid)
|
||||||
// and against all nearby thing lights
|
// and against all nearby thing lights
|
||||||
//
|
//
|
||||||
|
|
||||||
kexVec3 kexLightmapBuilder::LightCellSample(const int gridid, kexTrace &trace,
|
kexVec3 kexLightmapBuilder::LightCellSample(const int gridid, kexTrace &trace, const kexVec3 &origin, const mapSubSector_t *sub)
|
||||||
const kexVec3 &origin, const mapSubSector_t *sub)
|
|
||||||
{
|
{
|
||||||
kexVec3 color;
|
kexVec3 color;
|
||||||
kexVec3 dir;
|
kexVec3 dir;
|
||||||
|
@ -666,14 +666,14 @@ kexVec3 kexLightmapBuilder::LightCellSample(const int gridid, kexTrace &trace,
|
||||||
kexVec3 org;
|
kexVec3 org;
|
||||||
|
|
||||||
mapSector = map->GetSectorFromSubSector(sub);
|
mapSector = map->GetSectorFromSubSector(sub);
|
||||||
bInSkySector = map->bSkySectors[mapSector - map->mapSectors];
|
bInSkySector = map->bSkySectors[mapSector - &map->Sectors[0]];
|
||||||
|
|
||||||
trace.Trace(origin, origin + (map->GetSunDirection() * 32768));
|
trace.Trace(origin, origin + (map->GetSunDirection() * 32768));
|
||||||
|
|
||||||
// did we traced a ceiling surface with a sky texture?
|
// did we traced a ceiling surface with a sky texture?
|
||||||
if(trace.fraction != 1 && trace.hitSurface != NULL)
|
if(trace.fraction != 1 && trace.hitSurface != NULL)
|
||||||
{
|
{
|
||||||
if(trace.hitSurface->bSky && origin.z + gridSize[2] > mapSector->floorheight)
|
if(trace.hitSurface->bSky && origin.z + gridSize[2] > mapSector->data.floorheight)
|
||||||
{
|
{
|
||||||
color = map->GetSunColor();
|
color = map->GetSunColor();
|
||||||
// this cell is inside a sector with a sky texture and is also exposed to sunlight.
|
// this cell is inside a sector with a sky texture and is also exposed to sunlight.
|
||||||
|
@ -698,15 +698,15 @@ kexVec3 kexLightmapBuilder::LightCellSample(const int gridid, kexTrace &trace,
|
||||||
}
|
}
|
||||||
|
|
||||||
// trace against all thing lights
|
// trace against all thing lights
|
||||||
for(unsigned int i = 0; i < map->thingLights.Length(); i++)
|
for(unsigned int i = 0; i < map->thingLights.Size(); i++)
|
||||||
{
|
{
|
||||||
tl = map->thingLights[i];
|
tl = map->thingLights[i];
|
||||||
|
|
||||||
lightOrigin.Set(tl->origin.x,
|
lightOrigin.Set(tl->origin.x,
|
||||||
tl->origin.y,
|
tl->origin.y,
|
||||||
!tl->bCeiling ?
|
!tl->bCeiling ?
|
||||||
(float)tl->sector->floorheight + 16 :
|
(float)tl->sector->data.floorheight + 16 :
|
||||||
(float)tl->sector->ceilingheight - 16);
|
(float)tl->sector->data.ceilingheight - 16);
|
||||||
|
|
||||||
radius = tl->radius;
|
radius = tl->radius;
|
||||||
intensity = tl->intensity * 4;
|
intensity = tl->intensity * 4;
|
||||||
|
@ -748,13 +748,13 @@ kexVec3 kexLightmapBuilder::LightCellSample(const int gridid, kexTrace &trace,
|
||||||
// if the cell is sticking out from the ground then at least
|
// if the cell is sticking out from the ground then at least
|
||||||
// clamp the origin to the ground level so it can at least
|
// clamp the origin to the ground level so it can at least
|
||||||
// have a chance to be sampled by the light
|
// have a chance to be sampled by the light
|
||||||
if(origin.z + gridSize[2] > mapSector->floorheight)
|
if(origin.z + gridSize[2] > mapSector->data.floorheight)
|
||||||
{
|
{
|
||||||
org.z = (float)mapSector->floorheight + 2;
|
org.z = (float)mapSector->data.floorheight + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// trace against all light surfaces
|
// trace against all light surfaces
|
||||||
for(unsigned int i = 0; i < map->lightSurfaces.Length(); ++i)
|
for(unsigned int i = 0; i < map->lightSurfaces.Size(); ++i)
|
||||||
{
|
{
|
||||||
kexLightSurface *surfaceLight = map->lightSurfaces[i];
|
kexLightSurface *surfaceLight = map->lightSurfaces[i];
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ void kexLightmapBuilder::LightGrid(const int gridid)
|
||||||
bInRange = false;
|
bInRange = false;
|
||||||
|
|
||||||
// is this cell even inside the world?
|
// is this cell even inside the world?
|
||||||
for(int i = 0; i < map->numSSects; ++i)
|
for(int i = 0; i < map->NumGLSubsectors; ++i)
|
||||||
{
|
{
|
||||||
if(bounds.IntersectingBox(map->ssLeafBounds[i]))
|
if(bounds.IntersectingBox(map->ssLeafBounds[i]))
|
||||||
{
|
{
|
||||||
|
@ -888,7 +888,7 @@ void kexLightmapBuilder::CreateLightGrid()
|
||||||
kexVec3 mins, maxs;
|
kexVec3 mins, maxs;
|
||||||
|
|
||||||
// get the bounding box of the root BSP node
|
// get the bounding box of the root BSP node
|
||||||
numNodes = map->numNodes-1;
|
numNodes = map->NumGLNodes-1;
|
||||||
if(numNodes < 0)
|
if(numNodes < 0)
|
||||||
{
|
{
|
||||||
numNodes = 0;
|
numNodes = 0;
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#define LIGHTMAP_MAX_SIZE 1024
|
#define LIGHTMAP_MAX_SIZE 1024
|
||||||
|
|
||||||
class kexTrace;
|
class kexTrace;
|
||||||
|
class kexWadFile;
|
||||||
|
|
||||||
class kexLightmapBuilder
|
class kexLightmapBuilder
|
||||||
{
|
{
|
||||||
|
|
|
@ -288,7 +288,7 @@ void kexLightSurface::Subdivide(const float divide)
|
||||||
// kexLightSurface::TraceSurface
|
// kexLightSurface::TraceSurface
|
||||||
//
|
//
|
||||||
|
|
||||||
bool kexLightSurface::TraceSurface(kexDoomMap *doomMap, kexTrace &trace, const surface_t *surf,
|
bool kexLightSurface::TraceSurface(FLevel *doomMap, kexTrace &trace, const surface_t *surf,
|
||||||
const kexVec3 &origin, float *dist)
|
const kexVec3 &origin, float *dist)
|
||||||
{
|
{
|
||||||
kexVec3 normal;
|
kexVec3 normal;
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct surfaceLightDef
|
||||||
kexVec3 rgb;
|
kexVec3 rgb;
|
||||||
};
|
};
|
||||||
|
|
||||||
class kexDoomMap;
|
struct FLevel;
|
||||||
class kexTrace;
|
class kexTrace;
|
||||||
|
|
||||||
class kexLightSurface
|
class kexLightSurface
|
||||||
|
@ -55,7 +55,7 @@ public:
|
||||||
void Init(const surfaceLightDef &lightSurfaceDef, surface_t *surface, const bool bWall, const bool bNoCenterPoint);
|
void Init(const surfaceLightDef &lightSurfaceDef, surface_t *surface, const bool bWall, const bool bNoCenterPoint);
|
||||||
void Subdivide(const float divide);
|
void Subdivide(const float divide);
|
||||||
void CreateCenterOrigin();
|
void CreateCenterOrigin();
|
||||||
bool TraceSurface(kexDoomMap *doomMap, kexTrace &trace, const surface_t *surface, const kexVec3 &origin, float *dist);
|
bool TraceSurface(FLevel *doomMap, kexTrace &trace, const surface_t *surface, const kexVec3 &origin, float *dist);
|
||||||
|
|
||||||
const float OuterCone() const { return outerCone; }
|
const float OuterCone() const { return outerCone; }
|
||||||
const float InnerCone() const { return innerCone; }
|
const float InnerCone() const { return innerCone; }
|
||||||
|
|
|
@ -36,6 +36,258 @@
|
||||||
#include "mapData.h"
|
#include "mapData.h"
|
||||||
#include "lightSurface.h"
|
#include "lightSurface.h"
|
||||||
|
|
||||||
|
static const kexVec3 defaultSunColor(1, 1, 1);
|
||||||
|
static const kexVec3 defaultSunDirection(0.45f, 0.3f, 0.9f);
|
||||||
|
|
||||||
|
const kexVec3 &FLevel::GetSunColor() const
|
||||||
|
{
|
||||||
|
/*if (mapDef != NULL)
|
||||||
|
{
|
||||||
|
return mapDef->sunColor;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return defaultSunColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
const kexVec3 &FLevel::GetSunDirection() const
|
||||||
|
{
|
||||||
|
/*if (mapDef != NULL)
|
||||||
|
{
|
||||||
|
return mapDef->sunDir;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return defaultSunDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntSideDef *FLevel::GetSideDef(const MapSegGLEx *seg)
|
||||||
|
{
|
||||||
|
if (seg->linedef == NO_LINE_INDEX)
|
||||||
|
{
|
||||||
|
// skip minisegs
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntLineDef *line = &Lines[seg->linedef];
|
||||||
|
return &Sides[line->sidenum[seg->side]];
|
||||||
|
}
|
||||||
|
|
||||||
|
IntSector *FLevel::GetFrontSector(const MapSegGLEx *seg)
|
||||||
|
{
|
||||||
|
IntSideDef *side = GetSideDef(seg);
|
||||||
|
|
||||||
|
if (side == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return &Sectors[side->sector];
|
||||||
|
}
|
||||||
|
|
||||||
|
IntSector *FLevel::GetBackSector(const MapSegGLEx *seg)
|
||||||
|
{
|
||||||
|
if (seg->linedef == NO_LINE_INDEX)
|
||||||
|
{
|
||||||
|
// skip minisegs
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntLineDef *line = &Lines[seg->linedef];
|
||||||
|
|
||||||
|
if (line->flags & ML_TWOSIDED)
|
||||||
|
{
|
||||||
|
mapSideDef_t *backSide = &Sides[line->sidenum[seg->side ^ 1]];
|
||||||
|
return &Sectors[backSide->sector];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntSector *FLevel::GetSectorFromSubSector(const MapSubsectorEx *sub)
|
||||||
|
{
|
||||||
|
mapSector_t *sector = NULL;
|
||||||
|
|
||||||
|
// try to find a sector that the subsector belongs to
|
||||||
|
for (int i = 0; i < (int)sub->numlines; i++)
|
||||||
|
{
|
||||||
|
glSeg_t *seg = &GLSegs[sub->firstline + i];
|
||||||
|
if (seg->side != NO_SIDE_INDEX)
|
||||||
|
{
|
||||||
|
sector = GetFrontSector(seg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sector;
|
||||||
|
}
|
||||||
|
|
||||||
|
MapSubsectorEx *FLevel::PointInSubSector(const int x, const int y)
|
||||||
|
{
|
||||||
|
MapNodeEx *node;
|
||||||
|
int side;
|
||||||
|
int nodenum;
|
||||||
|
kexVec3 dp1;
|
||||||
|
kexVec3 dp2;
|
||||||
|
float d;
|
||||||
|
|
||||||
|
// single subsector is a special case
|
||||||
|
if (!NumGLNodes)
|
||||||
|
{
|
||||||
|
return &GLSubsectors[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
nodenum = NumGLNodes - 1;
|
||||||
|
|
||||||
|
while (!(nodenum & NF_SUBSECTOR))
|
||||||
|
{
|
||||||
|
node = &GLNodes[nodenum];
|
||||||
|
|
||||||
|
kexVec3 pt1(F(node->x << 16), F(node->y << 16), 0);
|
||||||
|
kexVec3 pt2(F(node->dx << 16), F(node->dy << 16), 0);
|
||||||
|
kexVec3 pos(F(x << 16), F(y << 16), 0);
|
||||||
|
|
||||||
|
dp1 = pt1 - pos;
|
||||||
|
dp2 = (pt2 + pt1) - pos;
|
||||||
|
d = dp1.Cross(dp2).z;
|
||||||
|
|
||||||
|
side = FLOATSIGNBIT(d);
|
||||||
|
|
||||||
|
nodenum = node->children[side ^ 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return &GLSubsectors[nodenum & ~NF_SUBSECTOR];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FLevel::PointInsideSubSector(const float x, const float y, const MapSubsectorEx *sub)
|
||||||
|
{
|
||||||
|
surface_t *surf;
|
||||||
|
int i;
|
||||||
|
kexVec2 p(x, y);
|
||||||
|
kexVec2 dp1, dp2;
|
||||||
|
kexVec2 pt1, pt2;
|
||||||
|
|
||||||
|
surf = leafSurfaces[0][sub - GLSubsectors];
|
||||||
|
|
||||||
|
// check to see if the point is inside the subsector leaf
|
||||||
|
for (i = 0; i < surf->numVerts; i++)
|
||||||
|
{
|
||||||
|
pt1 = surf->verts[i].ToVec2();
|
||||||
|
pt2 = surf->verts[(i + 1) % surf->numVerts].ToVec2();
|
||||||
|
|
||||||
|
dp1 = pt1 - p;
|
||||||
|
dp2 = pt2 - p;
|
||||||
|
|
||||||
|
if (dp1.CrossScalar(dp2) < 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this point is outside the subsector leaf
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FLevel::LineIntersectSubSector(const kexVec3 &start, const kexVec3 &end, const MapSubsectorEx *sub, kexVec2 &out)
|
||||||
|
{
|
||||||
|
surface_t *surf;
|
||||||
|
kexVec2 p1, p2;
|
||||||
|
kexVec2 s1, s2;
|
||||||
|
kexVec2 pt;
|
||||||
|
kexVec2 v;
|
||||||
|
float d, u;
|
||||||
|
float newX;
|
||||||
|
float ab;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
surf = leafSurfaces[0][sub - GLSubsectors];
|
||||||
|
p1 = start.ToVec2();
|
||||||
|
p2 = end.ToVec2();
|
||||||
|
|
||||||
|
for (i = 0; i < surf->numVerts; i++)
|
||||||
|
{
|
||||||
|
s1 = surf->verts[i].ToVec2();
|
||||||
|
s2 = surf->verts[(i + 1) % surf->numVerts].ToVec2();
|
||||||
|
|
||||||
|
if ((p1 == p2) || (s1 == s2))
|
||||||
|
{
|
||||||
|
// zero length
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((p1 == s1) || (p2 == s1) || (p1 == s2) || (p2 == s2))
|
||||||
|
{
|
||||||
|
// shares end point
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// translate to origin
|
||||||
|
pt = p2 - p1;
|
||||||
|
s1 -= p1;
|
||||||
|
s2 -= p1;
|
||||||
|
|
||||||
|
// normalize
|
||||||
|
u = pt.UnitSq();
|
||||||
|
d = kexMath::InvSqrt(u);
|
||||||
|
v = (pt * d);
|
||||||
|
|
||||||
|
// rotate points s1 and s2 so they're on the positive x axis
|
||||||
|
newX = s1.Dot(v);
|
||||||
|
s1.y = s1.CrossScalar(v);
|
||||||
|
s1.x = newX;
|
||||||
|
|
||||||
|
newX = s2.Dot(v);
|
||||||
|
s2.y = s2.CrossScalar(v);
|
||||||
|
s2.x = newX;
|
||||||
|
|
||||||
|
if ((s1.y < 0 && s2.y < 0) || (s1.y >= 0 && s2.y >= 0))
|
||||||
|
{
|
||||||
|
// s1 and s2 didn't cross
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ab = s2.x + (s1.x - s2.x) * s2.y / (s2.y - s1.y);
|
||||||
|
|
||||||
|
if (ab < 0 || ab >(u * d))
|
||||||
|
{
|
||||||
|
// s1 and s2 crosses but outside of points p1 and p2
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// intersected
|
||||||
|
out = p1 + (v * ab);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
vertex_t *FLevel::GetSegVertex(int index)
|
||||||
|
{
|
||||||
|
if (index & 0x8000)
|
||||||
|
{
|
||||||
|
index = (index & 0x7FFF) + NumGLVertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
//return &GLVertices[index];
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FLevel::CheckPVS(MapSubsectorEx *s1, MapSubsectorEx *s2)
|
||||||
|
{
|
||||||
|
uint8_t *vis;
|
||||||
|
int n1, n2;
|
||||||
|
|
||||||
|
n1 = s1 - GLSubsectors;
|
||||||
|
n2 = s2 - GLSubsectors;
|
||||||
|
|
||||||
|
vis = &mapPVS[(((NumGLSubsectors + 7) / 8) * n1)];
|
||||||
|
|
||||||
|
return ((vis[n2 >> 3] & (1 << (n2 & 7))) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
const kexVec3 kexDoomMap::defaultSunColor(1, 1, 1);
|
const kexVec3 kexDoomMap::defaultSunColor(1, 1, 1);
|
||||||
const kexVec3 kexDoomMap::defaultSunDirection(0.45f, 0.3f, 0.9f);
|
const kexVec3 kexDoomMap::defaultSunDirection(0.45f, 0.3f, 0.9f);
|
||||||
|
|
||||||
|
@ -955,3 +1207,5 @@ void kexDoomMap::CleanupThingLights()
|
||||||
delete thingLights[i];
|
delete thingLights[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -27,6 +27,66 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "framework/zdray.h"
|
||||||
|
#include "level/level.h"
|
||||||
|
|
||||||
|
typedef FLevel kexDoomMap;
|
||||||
|
typedef MapSubsectorEx mapSubSector_t;
|
||||||
|
typedef MapSegGLEx glSeg_t;
|
||||||
|
typedef IntSideDef mapSideDef_t;
|
||||||
|
typedef IntSector mapSector_t;
|
||||||
|
|
||||||
|
enum mapFlags_t
|
||||||
|
{
|
||||||
|
ML_BLOCKING = 1, // Solid, is an obstacle.
|
||||||
|
ML_BLOCKMONSTERS = 2, // Blocks monsters only.
|
||||||
|
ML_TWOSIDED = 4, // Backside will not be present at all if not two sided.
|
||||||
|
ML_TRANSPARENT1 = 2048, // 25% or 75% transcluency?
|
||||||
|
ML_TRANSPARENT2 = 4096 // 25% or 75% transcluency?
|
||||||
|
};
|
||||||
|
|
||||||
|
#define NO_SIDE_INDEX -1
|
||||||
|
#define NO_LINE_INDEX 0xFFFF
|
||||||
|
#define NF_SUBSECTOR 0x8000
|
||||||
|
|
||||||
|
struct lightDef_t
|
||||||
|
{
|
||||||
|
int doomednum;
|
||||||
|
float height;
|
||||||
|
float radius;
|
||||||
|
float intensity;
|
||||||
|
float falloff;
|
||||||
|
bool bCeiling;
|
||||||
|
kexVec3 rgb;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct mapDef_t
|
||||||
|
{
|
||||||
|
int map;
|
||||||
|
int sunIgnoreTag;
|
||||||
|
kexVec3 sunDir;
|
||||||
|
kexVec3 sunColor;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct thingLight_t
|
||||||
|
{
|
||||||
|
IntThing *mapThing;
|
||||||
|
kexVec2 origin;
|
||||||
|
kexVec3 rgb;
|
||||||
|
float intensity;
|
||||||
|
float falloff;
|
||||||
|
float height;
|
||||||
|
float radius;
|
||||||
|
bool bCeiling;
|
||||||
|
mapSector_t *sector;
|
||||||
|
mapSubSector_t *ssect;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "surfaces.h"
|
||||||
|
#include "lightSurface.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
#include "wad.h"
|
#include "wad.h"
|
||||||
#include "surfaces.h"
|
#include "surfaces.h"
|
||||||
#include "lightSurface.h"
|
#include "lightSurface.h"
|
||||||
|
@ -270,3 +330,5 @@ private:
|
||||||
static const kexVec3 defaultSunColor;
|
static const kexVec3 defaultSunColor;
|
||||||
static const kexVec3 defaultSunDirection;
|
static const kexVec3 defaultSunDirection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "surfaces.h"
|
|
||||||
#include "mapData.h"
|
#include "mapData.h"
|
||||||
|
#include "surfaces.h"
|
||||||
|
|
||||||
//#define EXPORT_OBJ
|
//#define EXPORT_OBJ
|
||||||
|
|
||||||
|
@ -62,16 +62,16 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
|
||||||
front = doomMap.GetFrontSector(seg);
|
front = doomMap.GetFrontSector(seg);
|
||||||
back = doomMap.GetBackSector(seg);
|
back = doomMap.GetBackSector(seg);
|
||||||
|
|
||||||
top = front->ceilingheight;
|
top = front->data.ceilingheight;
|
||||||
bottom = front->floorheight;
|
bottom = front->data.floorheight;
|
||||||
|
|
||||||
v1 = doomMap.GetSegVertex(seg->v1);
|
v1 = doomMap.GetSegVertex(seg->v1);
|
||||||
v2 = doomMap.GetSegVertex(seg->v2);
|
v2 = doomMap.GetSegVertex(seg->v2);
|
||||||
|
|
||||||
if(back)
|
if(back)
|
||||||
{
|
{
|
||||||
bTop = back->ceilingheight;
|
bTop = back->data.ceilingheight;
|
||||||
bBottom = back->floorheight;
|
bBottom = back->data.floorheight;
|
||||||
|
|
||||||
if(bTop == top && bBottom == bottom)
|
if(bTop == top && bBottom == bottom)
|
||||||
{
|
{
|
||||||
|
@ -97,8 +97,8 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
|
||||||
surf->plane.SetNormal(surf->verts[0], surf->verts[1], surf->verts[2]);
|
surf->plane.SetNormal(surf->verts[0], surf->verts[1], surf->verts[2]);
|
||||||
surf->plane.SetDistance(surf->verts[0]);
|
surf->plane.SetDistance(surf->verts[0]);
|
||||||
surf->type = ST_LOWERSEG;
|
surf->type = ST_LOWERSEG;
|
||||||
surf->typeIndex = seg - doomMap.mapSegs;
|
surf->typeIndex = seg - doomMap.GLSegs;
|
||||||
surf->subSector = &doomMap.mapSSects[doomMap.segLeafLookup[seg - doomMap.mapSegs]];
|
surf->subSector = &doomMap.GLSubsectors[doomMap.segLeafLookup[seg - doomMap.GLSegs]];
|
||||||
|
|
||||||
doomMap.segSurfaces[1][surf->typeIndex] = surf;
|
doomMap.segSurfaces[1][surf->typeIndex] = surf;
|
||||||
surf->data = (glSeg_t*)seg;
|
surf->data = (glSeg_t*)seg;
|
||||||
|
@ -113,12 +113,12 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
|
||||||
if(top > bTop)
|
if(top > bTop)
|
||||||
{
|
{
|
||||||
bool bSky = false;
|
bool bSky = false;
|
||||||
int frontidx = front-doomMap.mapSectors;
|
int frontidx = front - &doomMap.Sectors[0];
|
||||||
int backidx = back-doomMap.mapSectors;
|
int backidx = back - &doomMap.Sectors[0];
|
||||||
|
|
||||||
if(doomMap.bSkySectors[frontidx] && doomMap.bSkySectors[backidx])
|
if(doomMap.bSkySectors[frontidx] && doomMap.bSkySectors[backidx])
|
||||||
{
|
{
|
||||||
if(front->ceilingheight != back->ceilingheight && side->toptexture[0] == '-')
|
if(front->data.ceilingheight != back->data.ceilingheight && side->toptexture[0] == '-')
|
||||||
{
|
{
|
||||||
bSky = true;
|
bSky = true;
|
||||||
}
|
}
|
||||||
|
@ -140,9 +140,9 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
|
||||||
surf->plane.SetNormal(surf->verts[0], surf->verts[1], surf->verts[2]);
|
surf->plane.SetNormal(surf->verts[0], surf->verts[1], surf->verts[2]);
|
||||||
surf->plane.SetDistance(surf->verts[0]);
|
surf->plane.SetDistance(surf->verts[0]);
|
||||||
surf->type = ST_UPPERSEG;
|
surf->type = ST_UPPERSEG;
|
||||||
surf->typeIndex = seg - doomMap.mapSegs;
|
surf->typeIndex = seg - doomMap.GLSegs;
|
||||||
surf->bSky = bSky;
|
surf->bSky = bSky;
|
||||||
surf->subSector = &doomMap.mapSSects[doomMap.segLeafLookup[seg - doomMap.mapSegs]];
|
surf->subSector = &doomMap.GLSubsectors[doomMap.segLeafLookup[seg - doomMap.GLSegs]];
|
||||||
|
|
||||||
doomMap.segSurfaces[2][surf->typeIndex] = surf;
|
doomMap.segSurfaces[2][surf->typeIndex] = surf;
|
||||||
surf->data = (glSeg_t*)seg;
|
surf->data = (glSeg_t*)seg;
|
||||||
|
@ -171,8 +171,8 @@ static void Surface_AllocateFromSeg(kexDoomMap &doomMap, glSeg_t *seg)
|
||||||
surf->plane.SetNormal(surf->verts[0], surf->verts[1], surf->verts[2]);
|
surf->plane.SetNormal(surf->verts[0], surf->verts[1], surf->verts[2]);
|
||||||
surf->plane.SetDistance(surf->verts[0]);
|
surf->plane.SetDistance(surf->verts[0]);
|
||||||
surf->type = ST_MIDDLESEG;
|
surf->type = ST_MIDDLESEG;
|
||||||
surf->typeIndex = seg - doomMap.mapSegs;
|
surf->typeIndex = seg - doomMap.GLSegs;
|
||||||
surf->subSector = &doomMap.mapSSects[doomMap.segLeafLookup[seg - doomMap.mapSegs]];
|
surf->subSector = &doomMap.GLSubsectors[doomMap.segLeafLookup[seg - doomMap.GLSegs]];
|
||||||
|
|
||||||
doomMap.segSurfaces[0][surf->typeIndex] = surf;
|
doomMap.segSurfaces[0][surf->typeIndex] = surf;
|
||||||
surf->data = (glSeg_t*)seg;
|
surf->data = (glSeg_t*)seg;
|
||||||
|
@ -198,21 +198,19 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
|
||||||
|
|
||||||
printf("------------- Building leaf surfaces -------------\n");
|
printf("------------- Building leaf surfaces -------------\n");
|
||||||
|
|
||||||
doomMap.leafSurfaces[0] = (surface_t**)Mem_Calloc(sizeof(surface_t*) *
|
doomMap.leafSurfaces[0] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSubsectors, hb_static);
|
||||||
doomMap.numSSects, hb_static);
|
doomMap.leafSurfaces[1] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSubsectors, hb_static);
|
||||||
doomMap.leafSurfaces[1] = (surface_t**)Mem_Calloc(sizeof(surface_t*) *
|
|
||||||
doomMap.numSSects, hb_static);
|
|
||||||
|
|
||||||
for(i = 0; i < doomMap.numSSects; i++)
|
for(i = 0; i < doomMap.NumGLSubsectors; i++)
|
||||||
{
|
{
|
||||||
printf("subsectors: %i / %i\r", i+1, doomMap.numSSects);
|
printf("subsectors: %i / %i\r", i+1, doomMap.NumGLSubsectors);
|
||||||
|
|
||||||
if(doomMap.ssLeafCount[i] < 3)
|
if(doomMap.ssLeafCount[i] < 3)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sector = doomMap.GetSectorFromSubSector(&doomMap.mapSSects[i]);
|
sector = doomMap.GetSectorFromSubSector(&doomMap.GLSubsectors[i]);
|
||||||
|
|
||||||
// I will be NOT surprised if some users tries to do something stupid with
|
// I will be NOT surprised if some users tries to do something stupid with
|
||||||
// sector hacks
|
// sector hacks
|
||||||
|
@ -225,7 +223,7 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
|
||||||
surf = (surface_t*)Mem_Calloc(sizeof(surface_t), hb_static);
|
surf = (surface_t*)Mem_Calloc(sizeof(surface_t), hb_static);
|
||||||
surf->numVerts = doomMap.ssLeafCount[i];
|
surf->numVerts = doomMap.ssLeafCount[i];
|
||||||
surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * surf->numVerts, hb_static);
|
surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * surf->numVerts, hb_static);
|
||||||
surf->subSector = &doomMap.mapSSects[i];
|
surf->subSector = &doomMap.GLSubsectors[i];
|
||||||
|
|
||||||
// floor verts
|
// floor verts
|
||||||
for(j = 0; j < surf->numVerts; j++)
|
for(j = 0; j < surf->numVerts; j++)
|
||||||
|
@ -234,7 +232,7 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
|
||||||
|
|
||||||
surf->verts[j].x = leaf->vertex->x;
|
surf->verts[j].x = leaf->vertex->x;
|
||||||
surf->verts[j].y = leaf->vertex->y;
|
surf->verts[j].y = leaf->vertex->y;
|
||||||
surf->verts[j].z = sector->floorheight;
|
surf->verts[j].z = sector->data.floorheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
surf->plane.SetNormal(kexVec3(0, 0, 1));
|
surf->plane.SetNormal(kexVec3(0, 0, 1));
|
||||||
|
@ -250,9 +248,9 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
|
||||||
surf = (surface_t*)Mem_Calloc(sizeof(surface_t), hb_static);
|
surf = (surface_t*)Mem_Calloc(sizeof(surface_t), hb_static);
|
||||||
surf->numVerts = doomMap.ssLeafCount[i];
|
surf->numVerts = doomMap.ssLeafCount[i];
|
||||||
surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * surf->numVerts, hb_static);
|
surf->verts = (kexVec3*)Mem_Calloc(sizeof(kexVec3) * surf->numVerts, hb_static);
|
||||||
surf->subSector = &doomMap.mapSSects[i];
|
surf->subSector = &doomMap.GLSubsectors[i];
|
||||||
|
|
||||||
if(doomMap.bSkySectors[sector-doomMap.mapSectors])
|
if(doomMap.bSkySectors[sector-&doomMap.Sectors[0]])
|
||||||
{
|
{
|
||||||
surf->bSky = true;
|
surf->bSky = true;
|
||||||
}
|
}
|
||||||
|
@ -264,7 +262,7 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
|
||||||
|
|
||||||
surf->verts[j].x = leaf->vertex->x;
|
surf->verts[j].x = leaf->vertex->x;
|
||||||
surf->verts[j].y = leaf->vertex->y;
|
surf->verts[j].y = leaf->vertex->y;
|
||||||
surf->verts[j].z = sector->ceilingheight;
|
surf->verts[j].z = sector->data.ceilingheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
surf->plane.SetNormal(kexVec3(0, 0, -1));
|
surf->plane.SetNormal(kexVec3(0, 0, -1));
|
||||||
|
@ -278,7 +276,7 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
|
||||||
surfaces.Push(surf);
|
surfaces.Push(surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nLeaf surfaces: %i\n", surfaces.Length() - doomMap.numSSects);
|
printf("\nLeaf surfaces: %i\n", surfaces.Length() - doomMap.NumGLSubsectors);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -287,19 +285,16 @@ static void Surface_AllocateFromLeaf(kexDoomMap &doomMap)
|
||||||
|
|
||||||
void Surface_AllocateFromMap(kexDoomMap &doomMap)
|
void Surface_AllocateFromMap(kexDoomMap &doomMap)
|
||||||
{
|
{
|
||||||
doomMap.segSurfaces[0] = (surface_t**)Mem_Calloc(sizeof(surface_t*) *
|
doomMap.segSurfaces[0] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static);
|
||||||
doomMap.numSegs, hb_static);
|
doomMap.segSurfaces[1] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static);
|
||||||
doomMap.segSurfaces[1] = (surface_t**)Mem_Calloc(sizeof(surface_t*) *
|
doomMap.segSurfaces[2] = (surface_t**)Mem_Calloc(sizeof(surface_t*) * doomMap.NumGLSegs, hb_static);
|
||||||
doomMap.numSegs, hb_static);
|
|
||||||
doomMap.segSurfaces[2] = (surface_t**)Mem_Calloc(sizeof(surface_t*) *
|
|
||||||
doomMap.numSegs, hb_static);
|
|
||||||
|
|
||||||
printf("------------- Building seg surfaces -------------\n");
|
printf("------------- Building seg surfaces -------------\n");
|
||||||
|
|
||||||
for(int i = 0; i < doomMap.numSegs; i++)
|
for(int i = 0; i < doomMap.NumGLSegs; i++)
|
||||||
{
|
{
|
||||||
Surface_AllocateFromSeg(doomMap, &doomMap.mapSegs[i]);
|
Surface_AllocateFromSeg(doomMap, &doomMap.GLSegs[i]);
|
||||||
printf("segs: %i / %i\r", i+1, doomMap.numSegs);
|
printf("segs: %i / %i\r", i+1, doomMap.NumGLSegs);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nSeg surfaces: %i\n", surfaces.Length());
|
printf("\nSeg surfaces: %i\n", surfaces.Length());
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
struct mapSubSector_t;
|
struct MapSubsectorEx;
|
||||||
|
|
||||||
enum surfaceType_t
|
enum surfaceType_t
|
||||||
{
|
{
|
||||||
|
@ -61,12 +61,11 @@ struct surface_t
|
||||||
int typeIndex;
|
int typeIndex;
|
||||||
void *data;
|
void *data;
|
||||||
bool bSky;
|
bool bSky;
|
||||||
mapSubSector_t *subSector;
|
MapSubsectorEx *subSector;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern kexArray<surface_t*> surfaces;
|
extern kexArray<surface_t*> surfaces;
|
||||||
|
|
||||||
class kexDoomMap;
|
struct FLevel;
|
||||||
class kexWadFile;
|
|
||||||
|
|
||||||
void Surface_AllocateFromMap(kexDoomMap &doomMap);
|
void Surface_AllocateFromMap(FLevel &doomMap);
|
||||||
|
|
|
@ -80,7 +80,7 @@ void kexTrace::Trace(const kexVec3 &startVec, const kexVec3 &endVec)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceBSPNode(map->numNodes - 1);
|
TraceBSPNode(map->NumGLNodes - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -201,7 +201,7 @@ void kexTrace::TraceSubSector(int num)
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
sub = &map->mapSSects[num];
|
sub = &map->GLSubsectors[num];
|
||||||
|
|
||||||
if(!map->ssLeafBounds[num].LineIntersect(start, end))
|
if(!map->ssLeafBounds[num].LineIntersect(start, end))
|
||||||
{
|
{
|
||||||
|
@ -209,18 +209,17 @@ void kexTrace::TraceSubSector(int num)
|
||||||
}
|
}
|
||||||
|
|
||||||
// test line segments
|
// test line segments
|
||||||
for(i = 0; i < sub->numsegs; i++)
|
for(i = 0; i < (int)sub->numlines; i++)
|
||||||
{
|
{
|
||||||
int segnum = sub->firstseg + i;
|
int segnum = sub->firstline + i;
|
||||||
|
|
||||||
for(j = 0; j < 3; j++)
|
for(j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
if(j == 0)
|
if(j == 0)
|
||||||
{
|
{
|
||||||
int linenum = map->mapSegs[segnum].linedef;
|
int linenum = map->GLSegs[segnum].linedef;
|
||||||
|
|
||||||
if(linenum != NO_LINE_INDEX && map->mapLines[linenum].flags &
|
if(linenum != NO_LINE_INDEX && map->Lines[linenum].flags & (ML_TWOSIDED|ML_TRANSPARENT1|ML_TRANSPARENT2))
|
||||||
(ML_TWOSIDED|ML_TRANSPARENT1|ML_TRANSPARENT2))
|
|
||||||
{
|
{
|
||||||
// don't trace transparent 2-sided lines
|
// don't trace transparent 2-sided lines
|
||||||
continue;
|
continue;
|
||||||
|
@ -243,7 +242,7 @@ void kexTrace::TraceSubSector(int num)
|
||||||
|
|
||||||
void kexTrace::TraceBSPNode(int num)
|
void kexTrace::TraceBSPNode(int num)
|
||||||
{
|
{
|
||||||
mapNode_t *node;
|
MapNodeEx *node;
|
||||||
kexVec3 dp1;
|
kexVec3 dp1;
|
||||||
kexVec3 dp2;
|
kexVec3 dp2;
|
||||||
float d;
|
float d;
|
||||||
|
@ -260,7 +259,7 @@ void kexTrace::TraceBSPNode(int num)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = &map->nodes[num];
|
node = &map->GLNodes[num];
|
||||||
|
|
||||||
kexVec3 pt1(F(node->x << 16), F(node->y << 16), 0);
|
kexVec3 pt1(F(node->x << 16), F(node->y << 16), 0);
|
||||||
kexVec3 pt2(F(node->dx << 16), F(node->dy << 16), 0);
|
kexVec3 pt2(F(node->dx << 16), F(node->dy << 16), 0);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class kexDoomMap;
|
struct FLevel;
|
||||||
|
|
||||||
class kexTrace
|
class kexTrace
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ public:
|
||||||
kexTrace();
|
kexTrace();
|
||||||
~kexTrace();
|
~kexTrace();
|
||||||
|
|
||||||
void Init(kexDoomMap &doomMap);
|
void Init(FLevel &doomMap);
|
||||||
void Trace(const kexVec3 &startVec, const kexVec3 &endVec);
|
void Trace(const kexVec3 &startVec, const kexVec3 &endVec);
|
||||||
|
|
||||||
kexVec3 start;
|
kexVec3 start;
|
||||||
|
@ -51,6 +51,6 @@ private:
|
||||||
void TraceSubSector(int num);
|
void TraceSubSector(int num);
|
||||||
void TraceSurface(surface_t *surface);
|
void TraceSurface(surface_t *surface);
|
||||||
|
|
||||||
kexDoomMap *map;
|
FLevel *map;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue