Scene_forEachVisibleSelectedPatch( PatchTranslateTexture( s, t ) );
}
+static void OnBtnPatchAutoCap( GtkWidget *widget, gpointer data ){
+ Patch_AutoCapTexture();
+}
+
static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
texdef_t td;
GtkHBox* hbox2 = GTK_HBOX( gtk_hbox_new( TRUE, 5 ) );
gtk_widget_show( GTK_WIDGET( hbox2 ) );
gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox2 ), TRUE, FALSE, 0 );
+ {
+ GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Auto Cap" ) );
+ gtk_widget_show( GTK_WIDGET( button ) );
+ gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
+ g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 );
+ gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+ }
{
GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "CAP" ) );
gtk_widget_show( GTK_WIDGET( button ) );
SceneChangeNotify();
}
+
+void PatchAutoCapTexture( Patch& patch ) {
+
+ AABB box = patch.localAABB();
+ float x = box.extents.x();
+ float y = box.extents.y();
+ float z = box.extents.z();
+
+ int cap_direction = -1;
+ if ( x < y && x < z )
+ cap_direction = 0;
+ else if ( y < x && y < z )
+ cap_direction = 1;
+ else if ( z < x && z < x )
+ cap_direction = 2;
+
+ if ( cap_direction >= 0 )
+ patch.ProjectTexture(cap_direction);
+ else
+ patch.NaturalTexture();
+}
+
+void Patch_AutoCapTexture(){
+ UndoableCommand command( "patchAutoCapTexture" );
+ Scene_forEachVisibleSelectedPatch( &PatchAutoCapTexture );
+ SceneChangeNotify();
+}
+
class PatchFlipTexture
{
int m_axis;
void Patch_FitTexture();
void Patch_FlipTextureX();
void Patch_FlipTextureY();
+void Patch_AutoCapTexture();
class PatchCreator;
extern PatchCreator* g_patchCreator;