mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- hw_sprites extracted
- moved the variables for OpenGL's special textures to the texture manager because it is far better suited as a container than the GLRenderer.
This commit is contained in:
parent
d1720ad790
commit
64b108ff44
23 changed files with 1196 additions and 1124 deletions
|
@ -834,6 +834,7 @@ set( FASTMATH_SOURCES
|
||||||
hwrenderer/scene/hw_flats.cpp
|
hwrenderer/scene/hw_flats.cpp
|
||||||
hwrenderer/scene/hw_renderhacks.cpp
|
hwrenderer/scene/hw_renderhacks.cpp
|
||||||
hwrenderer/scene/hw_sky.cpp
|
hwrenderer/scene/hw_sky.cpp
|
||||||
|
hwrenderer/scene/hw_sprites.cpp
|
||||||
hwrenderer/scene/hw_walls.cpp
|
hwrenderer/scene/hw_walls.cpp
|
||||||
hwrenderer/scene/hw_walls_vertex.cpp
|
hwrenderer/scene/hw_walls_vertex.cpp
|
||||||
r_data/models/models.cpp
|
r_data/models/models.cpp
|
||||||
|
|
|
@ -283,6 +283,17 @@ enum ESSType
|
||||||
|
|
||||||
const double M_PI = 3.14159265358979323846; // matches value in gcc v2 math.h
|
const double M_PI = 3.14159265358979323846; // matches value in gcc v2 math.h
|
||||||
|
|
||||||
|
inline float DEG2RAD(float deg)
|
||||||
|
{
|
||||||
|
return deg * float(M_PI / 180.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float RAD2DEG(float deg)
|
||||||
|
{
|
||||||
|
return deg * float(180. / M_PI);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T, size_t N>
|
template <typename T, size_t N>
|
||||||
char ( &_ArraySizeHelper( T (&array)[N] ))[N];
|
char ( &_ArraySizeHelper( T (&array)[N] ))[N];
|
||||||
|
|
||||||
|
|
|
@ -483,8 +483,8 @@ bool gl_SetupLight(int group, Plane & p, ADynamicLight * light, FVector3 & nearP
|
||||||
|
|
||||||
bool gl_SetupLightTexture()
|
bool gl_SetupLightTexture()
|
||||||
{
|
{
|
||||||
if (!GLRenderer->glLight.isValid()) return false;
|
if (!TexMan.glLight.isValid()) return false;
|
||||||
FMaterial * pat = FMaterial::ValidateTexture(GLRenderer->glLight, false, false);
|
FMaterial * pat = FMaterial::ValidateTexture(TexMan.glLight, false, false);
|
||||||
gl_RenderState.SetMaterial(pat, CLAMP_XY_NOMIP, 0, -1, false);
|
gl_RenderState.SetMaterial(pat, CLAMP_XY_NOMIP, 0, -1, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,6 @@ FGLRenderer::FGLRenderer(OpenGLFrameBuffer *fb)
|
||||||
mViewVector = FVector2(0,0);
|
mViewVector = FVector2(0,0);
|
||||||
mVBO = nullptr;
|
mVBO = nullptr;
|
||||||
mSkyVBO = nullptr;
|
mSkyVBO = nullptr;
|
||||||
gl_spriteindex = 0;
|
|
||||||
mShaderManager = nullptr;
|
mShaderManager = nullptr;
|
||||||
mLights = nullptr;
|
mLights = nullptr;
|
||||||
mTonemapPalette = nullptr;
|
mTonemapPalette = nullptr;
|
||||||
|
@ -158,8 +157,6 @@ void FGLRenderer::Initialize(int width, int height)
|
||||||
legacyShaders = new LegacyShaderContainer;
|
legacyShaders = new LegacyShaderContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetSpecialTextures();
|
|
||||||
|
|
||||||
// needed for the core profile, because someone decided it was a good idea to remove the default VAO.
|
// needed for the core profile, because someone decided it was a good idea to remove the default VAO.
|
||||||
if (!gl.legacyMode)
|
if (!gl.legacyMode)
|
||||||
{
|
{
|
||||||
|
@ -230,16 +227,6 @@ FGLRenderer::~FGLRenderer()
|
||||||
delete mFXAALumaShader;
|
delete mFXAALumaShader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FGLRenderer::GetSpecialTextures()
|
|
||||||
{
|
|
||||||
if (gl.legacyMode) glLight = TexMan.CheckForTexture("glstuff/gllight.png", ETextureType::MiscPatch);
|
|
||||||
glPart2 = TexMan.CheckForTexture("glstuff/glpart2.png", ETextureType::MiscPatch);
|
|
||||||
glPart = TexMan.CheckForTexture("glstuff/glpart.png", ETextureType::MiscPatch);
|
|
||||||
mirrorTexture = TexMan.CheckForTexture("glstuff/mirror.png", ETextureType::MiscPatch);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// Calculates the viewport values needed for 2D and 3D operations
|
// Calculates the viewport values needed for 2D and 3D operations
|
||||||
|
|
|
@ -51,16 +51,6 @@ class FCustomPostProcessShaders;
|
||||||
class GLSceneDrawer;
|
class GLSceneDrawer;
|
||||||
class SWSceneDrawer;
|
class SWSceneDrawer;
|
||||||
|
|
||||||
inline float DEG2RAD(float deg)
|
|
||||||
{
|
|
||||||
return deg * float(M_PI / 180.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline float RAD2DEG(float deg)
|
|
||||||
{
|
|
||||||
return deg * float(180. / M_PI);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct GL_IRECT
|
struct GL_IRECT
|
||||||
{
|
{
|
||||||
int left,top;
|
int left,top;
|
||||||
|
@ -119,7 +109,6 @@ public:
|
||||||
AActor *mViewActor;
|
AActor *mViewActor;
|
||||||
FShaderManager *mShaderManager;
|
FShaderManager *mShaderManager;
|
||||||
FSamplerManager *mSamplerManager;
|
FSamplerManager *mSamplerManager;
|
||||||
int gl_spriteindex;
|
|
||||||
unsigned int mFBID;
|
unsigned int mFBID;
|
||||||
unsigned int mVAOID;
|
unsigned int mVAOID;
|
||||||
int mOldFBID;
|
int mOldFBID;
|
||||||
|
@ -150,11 +139,6 @@ public:
|
||||||
|
|
||||||
FShadowMap mShadowMap;
|
FShadowMap mShadowMap;
|
||||||
|
|
||||||
FTextureID glLight;
|
|
||||||
FTextureID glPart2;
|
|
||||||
FTextureID glPart;
|
|
||||||
FTextureID mirrorTexture;
|
|
||||||
|
|
||||||
FRotator mAngles;
|
FRotator mAngles;
|
||||||
FVector2 mViewVector;
|
FVector2 mViewVector;
|
||||||
|
|
||||||
|
@ -204,7 +188,6 @@ public:
|
||||||
void CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma);
|
void CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma);
|
||||||
void DrawPresentTexture(const GL_IRECT &box, bool applyGamma);
|
void DrawPresentTexture(const GL_IRECT &box, bool applyGamma);
|
||||||
void Flush();
|
void Flush();
|
||||||
void GetSpecialTextures();
|
|
||||||
void Draw2D(F2DDrawer *data);
|
void Draw2D(F2DDrawer *data);
|
||||||
void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV);
|
void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV);
|
||||||
void WriteSavePic(player_t *player, FileWriter *file, int width, int height);
|
void WriteSavePic(player_t *player, FileWriter *file, int width, int height);
|
||||||
|
|
|
@ -85,7 +85,7 @@ void GLSceneDrawer::AddLine (seg_t *seg, bool portalclip)
|
||||||
if (portalclip)
|
if (portalclip)
|
||||||
{
|
{
|
||||||
int clipres = GLRenderer->mClipPortal->ClipSeg(seg);
|
int clipres = GLRenderer->mClipPortal->ClipSeg(seg);
|
||||||
if (clipres == GLPortal::PClip_InFront) return;
|
if (clipres == PClip_InFront) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
angle_t startAngle = clipper.GetClipAngle(seg->v2);
|
angle_t startAngle = clipper.GetClipAngle(seg->v2);
|
||||||
|
@ -436,7 +436,7 @@ void GLSceneDrawer::DoSubsector(subsector_t * sub)
|
||||||
if (GLRenderer->mClipPortal)
|
if (GLRenderer->mClipPortal)
|
||||||
{
|
{
|
||||||
int clipres = GLRenderer->mClipPortal->ClipSubsector(sub);
|
int clipres = GLRenderer->mClipPortal->ClipSubsector(sub);
|
||||||
if (clipres == GLPortal::PClip_InFront)
|
if (clipres == PClip_InFront)
|
||||||
{
|
{
|
||||||
line_t *line = GLRenderer->mClipPortal->ClipLine();
|
line_t *line = GLRenderer->mClipPortal->ClipLine();
|
||||||
// The subsector is out of range, but we still have to check lines that lie directly on the boundary and may expose their upper or lower parts.
|
// The subsector is out of range, but we still have to check lines that lie directly on the boundary and may expose their upper or lower parts.
|
||||||
|
@ -458,6 +458,12 @@ void GLSceneDrawer::DoSubsector(subsector_t * sub)
|
||||||
|
|
||||||
for (i = ParticlesInSubsec[sub->Index()]; i != NO_PARTICLE; i = Particles[i].snext)
|
for (i = ParticlesInSubsec[sub->Index()]; i != NO_PARTICLE; i = Particles[i].snext)
|
||||||
{
|
{
|
||||||
|
if (GLRenderer->mClipPortal)
|
||||||
|
{
|
||||||
|
int clipres = GLRenderer->mClipPortal->ClipPoint(Particles[i].Pos);
|
||||||
|
if (clipres == PClip_InFront) continue;
|
||||||
|
}
|
||||||
|
|
||||||
GLSprite sprite;
|
GLSprite sprite;
|
||||||
sprite.ProcessParticle(gl_drawinfo, &Particles[i], fakesector);
|
sprite.ProcessParticle(gl_drawinfo, &Particles[i], fakesector);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "r_utility.h"
|
#include "r_utility.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
|
#include "hwrenderer/scene/hw_drawstructs.h"
|
||||||
|
|
||||||
#include "gl/data/gl_vertexbuffer.h"
|
#include "gl/data/gl_vertexbuffer.h"
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
#include "gl/scene/gl_drawinfo.h"
|
||||||
|
@ -1306,6 +1307,12 @@ void FDrawInfo::AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *su
|
||||||
portal->GetRenderState()->AddSubsector(sub);
|
portal->GetRenderState()->AddSubsector(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FDrawInfo::ClipPoint(const DVector3 &pos)
|
||||||
|
{
|
||||||
|
return GLRenderer->mClipPortal->ClipPoint(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::pair<FFlatVertex *, unsigned int> FDrawInfo::AllocVertices(unsigned int count)
|
std::pair<FFlatVertex *, unsigned int> FDrawInfo::AllocVertices(unsigned int count)
|
||||||
{
|
{
|
||||||
unsigned int index = -1;
|
unsigned int index = -1;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "gl/scene/gl_wall.h"
|
#include "gl/scene/gl_wall.h"
|
||||||
#include "hwrenderer/scene/hw_drawinfo.h"
|
#include "hwrenderer/scene/hw_drawinfo.h"
|
||||||
|
|
||||||
|
class GLSceneDrawer;
|
||||||
|
|
||||||
enum GLDrawItemType
|
enum GLDrawItemType
|
||||||
{
|
{
|
||||||
GLDIT_WALL,
|
GLDIT_WALL,
|
||||||
|
@ -226,6 +228,7 @@ struct FDrawInfo : public HWDrawInfo
|
||||||
// These two may be moved to the API independent part of the renderer later.
|
// These two may be moved to the API independent part of the renderer later.
|
||||||
void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs) override;
|
void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs) override;
|
||||||
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub) override;
|
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub) override;
|
||||||
|
int ClipPoint(const DVector3 &pos) override;
|
||||||
|
|
||||||
static void StartDrawInfo(GLSceneDrawer *drawer);
|
static void StartDrawInfo(GLSceneDrawer *drawer);
|
||||||
static void EndDrawInfo();
|
static void EndDrawInfo();
|
||||||
|
|
|
@ -106,13 +106,6 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
PClip_InFront,
|
|
||||||
PClip_Inside,
|
|
||||||
PClip_Behind,
|
|
||||||
};
|
|
||||||
|
|
||||||
void RenderPortal(bool usestencil, bool doquery)
|
void RenderPortal(bool usestencil, bool doquery)
|
||||||
{
|
{
|
||||||
// Start may perform an occlusion query. If that returns 0 there
|
// Start may perform an occlusion query. If that returns 0 there
|
||||||
|
|
|
@ -247,11 +247,16 @@ void GLSceneDrawer::CreateScene()
|
||||||
|
|
||||||
// clip the scene and fill the drawlists
|
// clip the scene and fill the drawlists
|
||||||
for(auto p : level.portalGroups) p->glportal = nullptr;
|
for(auto p : level.portalGroups) p->glportal = nullptr;
|
||||||
GLRenderer->gl_spriteindex=0;
|
|
||||||
Bsp.Clock();
|
Bsp.Clock();
|
||||||
GLRenderer->mVBO->Map();
|
GLRenderer->mVBO->Map();
|
||||||
SetView();
|
SetView();
|
||||||
validcount++; // used for processing sidedefs only once by the renderer.
|
validcount++; // used for processing sidedefs only once by the renderer.
|
||||||
|
|
||||||
|
gl_drawinfo->clipPortal = !!GLRenderer->mClipPortal;
|
||||||
|
gl_drawinfo->mAngles = GLRenderer->mAngles;
|
||||||
|
gl_drawinfo->mViewVector = GLRenderer->mViewVector;
|
||||||
|
gl_drawinfo->mViewActor = GLRenderer->mViewActor;
|
||||||
|
|
||||||
RenderBSPNode (level.HeadNode());
|
RenderBSPNode (level.HeadNode());
|
||||||
if (GLRenderer->mCurrentPortal != NULL) GLRenderer->mCurrentPortal->RenderAttached();
|
if (GLRenderer->mCurrentPortal != NULL) GLRenderer->mCurrentPortal->RenderAttached();
|
||||||
Bsp.Unclock();
|
Bsp.Unclock();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -15,95 +15,7 @@
|
||||||
#pragma warning(disable:4244)
|
#pragma warning(disable:4244)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct GLHorizonInfo;
|
|
||||||
struct F3DFloor;
|
|
||||||
struct model_t;
|
|
||||||
struct FSpriteModelFrame;
|
|
||||||
struct particle_t;
|
struct particle_t;
|
||||||
class ADynamicLight;
|
|
||||||
class FMaterial;
|
|
||||||
struct GLDrawList;
|
|
||||||
struct GLSkyInfo;
|
|
||||||
struct FTexCoordInfo;
|
|
||||||
struct FSectorPortalGroup;
|
|
||||||
struct FFlatVertex;
|
|
||||||
struct FLinePortalSpan;
|
|
||||||
class GLSceneDrawer;
|
|
||||||
struct FDynLightData;
|
|
||||||
enum area_t : int;
|
|
||||||
|
|
||||||
struct FDrawInfo;
|
|
||||||
struct HWDrawInfo;
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// One sprite in the draw list
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
|
|
||||||
class GLSprite
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
friend struct GLDrawList;
|
|
||||||
friend void Mod_RenderModel(GLSprite * spr, model_t * mdl, int framenumber);
|
|
||||||
|
|
||||||
int lightlevel;
|
|
||||||
uint8_t foglevel;
|
|
||||||
uint8_t hw_styleflags;
|
|
||||||
bool fullbright;
|
|
||||||
PalEntry ThingColor; // thing's own color
|
|
||||||
FColormap Colormap;
|
|
||||||
FSpriteModelFrame * modelframe;
|
|
||||||
FRenderStyle RenderStyle;
|
|
||||||
int OverrideShader;
|
|
||||||
|
|
||||||
int translation;
|
|
||||||
int index;
|
|
||||||
int depth;
|
|
||||||
|
|
||||||
float topclip;
|
|
||||||
float bottomclip;
|
|
||||||
|
|
||||||
float x,y,z; // needed for sorting!
|
|
||||||
|
|
||||||
float ul,ur;
|
|
||||||
float vt,vb;
|
|
||||||
float x1,y1,z1;
|
|
||||||
float x2,y2,z2;
|
|
||||||
|
|
||||||
FMaterial *gltexture;
|
|
||||||
float trans;
|
|
||||||
AActor * actor;
|
|
||||||
particle_t * particle;
|
|
||||||
TArray<lightlist_t> *lightlist;
|
|
||||||
DRotator Angles;
|
|
||||||
|
|
||||||
int dynlightindex;
|
|
||||||
|
|
||||||
void SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool translucent);
|
|
||||||
void PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight);
|
|
||||||
bool CalculateVertices(FVector3 *v);
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
GLSprite() {}
|
|
||||||
void PutSprite(HWDrawInfo *di, bool translucent);
|
|
||||||
void Process(HWDrawInfo *di, AActor* thing,sector_t * sector, area_t in_area, int thruportal = false);
|
|
||||||
void ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *sector);//, int shade, int fakeside)
|
|
||||||
|
|
||||||
GLSprite(const GLSprite &other)
|
|
||||||
{
|
|
||||||
memcpy(this, &other, sizeof(GLSprite));
|
|
||||||
}
|
|
||||||
|
|
||||||
GLSprite & operator=(const GLSprite &other)
|
|
||||||
{
|
|
||||||
memcpy(this, &other, sizeof(GLSprite));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// Light + color
|
// Light + color
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ void FDrawInfo::RenderFogBoundary(GLWall *wall)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
void FDrawInfo::RenderMirrorSurface(GLWall *wall)
|
void FDrawInfo::RenderMirrorSurface(GLWall *wall)
|
||||||
{
|
{
|
||||||
if (!GLRenderer->mirrorTexture.isValid()) return;
|
if (!TexMan.mirrorTexture.isValid()) return;
|
||||||
|
|
||||||
if (!gl.legacyMode)
|
if (!gl.legacyMode)
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,7 @@ void FDrawInfo::RenderMirrorSurface(GLWall *wall)
|
||||||
gl_RenderState.AlphaFunc(GL_GREATER,0);
|
gl_RenderState.AlphaFunc(GL_GREATER,0);
|
||||||
glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
|
|
||||||
FMaterial * pat=FMaterial::ValidateTexture(GLRenderer->mirrorTexture, false, false);
|
FMaterial * pat=FMaterial::ValidateTexture(TexMan.mirrorTexture, false, false);
|
||||||
gl_RenderState.SetMaterial(pat, CLAMP_NONE, 0, -1, false);
|
gl_RenderState.SetMaterial(pat, CLAMP_NONE, 0, -1, false);
|
||||||
|
|
||||||
wall->flags &= ~GLWall::GLWF_GLOW;
|
wall->flags &= ~GLWall::GLWF_GLOW;
|
||||||
|
|
|
@ -574,7 +574,6 @@ void OpenGLFrameBuffer::GameRestart()
|
||||||
memcpy (SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256);
|
memcpy (SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256);
|
||||||
UpdatePalette ();
|
UpdatePalette ();
|
||||||
ScreenshotBuffer = NULL;
|
ScreenshotBuffer = NULL;
|
||||||
GLRenderer->GetSpecialTextures();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
|
|
||||||
struct FSectorPortalGroup;
|
struct FSectorPortalGroup;
|
||||||
|
@ -34,6 +35,13 @@ enum SectorRenderFlags
|
||||||
SSRF_SEEN = 16,
|
SSRF_SEEN = 16,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EPortalClip
|
||||||
|
{
|
||||||
|
PClip_InFront,
|
||||||
|
PClip_Inside,
|
||||||
|
PClip_Behind,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct HWDrawInfo
|
struct HWDrawInfo
|
||||||
{
|
{
|
||||||
|
@ -65,6 +73,11 @@ struct HWDrawInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
int FixedColormap;
|
int FixedColormap;
|
||||||
|
std::atomic<int> spriteindex;
|
||||||
|
bool clipPortal;
|
||||||
|
FRotator mAngles;
|
||||||
|
FVector2 mViewVector;
|
||||||
|
AActor *mViewActor;
|
||||||
|
|
||||||
TArray<MissingTextureInfo> MissingUpperTextures;
|
TArray<MissingTextureInfo> MissingUpperTextures;
|
||||||
TArray<MissingTextureInfo> MissingLowerTextures;
|
TArray<MissingTextureInfo> MissingLowerTextures;
|
||||||
|
@ -138,6 +151,8 @@ public:
|
||||||
virtual GLDecal *AddDecal(bool onmirror) = 0;
|
virtual GLDecal *AddDecal(bool onmirror) = 0;
|
||||||
virtual std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) = 0;
|
virtual std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) = 0;
|
||||||
|
|
||||||
|
virtual int ClipPoint(const DVector3 &pos) = 0;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ struct FFlatVertex;
|
||||||
struct FLinePortalSpan;
|
struct FLinePortalSpan;
|
||||||
struct FDynLightData;
|
struct FDynLightData;
|
||||||
class VSMatrix;
|
class VSMatrix;
|
||||||
|
struct FSpriteModelFrame;
|
||||||
|
struct particle_t;
|
||||||
|
enum area_t : int;
|
||||||
|
|
||||||
enum HWRenderStyle
|
enum HWRenderStyle
|
||||||
{
|
{
|
||||||
|
@ -330,8 +333,73 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// One sprite in the draw list
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
|
||||||
|
class GLSprite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int lightlevel;
|
||||||
|
uint8_t foglevel;
|
||||||
|
uint8_t hw_styleflags;
|
||||||
|
bool fullbright;
|
||||||
|
PalEntry ThingColor; // thing's own color
|
||||||
|
FColormap Colormap;
|
||||||
|
FSpriteModelFrame * modelframe;
|
||||||
|
FRenderStyle RenderStyle;
|
||||||
|
int OverrideShader;
|
||||||
|
|
||||||
|
int translation;
|
||||||
|
int index;
|
||||||
|
int depth;
|
||||||
|
|
||||||
|
float topclip;
|
||||||
|
float bottomclip;
|
||||||
|
|
||||||
|
float x,y,z; // needed for sorting!
|
||||||
|
|
||||||
|
float ul,ur;
|
||||||
|
float vt,vb;
|
||||||
|
float x1,y1,z1;
|
||||||
|
float x2,y2,z2;
|
||||||
|
|
||||||
|
FMaterial *gltexture;
|
||||||
|
float trans;
|
||||||
|
AActor * actor;
|
||||||
|
particle_t * particle;
|
||||||
|
TArray<lightlist_t> *lightlist;
|
||||||
|
DRotator Angles;
|
||||||
|
|
||||||
|
int dynlightindex;
|
||||||
|
|
||||||
|
void SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool translucent);
|
||||||
|
void PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight);
|
||||||
|
bool CalculateVertices(HWDrawInfo *di, FVector3 *v);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GLSprite() {}
|
||||||
|
void PutSprite(HWDrawInfo *di, bool translucent);
|
||||||
|
void Process(HWDrawInfo *di, AActor* thing,sector_t * sector, area_t in_area, int thruportal = false);
|
||||||
|
void ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *sector);//, int shade, int fakeside)
|
||||||
|
|
||||||
|
GLSprite(const GLSprite &other)
|
||||||
|
{
|
||||||
|
memcpy(this, &other, sizeof(GLSprite));
|
||||||
|
}
|
||||||
|
|
||||||
|
GLSprite & operator=(const GLSprite &other)
|
||||||
|
{
|
||||||
|
memcpy(this, &other, sizeof(GLSprite));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -364,3 +432,4 @@ inline float Dist2(float x1,float y1,float x2,float y2)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * gltexture, VSMatrix &mat);
|
bool gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * gltexture, VSMatrix &mat);
|
||||||
|
extern const float LARGE_VALUE;
|
||||||
|
|
|
@ -70,6 +70,7 @@ void HWDrawInfo::ClearBuffers()
|
||||||
CeilingStacks.Clear();
|
CeilingStacks.Clear();
|
||||||
FloorStacks.Clear();
|
FloorStacks.Clear();
|
||||||
HandledSubsectors.Clear();
|
HandledSubsectors.Clear();
|
||||||
|
spriteindex = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
1022
src/hwrenderer/scene/hw_sprites.cpp
Normal file
1022
src/hwrenderer/scene/hw_sprites.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -109,3 +109,25 @@ CVAR(Bool, gl_precache, false, CVAR_ARCHIVE)
|
||||||
|
|
||||||
CVAR(Bool, gl_trimsprites, true, CVAR_ARCHIVE);
|
CVAR(Bool, gl_trimsprites, true, CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// Sprite CVARs
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
CVAR(Bool, gl_usecolorblending, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
CVAR(Bool, gl_spritebrightfog, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||||
|
CVAR(Bool, gl_sprite_blend, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||||
|
CVAR(Int, gl_spriteclip, 1, CVAR_ARCHIVE)
|
||||||
|
CVAR(Float, gl_sclipthreshold, 10.0, CVAR_ARCHIVE)
|
||||||
|
CVAR(Float, gl_sclipfactor, 1.8f, CVAR_ARCHIVE)
|
||||||
|
CVAR(Int, gl_particles_style, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // 0 = square, 1 = round, 2 = smooth
|
||||||
|
CVAR(Int, gl_billboard_mode, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
CVAR(Bool, gl_billboard_faces_camera, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
CVAR(Bool, gl_billboard_particles, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
CVAR(Int, gl_enhanced_nv_stealth, 3, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
CUSTOM_CVAR(Int, gl_fuzztype, 0, CVAR_ARCHIVE)
|
||||||
|
{
|
||||||
|
if (self < 0 || self > 8) self = 0;
|
||||||
|
}
|
||||||
|
|
|
@ -57,3 +57,16 @@ EXTERN_CVAR(Float, gl_ssao_blur_amount)
|
||||||
EXTERN_CVAR(Int, gl_debug_level)
|
EXTERN_CVAR(Int, gl_debug_level)
|
||||||
EXTERN_CVAR(Bool, gl_debug_breakpoint)
|
EXTERN_CVAR(Bool, gl_debug_breakpoint)
|
||||||
|
|
||||||
|
|
||||||
|
EXTERN_CVAR(Bool, gl_usecolorblending)
|
||||||
|
EXTERN_CVAR(Bool, gl_spritebrightfog)
|
||||||
|
EXTERN_CVAR(Bool, gl_sprite_blend)
|
||||||
|
EXTERN_CVAR(Int, gl_spriteclip)
|
||||||
|
EXTERN_CVAR(Float, gl_sclipthreshold)
|
||||||
|
EXTERN_CVAR(Float, gl_sclipfactor)
|
||||||
|
EXTERN_CVAR(Int, gl_particles_style)
|
||||||
|
EXTERN_CVAR(Int, gl_billboard_mode)
|
||||||
|
EXTERN_CVAR(Bool, gl_billboard_faces_camera)
|
||||||
|
EXTERN_CVAR(Bool, gl_billboard_particles)
|
||||||
|
EXTERN_CVAR(Int, gl_enhanced_nv_stealth)
|
||||||
|
EXTERN_CVAR(Int, gl_fuzztype)
|
||||||
|
|
|
@ -20,6 +20,7 @@ struct FRenderViewpoint
|
||||||
DVector3 Pos; // Camera position
|
DVector3 Pos; // Camera position
|
||||||
DVector3 ActorPos; // Camera actor's position
|
DVector3 ActorPos; // Camera actor's position
|
||||||
DRotator Angles; // Camera angles
|
DRotator Angles; // Camera angles
|
||||||
|
|
||||||
DVector3 Path[2]; // View path for portal calculations
|
DVector3 Path[2]; // View path for portal calculations
|
||||||
double Cos; // cos(Angles.Yaw)
|
double Cos; // cos(Angles.Yaw)
|
||||||
double Sin; // sin(Angles.Yaw)
|
double Sin; // sin(Angles.Yaw)
|
||||||
|
|
|
@ -1054,6 +1054,12 @@ void FTextureManager::Init()
|
||||||
{
|
{
|
||||||
tex.Texture->AddAutoMaterials();
|
tex.Texture->AddAutoMaterials();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glLight = TexMan.CheckForTexture("glstuff/gllight.png", ETextureType::MiscPatch);
|
||||||
|
glPart2 = TexMan.CheckForTexture("glstuff/glpart2.png", ETextureType::MiscPatch);
|
||||||
|
glPart = TexMan.CheckForTexture("glstuff/glpart.png", ETextureType::MiscPatch);
|
||||||
|
mirrorTexture = TexMan.CheckForTexture("glstuff/mirror.png", ETextureType::MiscPatch);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -682,6 +682,12 @@ public:
|
||||||
{
|
{
|
||||||
SINMASK = 2047
|
SINMASK = 2047
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FTextureID glLight;
|
||||||
|
FTextureID glPart2;
|
||||||
|
FTextureID glPart;
|
||||||
|
FTextureID mirrorTexture;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// base class for everything that can be used as a world texture.
|
// base class for everything that can be used as a world texture.
|
||||||
|
|
Loading…
Reference in a new issue