void Select_RotateTexture(int amt) { 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.rotate += amt; f->texdef.rotate = static_cast<int>(f->texdef.rotate) % 360; } Brush_Build(b); if (b->patchBrush) Patch_RotateTexture(b->nPatchID, amt); } if (selected_face) { selected_face->texdef.rotate += amt; selected_face->texdef.rotate = static_cast<int>(selected_face->texdef.rotate) % 360; Brush_Build(selected_face_brush); } Sys_UpdateWindows (W_CAMERA); }
void Select_RotateTexture( int amt ) { 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 rotate += amt; // 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.rotate += amt; f->texdef.rotate = static_cast<int>( f->texdef.rotate ) % 360; } } Brush_Build( b ); if ( b->patchBrush ) { //Patch_RotateTexture(b->nPatchID, amt); Patch_RotateTexture( b->pPatch, amt ); } } 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 ); rotate += amt; FakeTexCoordsToTexMat( shift, rotate, scale, bp.coords ); ConvertTexMatWithQTexture( &bp, NULL, &selFace->brushprimit_texdef, selFace->d_texture ); } else { selFace->texdef.rotate += amt; selFace->texdef.rotate = static_cast<int>( selFace->texdef.rotate ) % 360; } Brush_Build( selBrush ); } } Sys_UpdateWindows( W_CAMERA ); }