From: namespace Date: Wed, 17 Jan 2007 12:26:57 +0000 (+0000) Subject: - Fixed "jumping" texcoords when switching to a shader with different size X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7582c2d5d4dd9c8c85587e7e77be34a97496e679;p=xonotic%2Fnetradiant.git - 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) git-svn-id: https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk@136 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- diff --git a/CHANGES b/CHANGES index 801e1483..23f6ede4 100644 --- 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 8ac79e3c..6e2e9259 100644 --- 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 diff --git a/include/igl.h b/include/igl.h index dc49e682..bd5f27c7 100644 --- a/include/igl.h +++ b/include/igl.h @@ -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 diff --git a/radiant/brush.h b/radiant/brush.h index 092652e2..4542faf2 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -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 diff --git a/radiant/brush_primit.h b/radiant/brush_primit.h index 3ba75bb5..897f19f9 100644 --- a/radiant/brush_primit.h +++ b/radiant/brush_primit.h @@ -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; diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index fd54a116..f066482a 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -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) { diff --git a/radiant/qgl.cpp b/radiant/qgl.cpp index 5a6477d1..18fe0532 100644 --- a/radiant/qgl.cpp +++ b/radiant/qgl.cpp @@ -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) diff --git a/radiant/qgl.h b/radiant/qgl.h index a200d8b3..55d1570e 100644 --- a/radiant/qgl.h +++ b/radiant/qgl.h @@ -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 diff --git a/radiant/renderstate.cpp b/radiant/renderstate.cpp index 2f5596d1..db71b226 100644 --- a/radiant/renderstate.cpp +++ b/radiant/renderstate.cpp @@ -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")) diff --git a/radiant/textures.cpp b/radiant/textures.cpp index 77d07ac2..ec5c4f59 100644 --- a/radiant/textures.cpp +++ b/radiant/textures.cpp @@ -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 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 index 00000000..a6a0aa5d Binary files /dev/null and b/setup/data/tools/bitmaps/refresh_models.bmp differ diff --git a/setup/win32/components/gtkradiant_data.xml b/setup/win32/components/gtkradiant_data.xml index 85446242..5d2b0d5e 100644 --- a/setup/win32/components/gtkradiant_data.xml +++ b/setup/win32/components/gtkradiant_data.xml @@ -34,6 +34,7 @@ +