mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- moved the files
This commit is contained in:
parent
dd524b046e
commit
fc0d673935
5 changed files with 321 additions and 4 deletions
|
@ -792,7 +792,7 @@ set( NOT_COMPILED_SOURCE_FILES
|
|||
)
|
||||
|
||||
# This is disabled for now because I cannot find a way to give the .pch file a different name.
|
||||
# Visual C++ 2015 seems hell-bent of only allowing one .pch file with the same name as the executable.
|
||||
# Visual C++ 2015 seems hell-bent on only allowing one .pch file with the same name as the executable.
|
||||
#enable_precompiled_headers( g_pch2.h FASTMATH_PCH_SOURCES )
|
||||
|
||||
# Enable fast math for some sources
|
||||
|
@ -816,7 +816,6 @@ set( FASTMATH_SOURCES
|
|||
gl/scene/gl_decal.cpp
|
||||
gl/scene/gl_drawinfo.cpp
|
||||
gl/scene/gl_flats.cpp
|
||||
gl/scene/gl_walls.cpp
|
||||
gl/scene/gl_sprite.cpp
|
||||
gl/scene/gl_skydome.cpp
|
||||
gl/scene/gl_weapon.cpp
|
||||
|
@ -825,14 +824,14 @@ set( FASTMATH_SOURCES
|
|||
gl/scene/gl_sky.cpp
|
||||
gl/scene/gl_portal.cpp
|
||||
gl/scene/gl_walls_draw.cpp
|
||||
gl/scene/gl_vertex.cpp
|
||||
gl/scene/gl_spritelight.cpp
|
||||
gl_load/gl_load.c
|
||||
gl/models/gl_models.cpp
|
||||
hwrenderer/dynlights/hw_dynlightdata.cpp
|
||||
hwrenderer/scene/hw_fakeflat.cpp
|
||||
hwrenderer/scene/hw_clipper.cpp
|
||||
hwrenderer/scene/hw_renderhacks.cpp
|
||||
hwrenderer/scene/hw_walls.cpp
|
||||
hwrenderer/scene/hw_walls_vertex.cpp
|
||||
r_data/models/models.cpp
|
||||
r_data/matrix.cpp
|
||||
sound/adlmidi/adldata.cpp
|
||||
|
@ -1018,6 +1017,7 @@ set (PCH_SOURCES
|
|||
gl/data/gl_vertexbuffer.cpp
|
||||
gl/dynlights/gl_lightbuffer.cpp
|
||||
gl/dynlights/gl_shadowmap.cpp
|
||||
gl/models/gl_models.cpp
|
||||
gl/renderer/gl_quaddrawer.cpp
|
||||
gl/renderer/gl_renderer.cpp
|
||||
gl/renderer/gl_renderstate.cpp
|
||||
|
|
283
src/hwrenderer/scene/hw_drawstructs.h
Normal file
283
src/hwrenderer/scene/hw_drawstructs.h
Normal file
|
@ -0,0 +1,283 @@
|
|||
#pragma once
|
||||
//==========================================================================
|
||||
//
|
||||
// One wall segment in the draw list
|
||||
//
|
||||
//==========================================================================
|
||||
#include "r_defs.h"
|
||||
#include "r_data/renderstyle.h"
|
||||
#include "textures/textures.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
#pragma warning(disable:4244)
|
||||
|
||||
struct GLHorizonInfo;
|
||||
struct GLSkyInfo;
|
||||
struct F3DFloor;
|
||||
class FMaterial;
|
||||
struct FTexCoordInfo;
|
||||
struct FSectorPortalGroup;
|
||||
struct FFlatVertex;
|
||||
struct FLinePortalSpan;
|
||||
struct FDynLightData;
|
||||
|
||||
enum WallTypes
|
||||
{
|
||||
RENDERWALL_NONE,
|
||||
RENDERWALL_TOP,
|
||||
RENDERWALL_M1S,
|
||||
RENDERWALL_M2S,
|
||||
RENDERWALL_BOTTOM,
|
||||
RENDERWALL_FOGBOUNDARY,
|
||||
RENDERWALL_MIRRORSURFACE,
|
||||
RENDERWALL_M2SNF,
|
||||
RENDERWALL_COLOR,
|
||||
RENDERWALL_FFBLOCK,
|
||||
// Insert new types at the end!
|
||||
};
|
||||
|
||||
enum PortalTypes
|
||||
{
|
||||
PORTALTYPE_SKY,
|
||||
PORTALTYPE_HORIZON,
|
||||
PORTALTYPE_SKYBOX,
|
||||
PORTALTYPE_SECTORSTACK,
|
||||
PORTALTYPE_PLANEMIRROR,
|
||||
PORTALTYPE_MIRROR,
|
||||
PORTALTYPE_LINETOLINE,
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// One sector plane, still in fixed point
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
struct GLSectorPlane
|
||||
{
|
||||
FTextureID texture;
|
||||
secplane_t plane;
|
||||
float Texheight;
|
||||
float Angle;
|
||||
FVector2 Offs;
|
||||
FVector2 Scale;
|
||||
|
||||
void GetFromSector(sector_t * sec, int ceiling)
|
||||
{
|
||||
Offs.X = (float)sec->GetXOffset(ceiling);
|
||||
Offs.Y = (float)sec->GetYOffset(ceiling);
|
||||
Scale.X = (float)sec->GetXScale(ceiling);
|
||||
Scale.Y = (float)sec->GetYScale(ceiling);
|
||||
Angle = (float)sec->GetAngle(ceiling).Degrees;
|
||||
texture = sec->GetTexture(ceiling);
|
||||
plane = sec->GetSecPlane(ceiling);
|
||||
Texheight = (float)((ceiling == sector_t::ceiling)? plane.fD() : -plane.fD());
|
||||
}
|
||||
};
|
||||
|
||||
struct GLSeg
|
||||
{
|
||||
float x1,x2;
|
||||
float y1,y2;
|
||||
float fracleft, fracright; // fractional offset of the 2 vertices on the linedef
|
||||
|
||||
FVector3 Normal() const
|
||||
{
|
||||
// we do not use the vector math inlines here because they are not optimized for speed but accuracy in the playsim and this is called quite frequently.
|
||||
float x = y2 - y1;
|
||||
float y = x1 - x2;
|
||||
float ilength = 1.f / sqrtf(x*x + y*y);
|
||||
return FVector3(x * ilength, 0, y * ilength);
|
||||
}
|
||||
};
|
||||
|
||||
struct texcoord
|
||||
{
|
||||
float u,v;
|
||||
};
|
||||
|
||||
struct HWDrawInfo;
|
||||
|
||||
class GLWall
|
||||
{
|
||||
public:
|
||||
static const char passflag[];
|
||||
|
||||
enum
|
||||
{
|
||||
GLWF_CLAMPX=1,
|
||||
GLWF_CLAMPY=2,
|
||||
GLWF_SKYHACK=4,
|
||||
GLWF_GLOW=8, // illuminated by glowing flats
|
||||
GLWF_NOSPLITUPPER=16,
|
||||
GLWF_NOSPLITLOWER=32,
|
||||
GLWF_NOSPLIT=64,
|
||||
GLWF_TRANSLUCENT = 128
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RWF_BLANK = 0,
|
||||
RWF_TEXTURED = 1, // actually not being used anymore because with buffers it's even less efficient not writing the texture coordinates - but leave it here
|
||||
RWF_NOSPLIT = 4,
|
||||
RWF_NORENDER = 8,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
LOLFT,
|
||||
UPLFT,
|
||||
UPRGT,
|
||||
LORGT,
|
||||
};
|
||||
|
||||
friend struct GLDrawList;
|
||||
friend class GLPortal;
|
||||
|
||||
vertex_t * vertexes[2]; // required for polygon splitting
|
||||
FMaterial *gltexture;
|
||||
TArray<lightlist_t> *lightlist;
|
||||
|
||||
GLSeg glseg;
|
||||
float ztop[2],zbottom[2];
|
||||
texcoord tcs[4];
|
||||
float alpha;
|
||||
|
||||
FColormap Colormap;
|
||||
ERenderStyle RenderStyle;
|
||||
|
||||
float ViewDistance;
|
||||
|
||||
int lightlevel;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
short rellight;
|
||||
|
||||
float topglowcolor[4];
|
||||
float bottomglowcolor[4];
|
||||
|
||||
int dynlightindex;
|
||||
|
||||
union
|
||||
{
|
||||
// it's either one of them but never more!
|
||||
FSectorPortal *secportal; // sector portal (formerly skybox)
|
||||
GLSkyInfo * sky; // for normal sky
|
||||
GLHorizonInfo * horizon; // for horizon information
|
||||
FSectorPortalGroup * portal; // stacked sector portals
|
||||
secplane_t * planemirror; // for plane mirrors
|
||||
FLinePortalSpan *lineportal; // line-to-line portals
|
||||
};
|
||||
|
||||
|
||||
secplane_t topplane, bottomplane; // we need to save these to pass them to the shader for calculating glows.
|
||||
|
||||
// these are not the same as ytop and ybottom!!!
|
||||
float zceil[2];
|
||||
float zfloor[2];
|
||||
|
||||
unsigned int vertindex;
|
||||
unsigned int vertcount;
|
||||
|
||||
public:
|
||||
seg_t * seg; // this gives the easiest access to all other structs involved
|
||||
subsector_t * sub; // For polyobjects
|
||||
//private:
|
||||
|
||||
void PutWall(HWDrawInfo *di, bool translucent);
|
||||
void PutPortal(HWDrawInfo *di, int ptype);
|
||||
void CheckTexturePosition(FTexCoordInfo *tci);
|
||||
|
||||
void Put3DWall(HWDrawInfo *di, lightlist_t * lightlist, bool translucent);
|
||||
bool SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright);
|
||||
void SplitWall(HWDrawInfo *di, sector_t * frontsector, bool translucent);
|
||||
|
||||
bool SetupLights(FDynLightData &lightdata);
|
||||
|
||||
void MakeVertices(HWDrawInfo *di, bool nosplit);
|
||||
|
||||
void SkyPlane(HWDrawInfo *di, sector_t *sector, int plane, bool allowmirror);
|
||||
void SkyLine(HWDrawInfo *di, sector_t *sec, line_t *line);
|
||||
void SkyNormal(HWDrawInfo *di, sector_t * fs,vertex_t * v1,vertex_t * v2);
|
||||
void SkyTop(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2);
|
||||
void SkyBottom(HWDrawInfo *di, seg_t * seg,sector_t * fs,sector_t * bs,vertex_t * v1,vertex_t * v2);
|
||||
|
||||
bool DoHorizon(HWDrawInfo *di, seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2);
|
||||
|
||||
bool SetWallCoordinates(seg_t * seg, FTexCoordInfo *tci, float ceilingrefheight,
|
||||
float topleft, float topright, float bottomleft, float bottomright, float t_ofs);
|
||||
|
||||
void DoTexture(HWDrawInfo *di, int type,seg_t * seg,int peg,
|
||||
float ceilingrefheight, float floorrefheight,
|
||||
float CeilingHeightstart,float CeilingHeightend,
|
||||
float FloorHeightstart,float FloorHeightend,
|
||||
float v_offset);
|
||||
|
||||
void DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
|
||||
sector_t * front, sector_t * back,
|
||||
sector_t * realfront, sector_t * realback,
|
||||
float fch1, float fch2, float ffh1, float ffh2,
|
||||
float bch1, float bch2, float bfh1, float bfh2);
|
||||
|
||||
void GetPlanePos(F3DFloor::planeref * planeref, float & left, float & right);
|
||||
|
||||
void BuildFFBlock(HWDrawInfo *di, seg_t * seg, F3DFloor * rover,
|
||||
float ff_topleft, float ff_topright,
|
||||
float ff_bottomleft, float ff_bottomright);
|
||||
void InverseFloors(HWDrawInfo *di, seg_t * seg, sector_t * frontsector,
|
||||
float topleft, float topright,
|
||||
float bottomleft, float bottomright);
|
||||
void ClipFFloors(HWDrawInfo *di, seg_t * seg, F3DFloor * ffloor, sector_t * frontsector,
|
||||
float topleft, float topright,
|
||||
float bottomleft, float bottomright);
|
||||
void DoFFloorBlocks(HWDrawInfo *di, seg_t * seg, sector_t * frontsector, sector_t * backsector,
|
||||
float fch1, float fch2, float ffh1, float ffh2,
|
||||
float bch1, float bch2, float bfh1, float bfh2);
|
||||
|
||||
|
||||
void CreateVertices(FFlatVertex *&ptr, bool nosplit);
|
||||
void SplitLeftEdge (FFlatVertex *&ptr);
|
||||
void SplitRightEdge(FFlatVertex *&ptr);
|
||||
void SplitUpperEdge(FFlatVertex *&ptr);
|
||||
void SplitLowerEdge(FFlatVertex *&ptr);
|
||||
|
||||
int CountVertices();
|
||||
|
||||
public:
|
||||
GLWall() {}
|
||||
|
||||
GLWall(const GLWall &other)
|
||||
{
|
||||
memcpy(this, &other, sizeof(GLWall));
|
||||
}
|
||||
|
||||
GLWall & operator=(const GLWall &other)
|
||||
{
|
||||
memcpy(this, &other, sizeof(GLWall));
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Process(HWDrawInfo *di, seg_t *seg, sector_t *frontsector, sector_t *backsector);
|
||||
void ProcessLowerMiniseg(HWDrawInfo *di, seg_t *seg, sector_t *frontsector, sector_t *backsector);
|
||||
|
||||
float PointOnSide(float x,float y)
|
||||
{
|
||||
return -((y-glseg.y1)*(glseg.x2-glseg.x1)-(x-glseg.x1)*(glseg.y2-glseg.y1));
|
||||
}
|
||||
|
||||
// Lines start-end and fdiv must intersect.
|
||||
double CalcIntersectionVertex(GLWall * w2)
|
||||
{
|
||||
float ax = glseg.x1, ay=glseg.y1;
|
||||
float bx = glseg.x2, by=glseg.y2;
|
||||
float cx = w2->glseg.x1, cy=w2->glseg.y1;
|
||||
float dx = w2->glseg.x2, dy=w2->glseg.y2;
|
||||
return ((ay-cy)*(dx-cx)-(ax-cx)*(dy-cy)) / ((bx-ax)*(dy-cy)-(by-ay)*(dx-cx));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline float Dist2(float x1,float y1,float x2,float y2)
|
||||
{
|
||||
return sqrtf((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
|
||||
}
|
34
src/hwrenderer/scene/hw_portal.h
Normal file
34
src/hwrenderer/scene/hw_portal.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include "hwrenderer/textures/hw_material.h"
|
||||
|
||||
struct GLSkyInfo
|
||||
{
|
||||
float x_offset[2];
|
||||
float y_offset; // doubleskies don't have a y-offset
|
||||
FMaterial * texture[2];
|
||||
FTextureID skytexno1;
|
||||
bool mirrored;
|
||||
bool doublesky;
|
||||
bool sky2;
|
||||
PalEntry fadecolor;
|
||||
|
||||
bool operator==(const GLSkyInfo & inf)
|
||||
{
|
||||
return !memcmp(this, &inf, sizeof(*this));
|
||||
}
|
||||
bool operator!=(const GLSkyInfo & inf)
|
||||
{
|
||||
return !!memcmp(this, &inf, sizeof(*this));
|
||||
}
|
||||
void init(int sky1, PalEntry fadecolor);
|
||||
};
|
||||
|
||||
struct GLHorizonInfo
|
||||
{
|
||||
GLSectorPlane plane;
|
||||
int lightlevel;
|
||||
FColormap colormap;
|
||||
PalEntry specialcolor;
|
||||
};
|
||||
|
Loading…
Reference in a new issue