- preparations for textured dynamic lights.

This commit is contained in:
Christoph Oelckers 2016-04-27 23:19:54 +02:00
parent 3be33b5725
commit ee7a4daa8c
3 changed files with 51 additions and 7 deletions

View file

@ -991,10 +991,15 @@ static FDrawInfoList di_list;
FDrawInfo::FDrawInfo() FDrawInfo::FDrawInfo()
{ {
next = NULL; next = NULL;
if (gl.lightmethod == LM_SOFTWARE)
{
dldrawlists = new GLDrawList[GLLDL_TYPES];
}
} }
FDrawInfo::~FDrawInfo() FDrawInfo::~FDrawInfo()
{ {
if (dldrawlists != NULL) delete[] dldrawlists;
ClearBuffers(); ClearBuffers();
} }
@ -1018,13 +1023,17 @@ void FDrawInfo::StartScene()
ss_renderflags.Resize(numsubsectors); ss_renderflags.Resize(numsubsectors);
no_renderflags.Resize(numsubsectors); no_renderflags.Resize(numsubsectors);
memset(&sectorrenderflags[0], 0, numsectors*sizeof(sectorrenderflags[0])); memset(&sectorrenderflags[0], 0, numsectors * sizeof(sectorrenderflags[0]));
memset(&ss_renderflags[0], 0, numsubsectors*sizeof(ss_renderflags[0])); memset(&ss_renderflags[0], 0, numsubsectors * sizeof(ss_renderflags[0]));
memset(&no_renderflags[0], 0, numnodes*sizeof(no_renderflags[0])); memset(&no_renderflags[0], 0, numnodes * sizeof(no_renderflags[0]));
next=gl_drawinfo; next = gl_drawinfo;
gl_drawinfo=this; gl_drawinfo = this;
for(int i=0;i<GLDL_TYPES;i++) drawlists[i].Reset(); for (int i = 0; i < GLDL_TYPES; i++) drawlists[i].Reset();
if (dldrawlists != NULL)
{
for (int i = 0; i < GLLDL_TYPES; i++) dldrawlists[i].Reset();
}
} }
//========================================================================== //==========================================================================
@ -1037,6 +1046,10 @@ void FDrawInfo::EndDrawInfo()
FDrawInfo * di = gl_drawinfo; FDrawInfo * di = gl_drawinfo;
for(int i=0;i<GLDL_TYPES;i++) di->drawlists[i].Reset(); for(int i=0;i<GLDL_TYPES;i++) di->drawlists[i].Reset();
if (di->dldrawlists != NULL)
{
for (int i = 0; i < GLLDL_TYPES; i++) di->dldrawlists[i].Reset();
}
gl_drawinfo=di->next; gl_drawinfo=di->next;
di_list.Release(di); di_list.Release(di);
} }

View file

@ -25,6 +25,28 @@ enum DrawListType
GLDL_TYPES, GLDL_TYPES,
}; };
// more lists for handling of dynamic lights
enum DLDrawListType
{
// These are organized so that the various multipass rendering modes have to be set as few times as possible
GLLDL_WALLS_PLAIN, // dynamic lights on normal walls
GLLDL_WALLS_BRIGHT, // dynamic lights on brightmapped walls
GLLDL_WALLS_MASKED, // dynamic lights on masked midtextures
GLLDL_FLATS_PLAIN, // dynamic lights on normal flats
GLLDL_FLATS_BRIGHT, // dynamic lights on brightmapped flats
GLLDL_FLATS_MASKED, // dynamic lights on masked flats
GLLDL_WALLS_FOG, // lights on fogged walls
GLLDL_WALLS_FOGMASKED, // lights on fogged masked midtextures
GLLDL_FLATS_FOG, // lights on fogged walls
GLLDL_FLATS_FOGMASKED, // lights on fogged masked midtextures
GLLDL_TYPES,
};
enum Drawpasses enum Drawpasses
{ {
GLPASS_ALL, // Main pass with dynamic lights GLPASS_ALL, // Main pass with dynamic lights
@ -32,6 +54,12 @@ enum Drawpasses
GLPASS_PLAIN, // Main pass without 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
// these are only used with texture based dynamic lights
GLPASS_BASE, // untextured base for dynamic lights
GLPASS_LIGHTTEX, // lighttexture pass
GLPASS_TEXONLY // finishing texture pass
}; };
//========================================================================== //==========================================================================
@ -199,6 +227,7 @@ struct FDrawInfo
FDrawInfo * next; FDrawInfo * next;
GLDrawList drawlists[GLDL_TYPES]; GLDrawList drawlists[GLDL_TYPES];
GLDrawList *dldrawlists; // only gets allocated when needed.
FDrawInfo(); FDrawInfo();
~FDrawInfo(); ~FDrawInfo();

View file

@ -804,6 +804,8 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
0 0
}; };
//Printf("Trying to create an OpenGL %d.%d %s profile context\n", versions[i] / 10, versions[i] % 10, prof == WGL_CONTEXT_CORE_PROFILE_BIT_ARB ? "Core" : "Compatibility");
m_hRC = myWglCreateContextAttribsARB(m_hDC, 0, ctxAttribs); m_hRC = myWglCreateContextAttribsARB(m_hDC, 0, ctxAttribs);
if (m_hRC != NULL) break; if (m_hRC != NULL) break;
} }
@ -832,7 +834,7 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
} }
} }
// We get here if the driver doesn't support the modern context creation API which always means an old driver. // We get here if the driver doesn't support the modern context creation API which always means an old driver.
I_Error ("R_OPENGL: Unable to create an OpenGL render context.\n"); I_Error ("R_OPENGL: Unable to create an OpenGL render context. Insufficient driver support for context creation\n");
return false; return false;
} }