Browse Source

Fix the default mipmap filter for textures.

Alex Szpakowski 4 years ago
parent
commit
7e0c7e3a67

+ 5 - 0
src/modules/graphics/Graphics.cpp

@@ -104,6 +104,11 @@ bool isDebugEnabled()
 
 love::Type Graphics::type("graphics", &Module::type);
 
+Graphics::DisplayState::DisplayState()
+{
+	defaultSamplerState.mipmapFilter = SamplerState::MIPMAP_FILTER_LINEAR;
+}
+
 Graphics::Graphics()
 	: width(0)
 	, height(0)

+ 3 - 0
src/modules/graphics/Graphics.h

@@ -869,6 +869,8 @@ protected:
 
 	struct DisplayState
 	{
+		DisplayState();
+
 		Colorf color = Colorf(1.0, 1.0, 1.0, 1.0);
 		Colorf backgroundColor = Colorf(0.0, 0.0, 0.0, 1.0);
 
@@ -901,6 +903,7 @@ protected:
 
 		bool wireframe = false;
 
+		// Default mipmap filter is set in the DisplayState constructor.
 		SamplerState defaultSamplerState = SamplerState();
 	};
 

+ 3 - 0
src/modules/graphics/Texture.cpp

@@ -281,6 +281,9 @@ Texture::Texture(const Settings &settings, const Slices *slices)
 
 	samplerState = gfx->getDefaultSamplerState();
 
+	if (getMipmapCount() == 1)
+		samplerState.mipmapFilter = SamplerState::MIPMAP_FILTER_NONE;
+
 	Quad::Viewport v = {0, 0, (double) width, (double) height};
 	quad.set(new Quad(v, width, height), Acquire::NORETAIN);