Rewrote code to control Texture Filtering a little so it's easier to apply Mipmaps for different parts of the game independently; Made Movie Filtering a menu option which must be enabled seperately; Added Movie Subtitles toggle to misc game options
This commit is contained in:
parent
8a79002f2d
commit
a68da514b6
|
@ -34,6 +34,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include "gamefont.h"
|
#include "gamefont.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
#include "config.h"
|
||||||
#ifdef OGL
|
#ifdef OGL
|
||||||
#include "ogl_init.h"
|
#include "ogl_init.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -570,7 +571,7 @@ void ogl_font_choose_size(grs_font * font,int gap,int *rw,int *rh){
|
||||||
|
|
||||||
void ogl_init_font(grs_font * font)
|
void ogl_init_font(grs_font * font)
|
||||||
{
|
{
|
||||||
int oglflags = OGL_FLAG_ALPHA | OGL_FLAG_MIPMAP;
|
int oglflags = OGL_FLAG_ALPHA;
|
||||||
int nchars = font->ft_maxchar-font->ft_minchar+1;
|
int nchars = font->ft_maxchar-font->ft_minchar+1;
|
||||||
int i,w,h,tw,th,x,y,curx=0,cury=0;
|
int i,w,h,tw,th,x,y,curx=0,cury=0;
|
||||||
unsigned char *fp;
|
unsigned char *fp;
|
||||||
|
@ -585,6 +586,8 @@ void ogl_init_font(grs_font * font)
|
||||||
|
|
||||||
if (!(font->ft_flags & FT_COLOR))
|
if (!(font->ft_flags & FT_COLOR))
|
||||||
oglflags |= OGL_FLAG_NOCOLOR;
|
oglflags |= OGL_FLAG_NOCOLOR;
|
||||||
|
if (GameCfg.TexFilt)
|
||||||
|
oglflags |= OGL_FLAG_MIPMAP;
|
||||||
ogl_init_texture(font->ft_parent_bitmap.gltexture = ogl_get_free_texture(), tw, th, oglflags); // have to init the gltexture here so the subbitmaps will find it.
|
ogl_init_texture(font->ft_parent_bitmap.gltexture = ogl_get_free_texture(), tw, th, oglflags); // have to init the gltexture here so the subbitmaps will find it.
|
||||||
|
|
||||||
font->ft_bitmaps=(grs_bitmap*)d_malloc( nchars * sizeof(grs_bitmap));
|
font->ft_bitmaps=(grs_bitmap*)d_malloc( nchars * sizeof(grs_bitmap));
|
||||||
|
|
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
||||||
20100902
|
20100902
|
||||||
--------
|
--------
|
||||||
arch/sdl/digi_mixer.c, arch/sdl/digi_mixer_music.c, arch/sdl/jukebox.c, d1x-rebirth.xcodeproj/project.pbxproj, main/multi.h: On Mac OS X - no longer have to copy SDL_mixer.h to SDL framework; frameworks can now be in /Library/Frameworks; fix for obscure compile error involving u_int32_t
|
arch/sdl/digi_mixer.c, arch/sdl/digi_mixer_music.c, arch/sdl/jukebox.c, d1x-rebirth.xcodeproj/project.pbxproj, main/multi.h: On Mac OS X - no longer have to copy SDL_mixer.h to SDL framework; frameworks can now be in /Library/Frameworks; fix for obscure compile error involving u_int32_t
|
||||||
|
include/ogl_init.h, 2d/font.c, arch/ogl/ogl.c, arch/ogl/gr.c: Rewrote code to control Texture Filtering a little so it's easier to apply Mipmaps for different parts of the game independently
|
||||||
|
|
||||||
20100901
|
20100901
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -298,22 +298,6 @@ int ogl_atotexfilti(char *a,int min)
|
||||||
Error("unknown/invalid texture filter %s\n",a);
|
Error("unknown/invalid texture filter %s\n",a);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogl_testneedmipmaps(int i)
|
|
||||||
{
|
|
||||||
switch (i)
|
|
||||||
{
|
|
||||||
case GL_NEAREST:
|
|
||||||
case GL_LINEAR:
|
|
||||||
return 0;
|
|
||||||
case GL_NEAREST_MIPMAP_NEAREST:
|
|
||||||
case GL_NEAREST_MIPMAP_LINEAR:
|
|
||||||
case GL_LINEAR_MIPMAP_NEAREST:
|
|
||||||
case GL_LINEAR_MIPMAP_LINEAR:
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
Error("unknown texture filter %x\n",i);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char *OglLibPath="opengl32.dll";
|
char *OglLibPath="opengl32.dll";
|
||||||
|
|
||||||
|
@ -343,24 +327,6 @@ int ogl_init_load_library(void)
|
||||||
|
|
||||||
void gr_set_attributes(void)
|
void gr_set_attributes(void)
|
||||||
{
|
{
|
||||||
switch (GameCfg.TexFilt)
|
|
||||||
{
|
|
||||||
case 2:
|
|
||||||
OglTexMagFilt = GL_LINEAR;
|
|
||||||
OglTexMinFilt = GL_LINEAR_MIPMAP_LINEAR;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
OglTexMagFilt = GL_LINEAR;
|
|
||||||
OglTexMinFilt = GL_LINEAR_MIPMAP_NEAREST;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
OglTexMagFilt = GL_NEAREST;
|
|
||||||
OglTexMinFilt = GL_NEAREST;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
GL_needmipmaps=ogl_testneedmipmaps(OglTexMinFilt);
|
|
||||||
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,0);
|
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,0);
|
||||||
SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,0);
|
SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,0);
|
||||||
|
|
|
@ -66,10 +66,6 @@
|
||||||
|
|
||||||
unsigned char *ogl_pal=gr_palette;
|
unsigned char *ogl_pal=gr_palette;
|
||||||
|
|
||||||
int GL_needmipmaps=0;
|
|
||||||
float OglTexMagFilt=GL_NEAREST;
|
|
||||||
float OglTexMinFilt=GL_NEAREST;
|
|
||||||
|
|
||||||
int last_width=-1,last_height=-1;
|
int last_width=-1,last_height=-1;
|
||||||
int GL_TEXTURE_2D_enabled=-1;
|
int GL_TEXTURE_2D_enabled=-1;
|
||||||
int GL_texclamp_enabled=-1;
|
int GL_texclamp_enabled=-1;
|
||||||
|
@ -928,11 +924,7 @@ bool ogl_ubitblt_i(int dw,int dh,int dx,int dy, int sw, int sh, int sx, int sy,
|
||||||
ogl_texture tex;
|
ogl_texture tex;
|
||||||
r_ubitbltc++;
|
r_ubitbltc++;
|
||||||
|
|
||||||
if (mipmap) {
|
ogl_init_texture(&tex, sw, sh, (mipmap?OGL_FLAG_MIPMAP:OGL_FLAG_ALPHA));
|
||||||
ogl_init_texture(&tex, sw, sh, OGL_FLAG_MIPMAP);
|
|
||||||
} else {
|
|
||||||
ogl_init_texture(&tex, sw, sh, OGL_FLAG_ALPHA);
|
|
||||||
}
|
|
||||||
tex.prio = 0.0;
|
tex.prio = 0.0;
|
||||||
tex.lw=src->bm_rowsize;
|
tex.lw=src->bm_rowsize;
|
||||||
|
|
||||||
|
@ -1330,14 +1322,14 @@ int ogl_loadtexture (unsigned char *data, int dxo, int dyo, ogl_texture *tex, in
|
||||||
OGL_BINDTEXTURE(tex->handle);
|
OGL_BINDTEXTURE(tex->handle);
|
||||||
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
if (tex->wantmip){
|
if (tex->wantmip){
|
||||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, OglTexMagFilt);
|
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, OglTexMinFilt);
|
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GameCfg.TexFilt==2?GL_LINEAR_MIPMAP_LINEAR:GL_LINEAR_MIPMAP_NEAREST));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
}
|
}
|
||||||
if (tex->wantmip && GL_needmipmaps)
|
if (tex->wantmip)
|
||||||
gluBuild2DMipmaps (
|
gluBuild2DMipmaps (
|
||||||
GL_TEXTURE_2D, tex->internalformat,
|
GL_TEXTURE_2D, tex->internalformat,
|
||||||
tex->tw, tex->th, tex->format,
|
tex->tw, tex->th, tex->format,
|
||||||
|
@ -1439,7 +1431,7 @@ void ogl_loadbmtexture_f(grs_bitmap *bm, int flags)
|
||||||
|
|
||||||
void ogl_loadbmtexture(grs_bitmap *bm)
|
void ogl_loadbmtexture(grs_bitmap *bm)
|
||||||
{
|
{
|
||||||
ogl_loadbmtexture_f(bm, OGL_FLAG_MIPMAP);
|
ogl_loadbmtexture_f(bm, (GameCfg.TexFilt?OGL_FLAG_MIPMAP:0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ogl_freetexture(ogl_texture *gltexture)
|
void ogl_freetexture(ogl_texture *gltexture)
|
||||||
|
|
|
@ -64,9 +64,6 @@ extern int ogl_rgb_internalformat;
|
||||||
void ogl_init_shared_palette(void);
|
void ogl_init_shared_palette(void);
|
||||||
|
|
||||||
extern int gl_initialized;
|
extern int gl_initialized;
|
||||||
extern int GL_needmipmaps;
|
|
||||||
extern float OglTexMagFilt;
|
|
||||||
extern float OglTexMinFilt;
|
|
||||||
|
|
||||||
extern int active_texture_unit;
|
extern int active_texture_unit;
|
||||||
void ogl_setActiveTexture(int t);
|
void ogl_setActiveTexture(int t);
|
||||||
|
|
Loading…
Reference in a new issue