]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
- 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 801e1483afe3c9d746499153bc7d9b06a43f4ef5..23f6ede479e2afeecd1cfd24c97335beadecd6c3 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 8ac79e3cc55b59ac454eaf3b5ad96baaa6235324..6e2e9259713f85b0391a0f485b9954969e4757c7 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 dc49e682858775a13bd8d308f62cd85c5aea50c2..bd5f27c799270759c1718d2b18569ca3e27945dc 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 092652e2107f2b97b57daaa929f3bda4f4b0a5c7..4542faf22e95ac0c03f7c1cd3fb4457dfb3e6b15 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 3ba75bb5d03da6d6a36f1931aeafd03fe21845e8..897f19f9f6d2801862aeec39c1e336a2443b9f37 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 fd54a116334037a196c2e69fb8d0429007f9ba7e..f066482a1728d929a730b5410ceecda2b2bd77ae 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 5a6477d1d2b46a37b94a55b23e3ee30fae27fd19..18fe053260e8d9b25312ac4fdba7634b75d1ceca 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 a200d8b3c35a046d8811bbf471fc2478a76e35e6..55d1570e4583a0478215b6ac35d1dabc62d81579 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 2f5596d13f23ba14d20860bc0d9d0845b6d61ef5..db71b2263ada0dcc11ec2c2ac443adb7bb92a330 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 77d07ac2b8dc9342b971104d97a955087ebbbbd5..ec5c4f599874071499c3a43521bb73e0c086d353 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 85446242063aebe832b31bd05c82d1fc62dfb7f5..5d2b0d5e88da3fe5c207c40df23e9b09c73fdf96 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"/>