* Valve220 to AP brush type conversion: one is lossless, when it is possible

This commit is contained in:
Garux 2017-12-05 16:08:19 +03:00
parent 9b644b4680
commit 533b842a00

View File

@ -2069,9 +2069,15 @@ void Texdef_Convert( TexdefTypeId in, TexdefTypeId out, const Plane3& plane, Tex
switch( out ) { switch( out ) {
case TEXDEFTYPEID_QUAKE: { case TEXDEFTYPEID_QUAKE: {
if( in == TEXDEFTYPEID_VALVE ){ if( in == TEXDEFTYPEID_VALVE ){
texdef_t texdef; Matrix4 local2tex;
projection.m_texdef = texdef; Texdef_Construct_local2tex( projection, width, height, plane.normal(), local2tex );
TexDef_Construct_Default( projection ); 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 ){ else if( in == TEXDEFTYPEID_BRUSHPRIMITIVES ){
AP_from_BP( plane, projection, width, height ); AP_from_BP( plane, projection, width, height );