- Fixed "jumping" texcoords when switching to a shader with different size
authornamespace <namespace>
Wed, 17 Jan 2007 12:26:57 +0000 (12:26 +0000)
committernamespace <namespace>
Wed, 17 Jan 2007 12:26:57 +0000 (12:26 +0000)
- (Todo) Toolbar: add button for refresh-models. (Shaderman)
- Aniso fix (Shaderman)
- Translucency fix (Shaderman)

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@136 8a3a26a2-13c4-0310-b231-cf6edde360e5

12 files changed:
CHANGES
TODO
include/igl.h
radiant/brush.h
radiant/brush_primit.h
radiant/mainframe.cpp
radiant/qgl.cpp
radiant/qgl.h
radiant/renderstate.cpp
radiant/textures.cpp
setup/data/tools/bitmaps/refresh_models.bmp [new file with mode: 0644]
setup/win32/components/gtkradiant_data.xml

diff --git a/CHANGES b/CHANGES
index 801e148..23f6ede 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,13 @@
 This is the changelog for developers, != changelog for the end user 
 that we distribute with the binaries. (see changelog)
 
+17/01/2007
+namespace
+- Fixed "jumping" texcoords when switching to a shader with different size
+- (Todo) Toolbar: add button for refresh-models. (Shaderman)
+- Aniso fix (Shaderman)
+- Translucency fix (Shaderman)
+
 05/01/2007
 namespace
 - UFO:Alien Invasion Plugin (mattn2)
diff --git a/TODO b/TODO
index 8ac79e3..6e2e925 100644 (file)
--- a/TODO
+++ b/TODO
@@ -49,7 +49,6 @@ Mouse: support 2-button mouse.
 Grid: background colour should be different when the smallest grid is invisible due to being zoomed out.
 Brush: option to disable dots on selected faces when not in face mode.
 Entity: draw direction arrow for func_door and func_button angle.
-Toolbar: add button for refresh-models.
 Build Menu: support for editing variables.
 Shaders: handle doom3 materials with multiple bumpmaps stage - use first stage, ignore later stages.
 Brush: warn when a brush is dragged into a configuration with <0 volume
index dc49e68..bd5f27c 100644 (file)
@@ -1347,6 +1347,8 @@ typedef void GLvoid;
 #define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
 #define GL_SECONDARY_COLOR_ARRAY 0x845E
 #define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
 #define GL_TEXTURE_FILTER_CONTROL 0x8500
 #define GL_TEXTURE_LOD_BIAS 0x8501
 #define GL_INCR_WRAP 0x8507
index 092652e..4542faf 100644 (file)
@@ -1281,6 +1281,7 @@ public:
     Brush_textureChanged();
     m_observer->shaderChanged();
     updateFiltered();
+       planeChanged();
     SceneChangeNotify();
   }
 
@@ -1906,6 +1907,7 @@ public:
   void shaderChanged()
   {
     updateFiltered();
+       planeChanged();
   }
 
   void evaluateBRep() const
index 3ba75bb..897f19f 100644 (file)
@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "math/vector.h"
 #include "itexdef.h"
+#include "debugging/debugging.h"
 // Timo
 // new brush primitive texdef
 struct brushprimit_texdef_t
@@ -51,6 +52,8 @@ struct brushprimit_texdef_t
   void addScale(std::size_t width, std::size_t height)
   {
 #if 1
+       ASSERT_MESSAGE(width > 0, "shader-width is 0");
+       ASSERT_MESSAGE(height > 0, "shader-height is 0");
     coords[0][0] /= width;
     coords[0][1] /= width;
     coords[0][2] /= width;
index fd54a11..f066482 100644 (file)
@@ -2528,6 +2528,10 @@ GtkToolbar* create_main_toolbar(MainFrame::EViewStyle style)
   // TODO: call light inspector
   //GtkButton* g_view_lightinspector_button = toolbar_append_button(toolbar, "Light Inspector", "lightinspector.bmp", "ToggleLightInspector");
 
+  gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
+  GtkButton* g_refresh_models_button = toolbar_append_button(toolbar, "Refresh Models", "refresh_models.bmp", "RefreshReferences");
+
+
   // disable the console and texture button in the regular layouts
   if(style == MainFrame::eRegular || style == MainFrame::eRegularLeft)
   {
index 5a6477d..18fe053 100644 (file)
@@ -700,6 +700,13 @@ inline void extension_not_implemented(const char* extension)
   globalErrorStream() << "WARNING: OpenGL driver reports support for " << extension << " but does not implement it\n";
 }
 
+float g_maxTextureAnisotropy;
+
+float QGL_maxTextureAnisotropy()
+{
+  return g_maxTextureAnisotropy;
+}
+
 void QGL_sharedContextCreated(OpenGLBinding& table)
 {
   QGL_InitVersion();
@@ -1583,6 +1590,16 @@ void QGL_sharedContextCreated(OpenGLBinding& table)
 
   table.support_ARB_fragment_shader = QGL_ExtensionSupported("GL_ARB_fragment_shader");
   table.support_ARB_shading_language_100 = QGL_ExtensionSupported("GL_ARB_shading_language_100");
+
+  if(QGL_ExtensionSupported("GL_EXT_texture_filter_anisotropic"))
+  {
+    glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &g_maxTextureAnisotropy);
+    globalOutputStream() << "Anisotropic filtering possible (max " << g_maxTextureAnisotropy << "x)\n";
+  }
+  else
+  {
+    globalOutputStream() << "No Anisotropic filtering available\n";
+  }
 }
 
 void QGL_sharedContextDestroyed(OpenGLBinding& table)
