- 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:
Christoph Oelckers 2016-05-01 13:09:13 +02:00
parent 4fb17561bc
commit 50ba1ecde8
4 changed files with 78 additions and 30 deletions

View file

@ -53,6 +53,54 @@
#include "gl/renderer/gl_renderstate.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);
}
else gl_lights = false;
}
}

View file

@ -325,8 +325,8 @@ FTexture * LoadSkin(const char * path, const char * fn)
static int ModelFrameHash(FSpriteModelFrame * smf)
{
const DWORD *table = GetCRCTable ();
DWORD hash = 0xffffffff;
const uint32_t *table = GetCRCTable ();
uint32_t hash = 0xffffffff;
const char * s = (const char *)(&smf->type); // this uses type, sprite and frame for hashing
const char * se= (const char *)(&smf->hashnext);

View file

@ -77,45 +77,45 @@ static void UnpackVector(unsigned short packed, float & nx, float & ny, float &
#pragma pack(4)
struct md3_header_t
{
DWORD Magic;
DWORD Version;
uint32_t Magic;
uint32_t Version;
char Name[MAX_QPATH];
DWORD Flags;
DWORD Num_Frames;
DWORD Num_Tags;
DWORD Num_Surfaces;
DWORD Num_Skins;
DWORD Ofs_Frames;
DWORD Ofs_Tags;
DWORD Ofs_Surfaces;
DWORD Ofs_Eof;
uint32_t Flags;
uint32_t Num_Frames;
uint32_t Num_Tags;
uint32_t Num_Surfaces;
uint32_t Num_Skins;
uint32_t Ofs_Frames;
uint32_t Ofs_Tags;
uint32_t Ofs_Surfaces;
uint32_t Ofs_Eof;
};
struct md3_surface_t
{
DWORD Magic;
uint32_t Magic;
char Name[MAX_QPATH];
DWORD Flags;
DWORD Num_Frames;
DWORD Num_Shaders;
DWORD Num_Verts;
DWORD Num_Triangles;
DWORD Ofs_Triangles;
DWORD Ofs_Shaders;
DWORD Ofs_Texcoord;
DWORD Ofs_XYZNormal;
DWORD Ofs_End;
uint32_t Flags;
uint32_t Num_Frames;
uint32_t Num_Shaders;
uint32_t Num_Verts;
uint32_t Num_Triangles;
uint32_t Ofs_Triangles;
uint32_t Ofs_Shaders;
uint32_t Ofs_Texcoord;
uint32_t Ofs_XYZNormal;
uint32_t Ofs_End;
};
struct md3_triangle_t
{
DWORD vt_index[3];
uint32_t vt_index[3];
};
struct md3_shader_t
{
char Name[MAX_QPATH];
DWORD index;
uint32_t index;
};
struct md3_texcoord_t

View file

@ -47,12 +47,10 @@
#include "gl/system/gl_interface.h"
#include "gl/system/gl_cvars.h"
void gl_PatchMenu();
static TArray<FString> m_Extensions;
RenderContext gl;
int occlusion_type=0;
//==========================================================================
//
//
@ -273,6 +271,7 @@ void gl_LoadExtensions()
FUDGE_FUNC(glDeleteRenderbuffers, EXT);
FUDGE_FUNC(glRenderbufferStorage, EXT);
FUDGE_FUNC(glBindRenderbuffer, EXT);
gl_PatchMenu();
}
//==========================================================================