15 if ( a_pTRB ==
TNULL )
31 auto iFileNamePos = iFilePathLength - 1;
33 while ( a_szFileName[ iFileNamePos ] !=
'\\' && a_szFileName[ iFileNamePos ] !=
'/' )
37 TCHAR symbolName[ 132 ] = {
'\0' };
39 auto iFileNameLength = iFilePathLength - iFileNamePos - 4;
41 symbolName[ iFileNameLength ] =
'_';
42 symbolName[ iFileNameLength + 1 ] =
'\0';
96 if ( pSection->GetMaterial() ==
TNULL )
98 auto pTexture = pRenderer->GetTexture( pSection->GetTextureFile() );
102 auto pMaterial = pRenderer->CreateMaterial( pTexture );
103 pSection->SetMaterial( pMaterial );
105 auto iWidth = pRenderer->GetWidth( pMaterial );
106 auto iHeight = pRenderer->GetHeight( pMaterial );
108 auto& uv1 = pSection->GetUVPoint1();
109 uv1.x =
TFLOAT( pSection->GetPoint1X() ) /
TFLOAT( iWidth );
110 uv1.y =
TFLOAT( pSection->GetPoint1Y() ) /
TFLOAT( iHeight );
111 uv1.z =
TFLOAT( pSection->GetPoint2X() ) /
TFLOAT( iWidth );
112 uv1.w =
TFLOAT( pSection->GetPoint1Y() ) /
TFLOAT( iHeight );
114 auto& uv2 = pSection->GetUVPoint2();
115 uv2.x =
TFLOAT( pSection->GetPoint2X() ) /
TFLOAT( iWidth );
116 uv2.y =
TFLOAT( pSection->GetPoint2Y() ) /
TFLOAT( iHeight );
117 uv2.z =
TFLOAT( pSection->GetPoint1X() ) /
TFLOAT( iWidth );
118 uv2.w =
TFLOAT( pSection->GetPoint2Y() ) /
TFLOAT( iHeight );
151 auto pSection = &
g_defblock->m_pSections[ i ];
152 auto pTexture = pRenderer->GetTexture( pSection->GetTextureFile() );
154 if ( pSection->GetMaterial() ==
TNULL )
158 auto pMaterial = pRenderer->CreateMaterial( pTexture );
159 pSection->SetMaterial( pMaterial );
161 auto iWidth = pRenderer->GetWidth( pMaterial );
162 auto iHeight = pRenderer->GetHeight( pMaterial );
164 auto& uv1 = pSection->GetUVPoint1();
165 uv1.x =
TFLOAT( pSection->GetPoint1X() ) *
TFLOAT( iWidth );
166 uv1.y =
TFLOAT( pSection->GetPoint1Y() ) * ( 1.0f /
TFLOAT( iHeight ) );
167 uv1.z =
TFLOAT( pSection->GetPoint2X() ) *
TFLOAT( iWidth );
168 uv1.w =
TFLOAT( pSection->GetPoint1Y() ) * ( 1.0f /
TFLOAT( iHeight ) );
170 auto& uv2 = pSection->GetUVPoint2();
171 uv2.x =
TFLOAT( pSection->GetPoint2X() ) *
TFLOAT( iWidth );
172 uv2.y =
TFLOAT( pSection->GetPoint2Y() ) * ( 1.0f /
TFLOAT( iHeight ) );
173 uv2.z =
TFLOAT( pSection->GetPoint1X() ) *
TFLOAT( iWidth );
174 uv2.w =
TFLOAT( pSection->GetPoint2Y() ) * ( 1.0f /
TFLOAT( iHeight ) );
177 else if ( pTexture ==
TNULL )
179 pRenderer->DestroyMaterial( pSection->GetMaterial() );
180 pSection->SetMaterial(
TNULL );