index a200d8b..55d1570 100644 (file)
@@ -26,4 +26,8 @@ struct OpenGLBinding;
 void QGL_sharedContextCreated(OpenGLBinding& table);
 void QGL_sharedContextDestroyed(OpenGLBinding& table);
 
+bool QGL_ExtensionSupported(const char* extension);
+
+float QGL_maxTextureAnisotropy();
+
 #endif
index 2f5596d..db71b22 100644 (file)
@@ -2387,7 +2387,11 @@ void OpenGLShader::construct(const char* name)
       state.m_colour[2] = 0;
       state.m_colour[3] = 0.3f;
       state.m_state = RENDER_FILL|RENDER_DEPTHTEST|RENDER_CULLFACE|RENDER_BLEND|RENDER_COLOURWRITE|RENDER_DEPTHWRITE;
-      state.m_sort = OpenGLState::eSortHighlight;
+
+      // The bug "Selecting translucent brushes, such as clip, cause them to disappear leaving
+      // only the red selection box." seems to be fixed by removing the next line.
+
+      // state.m_sort = OpenGLState::eSortHighlight;
       state.m_depthfunc = GL_LEQUAL;
     }
     else if(string_equal(name+1, "CAM_OVERLAY"))
index 77d07ac..ec5c4f5 100644 (file)
@@ -49,6 +49,7 @@ enum ETexturesMode
   eTextures_LINEAR = 3,
   eTextures_LINEAR_MIPMAP_NEAREST = 4,
   eTextures_LINEAR_MIPMAP_LINEAR = 5,
+  eTextures_MAX_ANISOTROPY = 6,
 };
 
 enum TextureCompressionFormat
@@ -90,6 +91,8 @@ texture_globals_t g_texture_globals(GL_RGBA);
 
 void SetTexParameters(ETexturesMode mode)
 {
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f);
+
   switch (mode)
   {
   case eTextures_NEAREST:
@@ -116,6 +119,9 @@ void SetTexParameters(ETexturesMode mode)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
     break;
+  case eTextures_MAX_ANISOTROPY:
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, QGL_maxTextureAnisotropy());
+    break;
   default:
     globalOutputStream() << "invalid texture mode\n";
   }
@@ -703,6 +709,8 @@ void TextureModeImport(ETexturesMode& self, int value)
   case 5:
     Textures_SetMode(eTextures_LINEAR_MIPMAP_LINEAR);
     break;
+  case 6:
+    Textures_SetMode(eTextures_MAX_ANISOTROPY);
   }
 }
 typedef ReferenceCaller1<ETexturesMode, int, TextureModeImport> TextureModeImportCaller;
@@ -729,6 +737,9 @@ void TextureModeExport(ETexturesMode& self, const IntImportCallback& importer)
   case eTextures_LINEAR_MIPMAP_LINEAR:
     importer(5);
     break;
+  case eTextures_MAX_ANISOTROPY:
+    importer(6);
+    break;
   default:
     importer(4);
   }
@@ -755,7 +766,7 @@ void Textures_constructPreferences(PreferencesPage& page)
     FloatExportCallback(FloatExportCaller(g_texture_globals.fGamma))
   );
   {
-    const char* texture_mode[] = { "Nearest", "Nearest Mipmap", "Linear", "Bilinear", "Bilinear Mipmap", "Trilinear" };
+    const char* texture_mode[] = { "Nearest", "Nearest Mipmap", "Linear", "Bilinear", "Bilinear Mipmap", "Trilinear", "Anisotropy" };
     page.appendCombo(
       "Texture Render Mode",
       STRING_ARRAY_RANGE(texture_mode),
diff --git a/setup/data/tools/bitmaps/refresh_models.bmp b/setup/data/tools/bitmaps/refresh_models.bmp
new file mode 100644 (file)
index 0000000..a6a0aa5
Binary files /dev/null and b/setup/data/tools/bitmaps/refresh_models.bmp differ
index 8544624..5d2b0d5 100644 (file)
@@ -34,6 +34,7 @@
     <file name="patch_weld.bmp"/>
     <file name="patch_wireframe.bmp"/>
     <file name="popup_selection.bmp"/>
+    <file name="refresh_models.bmp"/>
     <file name="scalelockx.bmp"/>
     <file name="scalelocky.bmp"/>
     <file name="scalelockz.bmp"/>