- 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()
{
next = NULL;
if (gl.lightmethod == LM_SOFTWARE)
{
dldrawlists = new GLDrawList[GLLDL_TYPES];
}
}
FDrawInfo::~FDrawInfo()
{
if (dldrawlists != NULL) delete[] dldrawlists;
ClearBuffers();
}
@ -1025,6 +1030,10 @@ void FDrawInfo::StartScene()
next = gl_drawinfo;
gl_drawinfo = this;
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;
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;
di_list.Release(di);
}

View file

@ -25,6 +25,28 @@ enum DrawListType
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
{
GLPASS_ALL, // Main pass with dynamic lights
@ -32,6 +54,12 @@ enum Drawpasses
GLPASS_PLAIN, // Main pass without dynamic lights
GLPASS_DECALS, // Draws a decal
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;
GLDrawList drawlists[GLDL_TYPES];
GLDrawList *dldrawlists; // only gets allocated when needed.
FDrawInfo();
~FDrawInfo();

View file

@ -804,6 +804,8 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
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);
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.
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;
}