ifmt(RGB),
min_filter(NEAREST_MIPMAP_LINEAR),
mag_filter(LINEAR),
+ mipmap_levels(0),
max_anisotropy(1.0f),
wrap_s(REPEAT),
wrap_t(REPEAT),
glTexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle_orders+swizzle*4);
}
}
+ if(mask&MIPMAP_LEVELS)
+ set_parameter_i(GL_TEXTURE_MAX_LEVEL, (mipmap_levels ? mipmap_levels-1 : 1000));
}
void Texture::set_parameter_i(GLenum param, int value) const
set_mag_filter(f==NEAREST ? NEAREST : LINEAR);
}
+void Texture::set_mipmap_levels(unsigned l)
+{
+ mipmap_levels = l;
+ update_parameter(MIPMAP_LEVELS);
+}
+
void Texture::set_max_anisotropy(float a)
{
if(a<1.0f)
add("mag_filter", &Loader::mag_filter);
add("max_anisotropy", &Loader::max_anisotropy);
add("min_filter", &Loader::min_filter);
+ add("mipmap_levels", &Loader::mipmap_levels);
add("wrap", &Loader::wrap);
add("wrap_r", &Loader::wrap_r);
add("wrap_s", &Loader::wrap_s);
obj.set_min_filter(f);
}
+void Texture::Loader::mipmap_levels(unsigned l)
+{
+ obj.set_mipmap_levels(l);
+}
+
void Texture::Loader::wrap(TextureWrap w)
{
obj.set_wrap(w);
void mag_filter(TextureFilter);
void max_anisotropy(float);
void min_filter(TextureFilter);
+ void mipmap_levels(unsigned);
void wrap(TextureWrap);
void wrap_r(TextureWrap);
void wrap_s(TextureWrap);
COMPARE = 64,
COMPARE_FUNC = 128,
MAX_ANISOTROPY = 256,
- FORMAT_SWIZZLE = 512
+ FORMAT_SWIZZLE = 512,
+ MIPMAP_LEVELS = 1024
};
enum FormatSwizzle
FormatSwizzle swizzle;
TextureFilter min_filter;
TextureFilter mag_filter;
+ unsigned mipmap_levels;
float max_anisotropy;
TextureWrap wrap_s;
TextureWrap wrap_t;
is not applicable to magnification, LINEAR is used instead. */
void set_filter(TextureFilter);
+ void set_mipmap_levels(unsigned);
+
void set_max_anisotropy(float);
/** Sets the wrapping mode for all coordinates. */
PixelFormat fmt = pixelformat_from_graphics(img.get_format());
if(width==0)
{
- unsigned l = (is_mipmapped(min_filter) ? 0 : 1);
+ unsigned l = (is_mipmapped(min_filter) ? mipmap_levels ? mipmap_levels : 0 : 1);
storage(storage_pixelformat_from_graphics(img.get_format(), srgb), w, l);
}
else if(w!=width)
PixelFormat fmt = pixelformat_from_graphics(img.get_format());
if(width==0)
{
- unsigned l = (is_mipmapped(min_filter) ? 0 : 1);
+ unsigned l = (is_mipmapped(min_filter) ? mipmap_levels ? mipmap_levels : 0 : 1);
storage(storage_pixelformat_from_graphics(img.get_format(), srgb), w, h, l);
}
else if(w!=width || h!=height)
PixelFormat fmt = pixelformat_from_graphics(img.get_format());
if(width==0)
{
- unsigned l = (is_mipmapped(min_filter) ? 0 : 1);
+ unsigned l = (is_mipmapped(min_filter) ? mipmap_levels ? mipmap_levels : 0 : 1);
storage(storage_pixelformat_from_graphics(img.get_format(), srgb), w, h, d, l);
}
else if(w!=width || h!=height || d!=depth)
PixelFormat fmt = pixelformat_from_graphics(img.get_format());
if(size==0)
{
- unsigned l = (is_mipmapped(min_filter) ? 0 : 1);
+ unsigned l = (is_mipmapped(min_filter) ? mipmap_levels ? mipmap_levels : 0 : 1);
storage(storage_pixelformat_from_graphics(img.get_format(), srgb), w, l);
}
else if(w!=size || h!=size)