From 3e5581c366577bcb3b7745a7567cfddaa38cbff3 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 18 Dec 2000 17:42:29 +0000 Subject: [PATCH] *** empty log message *** --- panda/src/glgsg/config_glgsg.cxx | 4 ++++ panda/src/glgsg/config_glgsg.h | 1 + panda/src/glgsg/glGraphicsStateGuardian.cxx | 20 +++++++++++++------ panda/src/gsgbase/graphicsStateGuardianBase.h | 4 +++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/panda/src/glgsg/config_glgsg.cxx b/panda/src/glgsg/config_glgsg.cxx index 4dc0990840..3ad6a6514e 100644 --- a/panda/src/glgsg/config_glgsg.cxx +++ b/panda/src/glgsg/config_glgsg.cxx @@ -31,6 +31,10 @@ bool gl_cull_traversal = config_glgsg.GetBool("gl-cull-traversal", true); // renderer. bool gl_ignore_mipmaps = config_glgsg.GetBool("gl-ignore-mipmaps", false); +// Configure this true to enable full trilinear mipmapping on every +// texture, whether it asks for it or not. +bool gl_force_mipmaps = config_glgsg.GetBool("gl-force-mipmaps", false); + // Configure this true to cause mipmaps to be rendered with phony // colors, using mipmap_level_*.rgb if they are available. bool gl_show_mipmaps = config_glgsg.GetBool("gl-show-mipmaps", false); diff --git a/panda/src/glgsg/config_glgsg.h b/panda/src/glgsg/config_glgsg.h index 309ecadb08..692f1a3584 100644 --- a/panda/src/glgsg/config_glgsg.h +++ b/panda/src/glgsg/config_glgsg.h @@ -15,6 +15,7 @@ extern bool gl_show_transforms; extern bool gl_cheap_textures; extern bool gl_cull_traversal; extern bool gl_ignore_mipmaps; +extern bool gl_force_mipmaps; extern bool gl_show_mipmaps; // Ways to implement decals. diff --git a/panda/src/glgsg/glGraphicsStateGuardian.cxx b/panda/src/glgsg/glGraphicsStateGuardian.cxx index 9e670aeb37..193307a96f 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.cxx +++ b/panda/src/glgsg/glGraphicsStateGuardian.cxx @@ -3382,10 +3382,18 @@ specify_texture(Texture *tex) { get_texture_wrap_mode(tex->get_wrapu())); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, get_texture_wrap_mode(tex->get_wrapv())); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - get_texture_filter_type(tex->get_minfilter())); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, - get_texture_filter_type(tex->get_magfilter())); + + if (gl_force_mipmaps) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + } else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + get_texture_filter_type(tex->get_minfilter())); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + get_texture_filter_type(tex->get_magfilter())); + } } @@ -3411,7 +3419,7 @@ apply_texture_immediate(Texture *tex) { << (int)type << ", " << tex->get_name() << ")\n"; #endif - if (!gl_ignore_mipmaps) { + if (!gl_ignore_mipmaps || gl_force_mipmaps) { bool use_mipmaps; switch (tex->get_minfilter()) { case Texture::FT_nearest_mipmap_nearest: @@ -3425,7 +3433,7 @@ apply_texture_immediate(Texture *tex) { use_mipmaps = false; break; } - if (use_mipmaps) { + if (use_mipmaps || gl_force_mipmaps) { #ifndef NDEBUG if (gl_show_mipmaps) { build_phony_mipmaps(tex); diff --git a/panda/src/gsgbase/graphicsStateGuardianBase.h b/panda/src/gsgbase/graphicsStateGuardianBase.h index bb6df3fa30..f21840f2d1 100644 --- a/panda/src/gsgbase/graphicsStateGuardianBase.h +++ b/panda/src/gsgbase/graphicsStateGuardianBase.h @@ -168,10 +168,12 @@ public: virtual void begin_decal(GeomNode *) { } virtual void end_decal(GeomNode *) { } -public: +PUBLISHED: static TypeHandle get_class_type() { return _type_handle; } + +public: static void init_type() { TypedReferenceCount::init_type(); register_type(_type_handle, "GraphicsStateGuardianBase",