face_t *f;
brush_t *b;
texdef_to_face_t *position, *prev_pos;
+ brushprimit_texdef_t bp;
if(selected_brushes.next != &selected_brushes)
{
{
position->face = f;
position->brush = b;
- position->texdef = f->texdef;
- position->orig_texdef = f->texdef;
+ position->texdef = f->texdef;
+ if(g_qeglobals.m_bBrushPrimitMode)
+ {
+ ConvertTexMatWithQTexture(&f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture(), &bp, NULL);
+ TexMatToFakeTexCoords(bp.coords, position->texdef.shift, &position->texdef.rotate, position->texdef.scale);
+ position->orig_bp_texdef = bp;
+ }
+ position->orig_texdef = position->texdef;
prev_pos->next = position;
prev_pos = position;
position++;
position->face = f;
position->brush = b;
position->texdef = f->texdef;
- position->orig_texdef = f->texdef;
+ if(g_qeglobals.m_bBrushPrimitMode)
+ {
+ ConvertTexMatWithQTexture(&f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture(), &bp, NULL);
+ TexMatToFakeTexCoords(bp.coords, position->texdef.shift, &position->texdef.rotate, position->texdef.scale);
+ position->orig_bp_texdef = bp;
+ }
+ position->orig_texdef = position->texdef;
prev_pos = position;
for(i=1; i<g_ptrSelectedFaces.GetSize(); i++)
{
position->face = f;
position->brush = b;
position->texdef = f->texdef;
- position->orig_texdef = f->texdef;
+ if(g_qeglobals.m_bBrushPrimitMode)
+ {
+ ConvertTexMatWithQTexture(&f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture(), &bp, NULL);
+ TexMatToFakeTexCoords(bp.coords, position->texdef.shift, &position->texdef.rotate, position->texdef.scale);
+ position->orig_bp_texdef = bp;
+ }
+ position->orig_texdef = position->texdef;
prev_pos->next = position;
prev_pos = position;
}
texdef_to_face_t* texdef_to_face;
bool b_isQuake2;
- if ( ( g_pGameDescription->quake2 ) || ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" ) )
+ if (g_pGameDescription->quake2)
b_isQuake2 = true;
else
b_isQuake2 = false;
if (!texdef_face_list)
return;
-
+
if (b_SetUndoPoint)
{
if(g_ptrSelectedFaces.GetSize() > 1)
if (b_isQuake2)
SetFaceTexdef_Q2(texdef_to_face->face, &texdef_to_face->orig_texdef, bFit_to_Scale);
else
- SetFaceTexdef(texdef_to_face->face, &texdef_to_face->orig_texdef, NULL);
+ SetFaceTexdef(texdef_to_face->face, &texdef_to_face->orig_texdef, &texdef_to_face->orig_bp_texdef, bFit_to_Scale);
Undo_Start("set facelist texdefs");
-
+
if( selected_brushes.next != &selected_brushes )
- Undo_AddBrushList(&selected_brushes);
+ Undo_AddBrushList(&selected_brushes);
else
Undo_AddBrush(texdef_face_list->brush);
-
+
}
- }
-
+ }
+
for(texdef_to_face = texdef_face_list; texdef_to_face; texdef_to_face = texdef_to_face->next)
{
if (b_isQuake2)
SetFaceTexdef_Q2(texdef_to_face->face, &texdef_to_face->texdef, bFit_to_Scale);
else
- SetFaceTexdef(texdef_to_face->face, &texdef_to_face->texdef, NULL , bFit_to_Scale);
- Brush_Build(texdef_to_face->brush);
+ {
+ brushprimit_texdef_t brushprimit_texdef;
+ FakeTexCoordsToTexMat(texdef_to_face->texdef.shift, texdef_to_face->texdef.rotate, texdef_to_face->texdef.scale, brushprimit_texdef.coords);
+ SetFaceTexdef(texdef_to_face->face, &texdef_to_face->texdef, &brushprimit_texdef , bFit_to_Scale);
+ }
+ Brush_Build(texdef_to_face->brush);
if(bFit_to_Scale)
texdef_to_face->texdef = texdef_to_face->face->texdef;
}
-
+
if ( b_SetUndoPoint )
{
if( (selected_brushes.next != &selected_brushes) || (g_ptrSelectedFaces.GetSize() == 1) )
{
if(selected_brushes.next != &selected_brushes)
- Undo_EndBrushList(&selected_brushes);
+ Undo_EndBrushList(&selected_brushes);
else
Undo_EndBrush(texdef_face_list->brush);
-
+
Undo_End();
// Over-write the orig_texdef list, cementing the change.
for(texdef_to_face = texdef_face_list; texdef_to_face; texdef_to_face = texdef_to_face->next)
+ {
texdef_to_face->orig_texdef = texdef_to_face->texdef;
+ texdef_to_face->orig_bp_texdef = texdef_to_face->face->brushprimit_texdef;
+ }
}
}
-
+
Sys_UpdateWindows (W_ALL);
}
void SI_FaceList_FitTexture(texdef_to_face_t* si_texdef_face_list, int nHeight, int nWidth)
{
texdef_to_face_t* temp_texdef_face_list;
+ brushprimit_texdef_t bp;
if (!si_texdef_face_list)
return;
for (temp_texdef_face_list = si_texdef_face_list; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
{
Face_FitTexture(temp_texdef_face_list->face, nHeight, nWidth);
- Brush_Build(temp_texdef_face_list->brush,true,true,false,false);
+ Brush_Build(temp_texdef_face_list->brush,true,true,false,false);
// Write changes to our working Texdef list
+
+ if(g_qeglobals.m_bBrushPrimitMode)
+ {
+ ConvertTexMatWithQTexture(&temp_texdef_face_list->face->brushprimit_texdef, QERApp_Shader_ForName( temp_texdef_face_list->face->texdef.GetName() )->getTexture(), &bp, NULL);
+ TexMatToFakeTexCoords(bp.coords, temp_texdef_face_list->face->texdef.shift, &temp_texdef_face_list->face->texdef.rotate, temp_texdef_face_list->face->texdef.scale);
+ }
temp_texdef_face_list->texdef = temp_texdef_face_list->face->texdef;
}