mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +00:00
- add menu patching for GL 2.x mode.
- use stdint types in model code, because we have to start somewhere with the transition.
This commit is contained in:
parent
4fb17561bc
commit
50ba1ecde8
4 changed files with 78 additions and 30 deletions
|
@ -53,6 +53,54 @@
|
||||||
#include "gl/renderer/gl_renderstate.h"
|
#include "gl/renderer/gl_renderstate.h"
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
#include "gl/scene/gl_drawinfo.h"
|
||||||
|
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// Do some tinkering with the menus so that certain options only appear
|
||||||
|
// when they are actually valid.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void gl_PatchMenu()
|
||||||
|
{
|
||||||
|
if (gl.compatibility == CMPT_GL2)
|
||||||
|
{
|
||||||
|
// Radial fog and Doom lighting are not available in SM < 4 cards
|
||||||
|
// The way they are implemented does not work well on older hardware.
|
||||||
|
|
||||||
|
FOptionValues **opt = OptionValues.CheckKey("LightingModes");
|
||||||
|
if (opt != NULL)
|
||||||
|
{
|
||||||
|
for(int i = (*opt)->mValues.Size()-1; i>=0; i--)
|
||||||
|
{
|
||||||
|
// Delete 'Doom' lighting mode
|
||||||
|
if ((*opt)->mValues[i].Value == 2.0 || (*opt)->mValues[i].Value == 8.0)
|
||||||
|
{
|
||||||
|
(*opt)->mValues.Delete(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
opt = OptionValues.CheckKey("FogMode");
|
||||||
|
if (opt != NULL)
|
||||||
|
{
|
||||||
|
for(int i = (*opt)->mValues.Size()-1; i>=0; i--)
|
||||||
|
{
|
||||||
|
// Delete 'Radial' fog mode
|
||||||
|
if ((*opt)->mValues[i].Value == 2.0)
|
||||||
|
{
|
||||||
|
(*opt)->mValues.Delete(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable features that don't work without shaders.
|
||||||
|
if (gl_lightmode == 2 || gl_lightmode == 8) gl_lightmode = 3;
|
||||||
|
if (gl_fogmode == 2) gl_fogmode = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -499,4 +547,5 @@ void FGLRenderer::RenderMultipassStuff()
|
||||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_FOGMASKED].DrawFlats(GLPASS_LIGHTTEX_ADDITIVE);
|
gl_drawinfo->dldrawlists[GLLDL_FLATS_FOGMASKED].DrawFlats(GLPASS_LIGHTTEX_ADDITIVE);
|
||||||
}
|
}
|
||||||
else gl_lights = false;
|
else gl_lights = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -325,8 +325,8 @@ FTexture * LoadSkin(const char * path, const char * fn)
|
||||||
|
|
||||||
static int ModelFrameHash(FSpriteModelFrame * smf)
|
static int ModelFrameHash(FSpriteModelFrame * smf)
|
||||||
{
|
{
|
||||||
const DWORD *table = GetCRCTable ();
|
const uint32_t *table = GetCRCTable ();
|
||||||
DWORD hash = 0xffffffff;
|
uint32_t hash = 0xffffffff;
|
||||||
|
|
||||||
const char * s = (const char *)(&smf->type); // this uses type, sprite and frame for hashing
|
const char * s = (const char *)(&smf->type); // this uses type, sprite and frame for hashing
|
||||||
const char * se= (const char *)(&smf->hashnext);
|
const char * se= (const char *)(&smf->hashnext);
|
||||||
|
|
|
@ -77,45 +77,45 @@ static void UnpackVector(unsigned short packed, float & nx, float & ny, float &
|
||||||
#pragma pack(4)
|
#pragma pack(4)
|
||||||
struct md3_header_t
|
struct md3_header_t
|
||||||
{
|
{
|
||||||
DWORD Magic;
|
uint32_t Magic;
|
||||||
DWORD Version;
|
uint32_t Version;
|
||||||
char Name[MAX_QPATH];
|
char Name[MAX_QPATH];
|
||||||
DWORD Flags;
|
uint32_t Flags;
|
||||||
DWORD Num_Frames;
|
uint32_t Num_Frames;
|
||||||
DWORD Num_Tags;
|
uint32_t Num_Tags;
|
||||||
DWORD Num_Surfaces;
|
uint32_t Num_Surfaces;
|
||||||
DWORD Num_Skins;
|
uint32_t Num_Skins;
|
||||||
DWORD Ofs_Frames;
|
uint32_t Ofs_Frames;
|
||||||
DWORD Ofs_Tags;
|
uint32_t Ofs_Tags;
|
||||||
DWORD Ofs_Surfaces;
|
uint32_t Ofs_Surfaces;
|
||||||
DWORD Ofs_Eof;
|
uint32_t Ofs_Eof;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct md3_surface_t
|
struct md3_surface_t
|
||||||
{
|
{
|
||||||
DWORD Magic;
|
uint32_t Magic;
|
||||||
char Name[MAX_QPATH];
|
char Name[MAX_QPATH];
|
||||||
DWORD Flags;
|
uint32_t Flags;
|
||||||
DWORD Num_Frames;
|
uint32_t Num_Frames;
|
||||||
DWORD Num_Shaders;
|
uint32_t Num_Shaders;
|
||||||
DWORD Num_Verts;
|
uint32_t Num_Verts;
|
||||||
DWORD Num_Triangles;
|
uint32_t Num_Triangles;
|
||||||
DWORD Ofs_Triangles;
|
uint32_t Ofs_Triangles;
|
||||||
DWORD Ofs_Shaders;
|
uint32_t Ofs_Shaders;
|
||||||
DWORD Ofs_Texcoord;
|
uint32_t Ofs_Texcoord;
|
||||||
DWORD Ofs_XYZNormal;
|
uint32_t Ofs_XYZNormal;
|
||||||
DWORD Ofs_End;
|
uint32_t Ofs_End;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct md3_triangle_t
|
struct md3_triangle_t
|
||||||
{
|
{
|
||||||
DWORD vt_index[3];
|
uint32_t vt_index[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct md3_shader_t
|
struct md3_shader_t
|
||||||
{
|
{
|
||||||
char Name[MAX_QPATH];
|
char Name[MAX_QPATH];
|
||||||
DWORD index;
|
uint32_t index;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct md3_texcoord_t
|
struct md3_texcoord_t
|
||||||
|
|
|
@ -47,12 +47,10 @@
|
||||||
#include "gl/system/gl_interface.h"
|
#include "gl/system/gl_interface.h"
|
||||||
#include "gl/system/gl_cvars.h"
|
#include "gl/system/gl_cvars.h"
|
||||||
|
|
||||||
|
void gl_PatchMenu();
|
||||||
static TArray<FString> m_Extensions;
|
static TArray<FString> m_Extensions;
|
||||||
|
|
||||||
RenderContext gl;
|
RenderContext gl;
|
||||||
|
|
||||||
int occlusion_type=0;
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -273,6 +271,7 @@ void gl_LoadExtensions()
|
||||||
FUDGE_FUNC(glDeleteRenderbuffers, EXT);
|
FUDGE_FUNC(glDeleteRenderbuffers, EXT);
|
||||||
FUDGE_FUNC(glRenderbufferStorage, EXT);
|
FUDGE_FUNC(glRenderbufferStorage, EXT);
|
||||||
FUDGE_FUNC(glBindRenderbuffer, EXT);
|
FUDGE_FUNC(glBindRenderbuffer, EXT);
|
||||||
|
gl_PatchMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue