From 533b842a00a62aa0629f65e099a06612ec6328bd Mon Sep 17 00:00:00 2001 From: Garux Date: Tue, 5 Dec 2017 16:08:19 +0300 Subject: [PATCH] * Valve220 to AP brush type conversion: one is lossless, when it is possible --- radiant/brush_primit.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/radiant/brush_primit.cpp b/radiant/brush_primit.cpp index 509d9419..77f35e9b 100644 --- a/radiant/brush_primit.cpp +++ b/radiant/brush_primit.cpp @@ -2069,9 +2069,15 @@ void Texdef_Convert( TexdefTypeId in, TexdefTypeId out, const Plane3& plane, Tex switch( out ) { case TEXDEFTYPEID_QUAKE: { if( in == TEXDEFTYPEID_VALVE ){ - texdef_t texdef; - projection.m_texdef = texdef; - TexDef_Construct_Default( projection ); + Matrix4 local2tex; + Texdef_Construct_local2tex( projection, width, height, plane.normal(), local2tex ); + BPTexdef_fromST011( projection, plane, local2tex ); + BPTexdef_normalise( projection.m_brushprimit_texdef, (float)width, (float)height ); + + TexdefTypeId tmp = g_bp_globals.m_texdefTypeId; + g_bp_globals.m_texdefTypeId = TEXDEFTYPEID_BRUSHPRIMITIVES; + AP_from_BP( plane, projection, width, height ); + g_bp_globals.m_texdefTypeId = tmp; } else if( in == TEXDEFTYPEID_BRUSHPRIMITIVES ){ AP_from_BP( plane, projection, width, height );