set text default filters

This commit is contained in:
David Rose 2009-01-21 22:37:30 +00:00
parent 87d3e20bca
commit e8543823a6

View File

@ -41,17 +41,23 @@ StaticTextFont(PandaNode *font_def) {
_font = font_def; _font = font_def;
_glyphs.clear(); _glyphs.clear();
// This bit is a temporary hack. We find all of the textures // If there is no explicit quality level or filter settings on the
// referenced by the font, and hard-set them to the specified // textures in the static font, set the appropriate defaults for
// quality level for text. This should not remain more than a // text.
// couple of weeks; after that time, we'll remove this and require
// users to set their desired quality level in static fonts
// explicitly.
NodePath np(font_def); NodePath np(font_def);
TextureCollection tc = np.find_all_textures(); TextureCollection tc = np.find_all_textures();
int num_textures = tc.get_num_textures(); int num_textures = tc.get_num_textures();
for (int i = 0; i < num_textures; ++i) { for (int i = 0; i < num_textures; ++i) {
tc.get_texture(i)->set_quality_level(text_quality_level); Texture *tex = tc.get_texture(i);
if (tex->get_quality_level() == Texture::QL_default) {
tex->set_quality_level(text_quality_level);
}
if (tex->get_minfilter() == Texture::FT_default) {
tex->set_minfilter(text_minfilter);
}
if (tex->get_magfilter() == Texture::FT_default) {
tex->set_magfilter(text_magfilter);
}
} }
find_characters(font_def, RenderState::make_empty()); find_characters(font_def, RenderState::make_empty());