Fix T44464: Viewport mipmaps no longer toggle off

This commit is contained in:
Campbell Barton 2015-04-28 01:14:48 +10:00
parent 8d8d1939fa
commit 84db9fdf4d
Notes: blender-bot 2023-02-14 11:28:43 +01:00
Referenced by issue #44464, Viewport mipmaps no longer toggle off
3 changed files with 28 additions and 14 deletions

View File

@ -239,8 +239,12 @@ static struct GPUTextureState {
int curtileYRep, tileYRep;
Image *ima, *curima;
bool domipmap, linearmipmap;
bool texpaint; /* store this so that new images created while texture painting won't be set to mipmapped */
/* also controls min/mag filtering */
bool domipmap;
/* only use when 'domipmap' is set */
bool linearmipmap;
/* store this so that new images created while texture painting won't be set to mipmapped */
bool texpaint;
int alphablend;
float anisotropic;
@ -292,7 +296,6 @@ void GPU_set_mipmap(bool mipmap)
void GPU_set_linear_mipmap(bool linear)
{
if (GTS.linearmipmap != linear) {
GPU_free_images();
GTS.linearmipmap = linear;
}
}
@ -312,18 +315,23 @@ static GLenum gpu_get_mipmap_filter(bool mag)
/* linearmipmap is off by default *when mipmapping is off,
* use unfiltered display */
if (mag) {
if (GTS.linearmipmap || GTS.domipmap)
if (GTS.domipmap)
return GL_LINEAR;
else
return GL_NEAREST;
}
else {
if (GTS.linearmipmap)
return GL_LINEAR_MIPMAP_LINEAR;
else if (GTS.domipmap)
return GL_LINEAR_MIPMAP_NEAREST;
else
if (GTS.domipmap) {
if (GTS.linearmipmap) {
return GL_LINEAR_MIPMAP_LINEAR;
}
else {
return GL_LINEAR_MIPMAP_NEAREST;
}
}
else {
return GL_NEAREST;
}
}
}

View File

@ -1024,6 +1024,7 @@ static int set_ge_parameters(int argc, const char **argv, void *data)
}
/* linearMipMap */
if (STREQ(argv[a], "linearmipmap")) {
GPU_set_mipmap(1);
GPU_set_linear_mipmap(1); //linearMipMap = 1;
}

View File

@ -1074,12 +1074,17 @@ void RAS_OpenGLRasterizer::SetMipmapping(MipmapOption val)
RAS_IRasterizer::MipmapOption RAS_OpenGLRasterizer::GetMipmapping()
{
if (GPU_get_linear_mipmap())
return RAS_IRasterizer::RAS_MIPMAP_LINEAR;
else if (GPU_get_mipmap())
return RAS_IRasterizer::RAS_MIPMAP_NEAREST;
else
if (GPU_get_mipmap()) {
if (GPU_get_linear_mipmap()) {
return RAS_IRasterizer::RAS_MIPMAP_LINEAR;
}
else {
return RAS_IRasterizer::RAS_MIPMAP_NEAREST;
}
}
else {
return RAS_IRasterizer::RAS_MIPMAP_NONE;
}
}
void RAS_OpenGLRasterizer::SetUsingOverrideShader(bool val)