From: Garux Date: Tue, 1 Aug 2017 11:28:28 +0000 (+0300) Subject: Radiant: X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a62c7302d3930875aafdc56696f370dbdc5ed40e;p=xonotic%2Fnetradiant.git Radiant: misc... * texbro: disable alpha transparency by def; isn't good in half of cases * find/replace: tooltip helper note about search mode * Entity: arrowheads, showing direction of connection-lines in addition to color-code; New algorithm: are visible in all orthogonal projections * tweak: do not render 'misc_model' & 'light' entity names * filters: patches: +filter ones with surfaceparm playerclip * translucent filter also works for shaders with qer_alphafunc * filter areaportal, if single face matches (allows case with other faces, using 'skip') * filter translucent, if single face matches * filter liquids by surfaceparm {water, lava, slime} in addition to textures/liquids path --- diff --git a/include/ishaders.h b/include/ishaders.h index ac447090..cfd6e0fc 100644 --- a/include/ishaders.h +++ b/include/ishaders.h @@ -31,14 +31,13 @@ enum QER_NOCARVE = 1 << 1, QER_NODRAW = 1 << 2, QER_NONSOLID = 1 << 3, - QER_WATER = 1 << 4, - QER_LAVA = 1 << 5, - QER_FOG = 1 << 6, - QER_ALPHATEST = 1 << 7, - QER_CULL = 1 << 8, - QER_AREAPORTAL = 1 << 9, - QER_CLIP = 1 << 10, - QER_BOTCLIP = 1 << 11, + QER_LIQUID = 1 << 4, + QER_FOG = 1 << 5, + QER_ALPHATEST = 1 << 6, + QER_CULL = 1 << 7, + QER_AREAPORTAL = 1 << 8, + QER_CLIP = 1 << 9, + QER_BOTCLIP = 1 << 10, }; struct qtexture_t; diff --git a/plugins/entity/light.cpp b/plugins/entity/light.cpp index 2d0bf78e..3793824a 100644 --- a/plugins/entity/light.cpp +++ b/plugins/entity/light.cpp @@ -1145,7 +1145,7 @@ void renderSolid( Renderer& renderer, const VolumeTest& volume, const Matrix4& l } void renderWireframe( Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected ) const { renderSolid( renderer, volume, localToWorld, selected ); - if ( g_showNames ) { + if ( g_showNames && !string_equal( m_named.name(), "light" ) ) { renderer.addRenderable( m_renderName, localToWorld ); } } diff --git a/plugins/entity/miscmodel.cpp b/plugins/entity/miscmodel.cpp index e6197d09..758152c4 100644 --- a/plugins/entity/miscmodel.cpp +++ b/plugins/entity/miscmodel.cpp @@ -199,7 +199,7 @@ void renderSolid( Renderer& renderer, const VolumeTest& volume, const Matrix4& l } void renderWireframe( Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected ) const { renderSolid( renderer, volume, localToWorld, selected ); - if ( g_showNames ) { + if ( g_showNames && !string_equal( m_named.name(), "misc_model" ) ) { renderer.addRenderable( m_renderName, localToWorld ); } } diff --git a/plugins/entity/targetable.h b/plugins/entity/targetable.h index 6de382cf..52a39425 100644 --- a/plugins/entity/targetable.h +++ b/plugins/entity/targetable.h @@ -184,9 +184,57 @@ TargetLinesPushBack( RenderablePointVector& targetLines, const Vector3& worldPos m_targetLines( targetLines ), m_worldPosition( worldPosition ), m_volume( volume ){ } void operator()( const Vector3& worldPosition ) const { - if ( m_volume.TestLine( segment_for_startend( m_worldPosition, worldPosition ) ) ) { + Vector3 dir( worldPosition - m_worldPosition );//end - start + double len = vector3_length( dir ); + if ( len != 0 && m_volume.TestLine( segment_for_startend( m_worldPosition, worldPosition ) ) ) { m_targetLines.push_back( PointVertex( reinterpret_cast( m_worldPosition ) ) ); m_targetLines.push_back( PointVertex( reinterpret_cast( worldPosition ) ) ); + + Vector3 mid( ( worldPosition + m_worldPosition ) * 0.5f ); + //vector3_normalise( dir ); + dir /= len; + Vector3 hack( 0.57735, 0.57735, 0.57735 ); + int maxI = 0; + float max = 0; + for ( int i = 0; i < 3 ; ++i ){ + if ( dir[i] < 0 ){ + hack[i] *= -1; + } + if ( fabs( dir[i] ) > max ){ + maxI = i; + } + } + hack[maxI] *= -1; + + Vector3 ort( vector3_cross( dir, hack ) ); + //vector3_normalise( ort ); + Vector3 wing1( mid - dir*12 + ort*6 ); + Vector3 wing2( wing1 - ort*12 ); + + if( len <= 512 || len > 768 ){ + m_targetLines.push_back( PointVertex( reinterpret_cast( mid ) ) ); + m_targetLines.push_back( PointVertex( reinterpret_cast( wing1 ) ) ); + m_targetLines.push_back( PointVertex( reinterpret_cast( mid ) ) ); + m_targetLines.push_back( PointVertex( reinterpret_cast( wing2 ) ) ); + } + if( len > 512 ){ + Vector3 wing1_delta( mid - wing1 ); + Vector3 wing2_delta( mid - wing2 ); + Vector3 point( m_worldPosition + dir*256 ); + wing1 = point - wing1_delta; + wing2 = point - wing2_delta; + m_targetLines.push_back( PointVertex( reinterpret_cast( point ) ) ); + m_targetLines.push_back( PointVertex( reinterpret_cast( wing1 ) ) ); + m_targetLines.push_back( PointVertex( reinterpret_cast( point ) ) ); + m_targetLines.push_back( PointVertex( reinterpret_cast( wing2 ) ) ); + point = worldPosition - dir*256; + wing1 = point - wing1_delta; + wing2 = point - wing2_delta; + m_targetLines.push_back( PointVertex( reinterpret_cast( point ) ) ); + m_targetLines.push_back( PointVertex( reinterpret_cast( wing1 ) ) ); + m_targetLines.push_back( PointVertex( reinterpret_cast( point ) ) ); + m_targetLines.push_back( PointVertex( reinterpret_cast( wing2 ) ) ); + } } } }; @@ -253,7 +301,7 @@ RenderableTargetingEntity( TargetingEntity& targets ) } void compile( const VolumeTest& volume, const Vector3& world_position ) const { m_target_lines.clear(); - m_target_lines.reserve( m_targets.size() * 2 ); + m_target_lines.reserve( m_targets.size() * 14 ); TargetingEntity_forEach( m_targets, TargetLinesPushBack( m_target_lines, world_position, volume ) ); } void render( Renderer& renderer, const VolumeTest& volume, const Vector3& world_position ) const { diff --git a/plugins/shaders/shaders.cpp b/plugins/shaders/shaders.cpp index 44cc0baf..eda91d4f 100644 --- a/plugins/shaders/shaders.cpp +++ b/plugins/shaders/shaders.cpp @@ -633,7 +633,7 @@ bool ShaderTemplate::parseDoom3( Tokeniser& tokeniser ){ m_nFlags |= QER_NONSOLID; } else if ( string_equal_nocase( token, "liquid" ) ) { - m_nFlags |= QER_WATER; + m_nFlags |= QER_LIQUID; } else if ( string_equal_nocase( token, "areaportal" ) ) { m_nFlags |= QER_AREAPORTAL; @@ -1266,11 +1266,10 @@ bool ShaderTemplate::parseQuake3( Tokeniser& tokeniser ){ else if ( string_equal_nocase( surfaceparm, "nonsolid" ) ) { m_nFlags |= QER_NONSOLID; } - else if ( string_equal_nocase( surfaceparm, "water" ) ) { - m_nFlags |= QER_WATER; - } - else if ( string_equal_nocase( surfaceparm, "lava" ) ) { - m_nFlags |= QER_LAVA; + else if ( string_equal_nocase( surfaceparm, "water" ) || + string_equal_nocase( surfaceparm, "lava" ) || + string_equal_nocase( surfaceparm, "slime") ){ + m_nFlags |= QER_LIQUID; } else if ( string_equal_nocase( surfaceparm, "areaportal" ) ) { m_nFlags |= QER_AREAPORTAL; diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index 11db0ba9..11858947 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -979,9 +979,12 @@ filter_brush_all_faces g_filter_brush_caulk( &g_filter_face_caulk ); filter_face_shader_prefix g_filter_face_caulk_ja( "textures/system/caulk" ); filter_brush_all_faces g_filter_brush_caulk_ja( &g_filter_face_caulk_ja ); -filter_face_shader_prefix g_filter_face_liquids( "textures/liquids/" ); +filter_face_flags g_filter_face_liquids( QER_LIQUID ); filter_brush_any_face g_filter_brush_liquids( &g_filter_face_liquids ); +filter_face_shader_prefix g_filter_face_liquidsdir( "textures/liquids/" ); +filter_brush_any_face g_filter_brush_liquidsdir( &g_filter_face_liquidsdir ); + filter_face_shader g_filter_face_hint( "textures/common/hint" ); filter_brush_any_face g_filter_brush_hint( &g_filter_face_hint ); @@ -995,7 +998,7 @@ filter_face_shader g_filter_face_hint_ja( "textures/system/hint" ); filter_brush_any_face g_filter_brush_hint_ja( &g_filter_face_hint_ja ); filter_face_shader g_filter_face_areaportal( "textures/common/areaportal" ); -filter_brush_all_faces g_filter_brush_areaportal( &g_filter_face_areaportal ); +filter_brush_any_face g_filter_brush_areaportal( &g_filter_face_areaportal ); filter_face_shader g_filter_face_visportal( "textures/editor/visportal" ); filter_brush_any_face g_filter_brush_visportal( &g_filter_face_visportal ); @@ -1006,8 +1009,8 @@ filter_brush_all_faces g_filter_brush_clusterportal( &g_filter_face_clusterporta filter_face_shader g_filter_face_lightgrid( "textures/common/lightgrid" ); filter_brush_all_faces g_filter_brush_lightgrid( &g_filter_face_lightgrid ); -filter_face_flags g_filter_face_translucent( QER_TRANS ); -filter_brush_all_faces g_filter_brush_translucent( &g_filter_face_translucent ); +filter_face_flags g_filter_face_translucent( QER_TRANS | QER_ALPHATEST ); +filter_brush_any_face g_filter_brush_translucent( &g_filter_face_translucent ); filter_face_contents g_filter_face_detail( BRUSH_DETAIL_MASK ); filter_brush_all_faces g_filter_brush_detail( &g_filter_face_detail ); @@ -1028,6 +1031,7 @@ void BrushFilters_construct(){ add_face_filter( g_filter_face_caulk, EXCLUDE_CAULK ); add_face_filter( g_filter_face_caulk_ja, EXCLUDE_CAULK ); add_brush_filter( g_filter_brush_liquids, EXCLUDE_LIQUIDS ); + add_brush_filter( g_filter_brush_liquidsdir, EXCLUDE_LIQUIDS ); add_brush_filter( g_filter_brush_hint, EXCLUDE_HINTSSKIPS ); add_brush_filter( g_filter_brush_hintlocal, EXCLUDE_HINTSSKIPS ); add_brush_filter( g_filter_brush_hint_q2, EXCLUDE_HINTSSKIPS ); diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 37379c57..8452a760 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -169,7 +169,8 @@ GtkWindow* FindTextureDialog::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); - label = gtk_label_new( "Replace:" ); + label = gtk_label_new( "Replace:*" ); + gtk_widget_set_tooltip_text( label, "Empty = search mode" ); gtk_widget_show( label ); gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2, (GtkAttachOptions) ( GTK_FILL ), @@ -187,6 +188,7 @@ GtkWindow* FindTextureDialog::BuildDialog(){ GlobalTextureEntryCompletion::instance().connect( GTK_ENTRY( entry ) ); entry = gtk_entry_new(); + gtk_widget_set_tooltip_text( entry, "Empty = search mode" ); gtk_widget_show( entry ); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index b941e2ae..8d7d5f99 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -774,13 +774,15 @@ bool filter( const Patch& patch ) const { filter_patch_all g_filter_patch_all; -filter_patch_shader g_filter_patch_clip( "textures/common/clip" ); +filter_patch_flags g_filter_patch_clip( QER_CLIP ); +filter_patch_shader g_filter_patch_commonclip( "textures/common/clip" ); filter_patch_shader g_filter_patch_weapclip( "textures/common/weapclip" ); -filter_patch_flags g_filter_patch_translucent( QER_TRANS ); +filter_patch_flags g_filter_patch_translucent( QER_TRANS | QER_ALPHATEST ); void PatchFilters_construct(){ add_patch_filter( g_filter_patch_all, EXCLUDE_CURVES ); add_patch_filter( g_filter_patch_clip, EXCLUDE_CLIP ); + add_patch_filter( g_filter_patch_commonclip, EXCLUDE_CLIP ); add_patch_filter( g_filter_patch_weapclip, EXCLUDE_CLIP ); add_patch_filter( g_filter_patch_translucent, EXCLUDE_TRANSLUCENT ); } diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index ea928af8..60e9c101 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -134,7 +134,7 @@ namespace bool g_TextureBrowser_shaderlistOnly = false; bool g_TextureBrowser_fixedSize = true; bool g_TextureBrowser_filterNotex = false; -bool g_TextureBrowser_enableAlpha = true; +bool g_TextureBrowser_enableAlpha = false; } class DeferredAdjustment diff --git a/setup/data/tools/global.xlink b/setup/data/tools/global.xlink index 1e16121f..17fa8456 100644 --- a/setup/data/tools/global.xlink +++ b/setup/data/tools/global.xlink @@ -8,7 +8,7 @@ - +