void Select_ScaleTexture(int x, int y) { brush_t *b; face_t *f; if(selected_brushes.next == &selected_brushes && selected_face == NULL) { return; } for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next) { for (f=b->brush_faces ; f ; f=f->next) { f->texdef.scale[0] += x; f->texdef.scale[1] += y; } Brush_Build(b); if (b->patchBrush) Patch_ScaleTexture(b->nPatchID, x, y); } if (selected_face) { selected_face->texdef.scale[0] += x; selected_face->texdef.scale[1] += y; Brush_Build(selected_face_brush); } Sys_UpdateWindows (W_CAMERA); }
void Select_ScaleTexture( int x, int y ) { brush_s* b; face_s* f; int nFaceCount = g_ptrSelectedFaces.GetSize(); if ( selected_brushes.next == &selected_brushes && nFaceCount == 0 ) { return; } for ( b = selected_brushes.next ; b != &selected_brushes ; b = b->next ) { for ( f = b->brush_faces ; f ; f = f->next ) { if ( g_qeglobals.m_bBrushPrimitMode ) { // apply same scale as the spinner button of the surface inspector float shift[2]; float rotate; float scale[2]; brushprimit_texdef_s bp; // compute normalized texture matrix ConvertTexMatWithQTexture( &f->brushprimit_texdef, f->d_texture, &bp, NULL ); // compute fake shift scale rot TexMatToFakeTexCoords( bp.coords, shift, &rotate, scale ); // update scale[0] += static_cast<float>( x ) * 0.1; scale[1] += static_cast<float>( y ) * 0.1; // compute new normalized texture matrix FakeTexCoordsToTexMat( shift, rotate, scale, bp.coords ); // apply to face texture matrix ConvertTexMatWithQTexture( &bp, NULL, &f->brushprimit_texdef, f->d_texture ); } else { f->texdef.scale[0] += x; f->texdef.scale[1] += y; } } Brush_Build( b ); if ( b->patchBrush ) { Patch_ScaleTexture( b->pPatch, x, y ); } } if ( nFaceCount > 0 ) { for ( int i = 0; i < nFaceCount; i++ ) { face_s* selFace = reinterpret_cast<face_s*>( g_ptrSelectedFaces.GetAt( i ) ); brush_s* selBrush = reinterpret_cast<brush_s*>( g_ptrSelectedFaceBrushes.GetAt( i ) ); if ( g_qeglobals.m_bBrushPrimitMode ) { float shift[2]; float rotate; float scale[2]; brushprimit_texdef_s bp; ConvertTexMatWithQTexture( &selFace->brushprimit_texdef, selFace->d_texture, &bp, NULL ); TexMatToFakeTexCoords( bp.coords, shift, &rotate, scale ); scale[0] += static_cast<float>( x ) * 0.1; scale[1] += static_cast<float>( y ) * 0.1; FakeTexCoordsToTexMat( shift, rotate, scale, bp.coords ); ConvertTexMatWithQTexture( &bp, NULL, &selFace->brushprimit_texdef, selFace->d_texture ); } else { selFace->texdef.scale[0] += x; selFace->texdef.scale[1] += y; } Brush_Build( selBrush ); } } Sys_UpdateWindows( W_CAMERA ); }