浏览代码

support mipmapping & anisotropic filtering

David Rose 24 年之前
父节点
当前提交
79c241b0d9
共有 3 个文件被更改,包括 13 次插入1 次删除
  1. 2 0
      panda/src/text/config_text.cxx
  2. 2 0
      panda/src/text/config_text.h
  3. 9 1
      panda/src/text/dynamicTextPage.cxx

+ 2 - 0
panda/src/text/config_text.cxx

@@ -56,6 +56,8 @@ ConfigureFn(config_text) {
 
 const bool text_flatten = config_text.GetBool("text-flatten", true);
 const bool text_update_cleared_glyphs = config_text.GetBool("text-update-cleared-glyphs", false);
+const bool text_mipmap = config_text.GetBool("text-mipmap", true);
+const int text_anisotropic_degree = config_text.GetInt("text-anisotropic-degree", 1);
 const int text_texture_margin = config_text.GetInt("text-texture-margin", 2);
 const float text_poly_margin = config_text.GetFloat("text-poly-margin", 1.0f);
 const int text_page_x_size = config_text.GetInt("text-page-x-size", 256);

+ 2 - 0
panda/src/text/config_text.h

@@ -28,6 +28,8 @@ NotifyCategoryDecl(text, EXPCL_PANDA, EXPTP_PANDA);
 
 extern const bool text_flatten;
 extern const bool text_update_cleared_glyphs;
+extern const bool text_mipmap;
+extern const int text_anisotropic_degree;
 extern const int text_texture_margin;
 extern const float text_poly_margin;
 extern const int text_page_x_size;

+ 9 - 1
panda/src/text/dynamicTextPage.cxx

@@ -50,7 +50,15 @@ DynamicTextPage(DynamicTextFont *font) :
   // regenerate those every time the texture changes, but we do want
   // at least linear filtering.
   set_magfilter(FT_linear);
-  set_minfilter(FT_linear);
+  if (text_mipmap) {
+    set_minfilter(FT_linear_mipmap_linear);
+  } else {
+    set_minfilter(FT_linear);
+  }
+
+  // Anisotropic filtering can help the look of the text, and doesn't
+  // require generating mipmaps, but does require hardware support.
+  set_anisotropic_degree(text_anisotropic_degree);
 
   // It's slightly better to let the texture clamp, rather than
   // wrapping, so we're less likely to get bleeding at the edges.