mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
- added UploadLights to the DrawInfo interface.
- removed GLPASS_PLAIN because it was the same as GLPASS_ALL.
This commit is contained in:
parent
96ac1fa363
commit
6285a309ce
9 changed files with 31 additions and 23 deletions
|
@ -857,8 +857,8 @@ void GLSceneDrawer::RenderMultipassStuff()
|
||||||
gl_RenderState.EnableTexture(false);
|
gl_RenderState.EnableTexture(false);
|
||||||
gl_RenderState.EnableBrightmap(false);
|
gl_RenderState.EnableBrightmap(false);
|
||||||
gl_RenderState.Apply();
|
gl_RenderState.Apply();
|
||||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(gl_drawinfo, GLPASS_PLAIN);
|
gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(gl_drawinfo, GLPASS_ALL);
|
||||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(gl_drawinfo, GLPASS_PLAIN);
|
gl_drawinfo->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(gl_drawinfo, GLPASS_ALL);
|
||||||
|
|
||||||
// Part 2: masked geometry. This is set up so that only pixels with alpha>0.5 will show
|
// Part 2: masked geometry. This is set up so that only pixels with alpha>0.5 will show
|
||||||
// This creates a blank surface that only fills the nontransparent parts of the texture
|
// This creates a blank surface that only fills the nontransparent parts of the texture
|
||||||
|
@ -866,18 +866,18 @@ void GLSceneDrawer::RenderMultipassStuff()
|
||||||
gl_RenderState.SetTextureMode(TM_MASK);
|
gl_RenderState.SetTextureMode(TM_MASK);
|
||||||
gl_RenderState.EnableBrightmap(true);
|
gl_RenderState.EnableBrightmap(true);
|
||||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
||||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(gl_drawinfo, GLPASS_PLAIN);
|
gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(gl_drawinfo, GLPASS_ALL);
|
||||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(gl_drawinfo, GLPASS_PLAIN);
|
gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(gl_drawinfo, GLPASS_ALL);
|
||||||
|
|
||||||
// Part 3: The base of fogged surfaces, including the texture
|
// Part 3: The base of fogged surfaces, including the texture
|
||||||
gl_RenderState.EnableBrightmap(false);
|
gl_RenderState.EnableBrightmap(false);
|
||||||
gl_RenderState.SetTextureMode(TM_MODULATE);
|
gl_RenderState.SetTextureMode(TM_MODULATE);
|
||||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0);
|
gl_RenderState.AlphaFunc(GL_GEQUAL, 0);
|
||||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_FOG].DrawWalls(gl_drawinfo, GLPASS_PLAIN);
|
gl_drawinfo->dldrawlists[GLLDL_WALLS_FOG].DrawWalls(gl_drawinfo, GLPASS_ALL);
|
||||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_FOG].DrawFlats(gl_drawinfo, GLPASS_PLAIN);
|
gl_drawinfo->dldrawlists[GLLDL_FLATS_FOG].DrawFlats(gl_drawinfo, GLPASS_ALL);
|
||||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
||||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_FOGMASKED].DrawWalls(gl_drawinfo, GLPASS_PLAIN);
|
gl_drawinfo->dldrawlists[GLLDL_WALLS_FOGMASKED].DrawWalls(gl_drawinfo, GLPASS_ALL);
|
||||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_FOGMASKED].DrawFlats(gl_drawinfo, GLPASS_PLAIN);
|
gl_drawinfo->dldrawlists[GLLDL_FLATS_FOGMASKED].DrawFlats(gl_drawinfo, GLPASS_ALL);
|
||||||
|
|
||||||
// second pass: draw lights
|
// second pass: draw lights
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
|
|
|
@ -37,7 +37,5 @@ public:
|
||||||
|
|
||||||
int gl_SetDynModelLight(AActor *self, int dynlightindex);
|
int gl_SetDynModelLight(AActor *self, int dynlightindex);
|
||||||
|
|
||||||
extern thread_local FDynLightData lightdata;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "gl/renderer/gl_renderstate.h"
|
#include "gl/renderer/gl_renderstate.h"
|
||||||
#include "gl/stereo3d/scoped_color_mask.h"
|
#include "gl/stereo3d/scoped_color_mask.h"
|
||||||
#include "gl/renderer/gl_quaddrawer.h"
|
#include "gl/renderer/gl_quaddrawer.h"
|
||||||
|
#include "gl/dynlights/gl_lightbuffer.h"
|
||||||
|
|
||||||
FDrawInfo * gl_drawinfo;
|
FDrawInfo * gl_drawinfo;
|
||||||
FDrawInfoList di_list;
|
FDrawInfoList di_list;
|
||||||
|
@ -522,3 +523,10 @@ GLDecal *FDrawInfo::AddDecal(bool onmirror)
|
||||||
return decal;
|
return decal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FDrawInfo::UploadLights(FDynLightData &data)
|
||||||
|
{
|
||||||
|
return GLRenderer->mLights->UploadLights(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ enum Drawpasses
|
||||||
{
|
{
|
||||||
GLPASS_ALL, // Main pass with dynamic lights
|
GLPASS_ALL, // Main pass with dynamic lights
|
||||||
GLPASS_LIGHTSONLY, // only collect dynamic lights
|
GLPASS_LIGHTSONLY, // only collect dynamic lights
|
||||||
GLPASS_PLAIN, // Main pass without dynamic lights
|
|
||||||
GLPASS_DECALS, // Draws a decal
|
GLPASS_DECALS, // Draws a decal
|
||||||
GLPASS_TRANSLUCENT, // Draws translucent objects
|
GLPASS_TRANSLUCENT, // Draws translucent objects
|
||||||
|
|
||||||
|
@ -82,6 +81,7 @@ struct FDrawInfo : public HWDrawInfo
|
||||||
void AddSprite(GLSprite *sprite, bool translucent) override;
|
void AddSprite(GLSprite *sprite, bool translucent) override;
|
||||||
|
|
||||||
std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) override;
|
std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) override;
|
||||||
|
int UploadLights(FDynLightData &data) override;
|
||||||
|
|
||||||
// Legacy GL only.
|
// Legacy GL only.
|
||||||
bool PutWallCompat(GLWall *wall, int passflag);
|
bool PutWallCompat(GLWall *wall, int passflag);
|
||||||
|
|
|
@ -288,8 +288,7 @@ void FDrawInfo::DrawFlat(GLFlat *flat, int pass, bool trans) // trans only has m
|
||||||
|
|
||||||
switch (pass)
|
switch (pass)
|
||||||
{
|
{
|
||||||
case GLPASS_PLAIN: // Single-pass rendering
|
case GLPASS_ALL: // Single-pass rendering
|
||||||
case GLPASS_ALL: // Same, but also creates the dynlight data.
|
|
||||||
mDrawer->SetColor(flat->lightlevel, rel, flat->Colormap,1.0f);
|
mDrawer->SetColor(flat->lightlevel, rel, flat->Colormap,1.0f);
|
||||||
mDrawer->SetFog(flat->lightlevel, rel, &flat->Colormap, false);
|
mDrawer->SetFog(flat->lightlevel, rel, &flat->Colormap, false);
|
||||||
if (!flat->gltexture->tex->isFullbright())
|
if (!flat->gltexture->tex->isFullbright())
|
||||||
|
|
|
@ -327,15 +327,6 @@ void FDrawInfo::AddSprite(GLSprite *sprite, bool translucent)
|
||||||
list = GLDL_MODELS;
|
list = GLDL_MODELS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// That's a lot of checks...
|
|
||||||
if (sprite->modelframe && sprite->RenderStyle.BlendOp != STYLEOP_Shadow && level.HasDynamicLights && gl_light_sprites && mDrawer->FixedColormap == CM_DEFAULT && !sprite->fullbright && !gl.legacyMode)
|
|
||||||
{
|
|
||||||
hw_GetDynModelLight(sprite->actor, lightdata);
|
|
||||||
sprite->dynlightindex = GLRenderer->mLights->UploadLights(lightdata);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sprite->dynlightindex = -1;
|
|
||||||
|
|
||||||
auto newsprt = gl_drawinfo->drawlists[list].NewSprite();
|
auto newsprt = gl_drawinfo->drawlists[list].NewSprite();
|
||||||
*newsprt = *sprite;
|
*newsprt = *sprite;
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,7 +261,6 @@ void FDrawInfo::DrawWall(GLWall *wall, int pass)
|
||||||
switch (pass)
|
switch (pass)
|
||||||
{
|
{
|
||||||
case GLPASS_ALL:
|
case GLPASS_ALL:
|
||||||
case GLPASS_PLAIN:
|
|
||||||
RenderTexturedWall(wall, GLWall::RWF_TEXTURED);
|
RenderTexturedWall(wall, GLWall::RWF_TEXTURED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,8 @@ public:
|
||||||
virtual void AddFlat(GLFlat *flat, bool fog) = 0;
|
virtual void AddFlat(GLFlat *flat, bool fog) = 0;
|
||||||
virtual void AddSprite(GLSprite *sprite, bool translucent) = 0;
|
virtual void AddSprite(GLSprite *sprite, bool translucent) = 0;
|
||||||
|
|
||||||
|
virtual int UploadLights(FDynLightData &data) = 0;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "hwrenderer/utility/hw_clock.h"
|
#include "hwrenderer/utility/hw_clock.h"
|
||||||
#include "hwrenderer/utility/hw_lighting.h"
|
#include "hwrenderer/utility/hw_lighting.h"
|
||||||
#include "hwrenderer/textures/hw_material.h"
|
#include "hwrenderer/textures/hw_material.h"
|
||||||
|
#include "hwrenderer/dynlights/hw_dynlightdata.h"
|
||||||
|
|
||||||
extern TArray<spritedef_t> sprites;
|
extern TArray<spritedef_t> sprites;
|
||||||
extern TArray<spriteframe_t> SpriteFrames;
|
extern TArray<spriteframe_t> SpriteFrames;
|
||||||
|
@ -217,6 +218,16 @@ bool GLSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v)
|
||||||
|
|
||||||
inline void GLSprite::PutSprite(HWDrawInfo *di, bool translucent)
|
inline void GLSprite::PutSprite(HWDrawInfo *di, bool translucent)
|
||||||
{
|
{
|
||||||
|
// That's a lot of checks...
|
||||||
|
if (modelframe && RenderStyle.BlendOp != STYLEOP_Shadow && gl_light_sprites && level.HasDynamicLights && di->FixedColormap == CM_DEFAULT && !fullbright && !(screen->hwcaps & RFL_NO_SHADERS))
|
||||||
|
{
|
||||||
|
hw_GetDynModelLight(actor, lightdata);
|
||||||
|
dynlightindex = di->UploadLights(lightdata);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dynlightindex = -1;
|
||||||
|
|
||||||
|
|
||||||
di->AddSprite(this, translucent);
|
di->AddSprite(this, translucent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue