* -brightness 0..alot, def 1: mimics q3map_lightmapBrightness, but globally + affects vertexlight
	* -contrast -255..255, def 0: lighting contrast
	* packer improvements

Radiant:

binds...
	* entity inspector: Tab enters Key field, toggles between key/value fields; Del deletes keys; Esc quits

misc...
	* improved mwheel 2d zoom by Neumond
	* +makeRoom: like hollow, but extrudes faces outwards; for making rooms
	* deactivating tex dirs tree after loading dir, so SPACE and ENTER aren't broken for 2D after that
	* Regular, RegularLeft layouts: smaller console, bigger tex browser
	* Rotate, Scale dialogs: values aren't erased on Enter, OK, Apply (are on cancel, esc)
	* Rotate dialog: fix: new value in focused field wasn't taking in account on Enter
	* +updating texture directories list on 'flush and reload shaders' (reloading shaderlist aswell)
	* NumLock perspective window fix
	* ctrl+k(ConnectEntities): friendlier to complex connections, takes in account existing keys
		(priority: target > targetname > none)
	* +'all Supported formats' default option in open dialogs
	* defaulted show light radii
	* camera fov: 90->110
	* cubic clip: off by default; bigger def dist; fixed button's shortcut tip
	* prefs: Min & Max texture thumbnail size + dependant on scale;
		def = *scale .5, min 48, max 160 (makes range 96-320 visually differentiated)
This commit is contained in:
Garux 2017-08-01 13:57:26 +03:00
parent 7d7436ec3d
commit 0fb65a91c7
23 changed files with 402 additions and 139 deletions

View File

@ -365,7 +365,9 @@ void Keys_releaseAll( PressedKeys::Keys& keys, guint state ){
gboolean PressedKeys_key_press( GtkWidget* widget, GdkEventKey* event, PressedKeys* pressedKeys ){ gboolean PressedKeys_key_press( GtkWidget* widget, GdkEventKey* event, PressedKeys* pressedKeys ){
//globalOutputStream() << "pressed: " << event->keyval << "\n"; //globalOutputStream() << "pressed: " << event->keyval << "\n";
return event->state == 0 && Keys_press( pressedKeys->keys, event->keyval ); //return event->state == 0 && Keys_press( pressedKeys->keys, event->keyval );
//NumLock perspective window fix
return ( event->state & ALLOWED_MODIFIERS ) == 0 && Keys_press( pressedKeys->keys, event->keyval );
} }
gboolean PressedKeys_key_release( GtkWidget* widget, GdkEventKey* event, PressedKeys* pressedKeys ){ gboolean PressedKeys_key_release( GtkWidget* widget, GdkEventKey* event, PressedKeys* pressedKeys ){

View File

@ -191,6 +191,15 @@ const char* file_dialog_show( GtkWidget* parent, bool open, const char* title, c
// we should add all important paths as shortcut folder... // we should add all important paths as shortcut folder...
// gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(dialog), "/tmp/", NULL); // gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(dialog), "/tmp/", NULL);
if ( open && masks.m_filters.size() > 1 ){
GtkFileFilter* filter = gtk_file_filter_new();
gtk_file_filter_set_name( filter, "Supported formats" );
for ( std::size_t i = 0; i < masks.m_filters.size(); ++i )
{
gtk_file_filter_add_pattern( filter, masks.m_filters[i].c_str() );
}
gtk_file_chooser_add_filter( GTK_FILE_CHOOSER( dialog ), filter );
}
for ( std::size_t i = 0; i < masks.m_filters.size(); ++i ) for ( std::size_t i = 0; i < masks.m_filters.size(); ++i )
{ {
@ -205,7 +214,7 @@ const char* file_dialog_show( GtkWidget* parent, bool open, const char* title, c
if ( !string_equal( pattern, "*" ) ) { if ( !string_equal( pattern, "*" ) ) {
GtkFileFilter* filter = gtk_file_chooser_get_filter( GTK_FILE_CHOOSER( dialog ) ); GtkFileFilter* filter = gtk_file_chooser_get_filter( GTK_FILE_CHOOSER( dialog ) );
if ( filter != 0 ) { // no filter set? some file-chooser implementations may allow the user to set no filter, which we treat as 'all files' if ( filter != 0 && !string_equal( gtk_file_filter_get_name( filter ), "Supported formats" ) ) { // no filter set? some file-chooser implementations may allow the user to set no filter, which we treat as 'all files'
type = masks.GetTypeForGTKMask( gtk_file_filter_get_name( filter ) ).m_type; type = masks.GetTypeForGTKMask( gtk_file_filter_get_name( filter ) ).m_type;
// last ext separator // last ext separator
const char* extension = path_get_extension( g_file_dialog_file ); const char* extension = path_get_extension( g_file_dialog_file );

View File

@ -113,7 +113,7 @@ Counter* EntityKeyValues::m_counter = 0;
bool g_showNames = true; bool g_showNames = true;
bool g_showAngles = true; bool g_showAngles = true;
bool g_newLightDraw = true; bool g_newLightDraw = true;
bool g_lightRadii = false; bool g_lightRadii = true;
class ConnectEntities class ConnectEntities
{ {
@ -208,22 +208,48 @@ void connectEntities( const scene::Path& path, const scene::Path& targetPath, in
else else
{ {
ConnectEntities connector( e1, e2, index ); ConnectEntities connector( e1, e2, index );
const char* value = e2->getKeyValue( "targetname" ); //killconnect
if ( !string_empty( value ) ) { if( index == 1 ){
connector.connect( value ); const char* value = e2->getKeyValue( "targetname" );
} if ( !string_empty( value ) ) {
else connector.connect( value );
{ }
const char* type = e2->getKeyValue( "classname" ); else
if ( string_empty( type ) ) { {
type = "t"; const char* type = e2->getKeyValue( "classname" );
if ( string_empty( type ) ) {
type = "t";
}
StringOutputStream key( 64 );
key << type << "1";
GlobalNamespace().makeUnique( key.c_str(), ConnectEntities::ConnectCaller( connector ) );
}
}
//normal connect
else{
//prioritize existing target key
//checking, if ent got other connected ones already, could be better solution
const char* value = e1->getKeyValue( "target" );
if ( !string_empty( value ) ) {
connector.connect( value );
}
else{
value = e2->getKeyValue( "targetname" );
if ( !string_empty( value ) ) {
connector.connect( value );
}
else{
const char* type = e2->getKeyValue( "classname" );
if ( string_empty( type ) ) {
type = "t";
}
StringOutputStream key( 64 );
key << type << "1";
GlobalNamespace().makeUnique( key.c_str(), ConnectEntities::ConnectCaller( connector ) );
}
} }
StringOutputStream key( 64 );
key << type << "1";
GlobalNamespace().makeUnique( key.c_str(), ConnectEntities::ConnectCaller( connector ) );
} }
} }
SceneChangeNotify(); SceneChangeNotify();
} }
void setLightRadii( bool lightRadii ){ void setLightRadii( bool lightRadii ){

View File

@ -88,7 +88,7 @@ struct camwindow_globals_private_t
m_nAngleSpeed( 3 ), m_nAngleSpeed( 3 ),
m_bCamInverseMouse( false ), m_bCamInverseMouse( false ),
m_bCamDiscrete( true ), m_bCamDiscrete( true ),
m_bCubicClipping( true ), m_bCubicClipping( false ),
m_showStats( true ), m_showStats( true ),
m_nStrafeMode( 0 ){ m_nStrafeMode( 0 ){
} }
@ -170,7 +170,7 @@ struct camera_t
color( 0, 0, 0 ), color( 0, 0, 0 ),
movementflags( 0 ), movementflags( 0 ),
m_keymove_handler( 0 ), m_keymove_handler( 0 ),
fieldOfView( 90.0f ), fieldOfView( 110.0f ),
m_mouseMove( motionDelta, this ), m_mouseMove( motionDelta, this ),
m_view( view ), m_view( view ),
m_update( update ){ m_update( update ){
@ -1664,7 +1664,7 @@ void Camera_ToggleFarClip(){
void CamWnd_constructToolbar( GtkToolbar* toolbar ){ void CamWnd_constructToolbar( GtkToolbar* toolbar ){
toolbar_append_toggle_button( toolbar, "Cubic clip the camera view (\\)", "view_cubicclipping.bmp", "ToggleCubicClip" ); toolbar_append_toggle_button( toolbar, "Cubic clip the camera view (Ctrl + \\)", "view_cubicclipping.bmp", "ToggleCubicClip" );
} }
void CamWnd_registerShortcuts(){ void CamWnd_registerShortcuts(){

View File

@ -73,7 +73,7 @@ struct camwindow_globals_t
camwindow_globals_t() : camwindow_globals_t() :
color_cameraback( 0.25f, 0.25f, 0.25f ), color_cameraback( 0.25f, 0.25f, 0.25f ),
color_selbrushes3d( 1.0f, 0.f, 0.f ), color_selbrushes3d( 1.0f, 0.f, 0.f ),
m_nCubicScale( 13 ){ m_nCubicScale( 14 ){
} }
}; };

View File

@ -29,26 +29,13 @@
#include "brushmanip.h" #include "brushmanip.h"
#include "brushnode.h" #include "brushnode.h"
#include "grid.h" #include "grid.h"
/*
void Face_makeBrush( Face& face, const Brush& brush, brush_vector_t& out, float offset ){
if ( face.contributes() ) {
out.push_back( new Brush( brush ) );
Face* newFace = out.back()->addFace( face );
if ( newFace != 0 ) {
newFace->flipWinding();
newFace->getPlane().offset( offset );
newFace->planeChanged();
}
}
}
*/
void Face_makeBrush( Face& face, const Brush& brush, brush_vector_t& out, float offset ){ void Face_makeBrush( Face& face, const Brush& brush, brush_vector_t& out, float offset ){
if ( face.contributes() ) { if ( face.contributes() ) {
out.push_back( new Brush( brush ) ); out.push_back( new Brush( brush ) );
//face.getPlane().offset( -offset );
//face.planeChanged();
Face* newFace = out.back()->addFace( face ); Face* newFace = out.back()->addFace( face );
face.getPlane().offset( -offset );
face.planeChanged();
if ( newFace != 0 ) { if ( newFace != 0 ) {
newFace->flipWinding(); newFace->flipWinding();
newFace->getPlane().offset( offset ); newFace->getPlane().offset( offset );
@ -57,30 +44,51 @@ void Face_makeBrush( Face& face, const Brush& brush, brush_vector_t& out, float
} }
} }
void Face_extrude( Face& face, const Brush& brush, brush_vector_t& out, float offset ){
if ( face.contributes() ) {
face.getPlane().offset( offset );
out.push_back( new Brush( brush ) );
face.getPlane().offset( -offset );
Face* newFace = out.back()->addFace( face );
if ( newFace != 0 ) {
newFace->flipWinding();
newFace->planeChanged();
}
}
}
class FaceMakeBrush class FaceMakeBrush
{ {
const Brush& brush; const Brush& brush;
brush_vector_t& out; brush_vector_t& out;
float offset; float offset;
bool room;
public: public:
FaceMakeBrush( const Brush& brush, brush_vector_t& out, float offset ) FaceMakeBrush( const Brush& brush, brush_vector_t& out, float offset, bool room )
: brush( brush ), out( out ), offset( offset ){ : brush( brush ), out( out ), offset( offset ), room( room ){
} }
void operator()( Face& face ) const { void operator()( Face& face ) const {
Face_makeBrush( face, brush, out, offset ); if( room ){
Face_extrude( face, brush, out, offset );
}
else{
Face_makeBrush( face, brush, out, offset );
}
} }
}; };
void Brush_makeHollow( const Brush& brush, brush_vector_t& out, float offset ){ void Brush_makeHollow( const Brush& brush, brush_vector_t& out, float offset, bool room ){
Brush_forEachFace( brush, FaceMakeBrush( brush, out, offset ) ); Brush_forEachFace( brush, FaceMakeBrush( brush, out, offset, room ) );
} }
class BrushHollowSelectedWalker : public scene::Graph::Walker class BrushHollowSelectedWalker : public scene::Graph::Walker
{ {
float m_offset; float m_offset;
bool room;
public: public:
BrushHollowSelectedWalker( float offset ) BrushHollowSelectedWalker( float offset, bool room )
: m_offset( offset ){ : m_offset( offset ), room( room ){
} }
bool pre( const scene::Path& path, scene::Instance& instance ) const { bool pre( const scene::Path& path, scene::Instance& instance ) const {
if ( path.top().get().visible() ) { if ( path.top().get().visible() ) {
@ -89,7 +97,7 @@ bool pre( const scene::Path& path, scene::Instance& instance ) const {
&& Instance_getSelectable( instance )->isSelected() && Instance_getSelectable( instance )->isSelected()
&& path.size() > 1 ) { && path.size() > 1 ) {
brush_vector_t out; brush_vector_t out;
Brush_makeHollow( *brush, out, m_offset ); Brush_makeHollow( *brush, out, m_offset, room );
for ( brush_vector_t::const_iterator i = out.begin(); i != out.end(); ++i ) for ( brush_vector_t::const_iterator i = out.begin(); i != out.end(); ++i )
{ {
( *i )->removeEmptyFaces(); ( *i )->removeEmptyFaces();
@ -143,8 +151,8 @@ void post( const scene::Path& path, scene::Instance& instance ) const {
} }
}; };
void Scene_BrushMakeHollow_Selected( scene::Graph& graph ){ void Scene_BrushMakeHollow_Selected( scene::Graph& graph, bool room ){
GlobalSceneGraph().traverse( BrushHollowSelectedWalker( GetGridSize() ) ); GlobalSceneGraph().traverse( BrushHollowSelectedWalker( GetGridSize(), room ) );
GlobalSceneGraph().traverse( BrushDeleteSelected() ); GlobalSceneGraph().traverse( BrushDeleteSelected() );
} }
@ -157,7 +165,15 @@ void Scene_BrushMakeHollow_Selected( scene::Graph& graph ){
void CSG_MakeHollow( void ){ void CSG_MakeHollow( void ){
UndoableCommand undo( "brushHollow" ); UndoableCommand undo( "brushHollow" );
Scene_BrushMakeHollow_Selected( GlobalSceneGraph() ); Scene_BrushMakeHollow_Selected( GlobalSceneGraph(), false );
SceneChangeNotify();
}
void CSG_MakeRoom( void ){
UndoableCommand undo( "makeRoom" );
Scene_BrushMakeHollow_Selected( GlobalSceneGraph(), true );
SceneChangeNotify(); SceneChangeNotify();
} }

View File

@ -23,6 +23,7 @@
#define INCLUDED_CSG_H #define INCLUDED_CSG_H
void CSG_MakeHollow( void ); void CSG_MakeHollow( void );
void CSG_MakeRoom( void );
void CSG_Subtract( void ); void CSG_Subtract( void );
void CSG_Merge( void ); void CSG_Merge( void );

View File

@ -1170,6 +1170,23 @@ void EntityInspector_clearKeyValue(){
} }
} }
static gint EntityInspector_clearKeyValueKB( GtkEntry* widget, GdkEventKey* event, gpointer data ){
if ( event->keyval == GDK_Delete ) {
// Get current selection text
StringOutputStream key( 64 );
key << gtk_entry_get_text( g_entityKeyEntry );
if ( strcmp( key.c_str(), "classname" ) != 0 ) {
StringOutputStream command;
command << "entityDeleteKey -key " << key.c_str();
UndoableCommand undo( command.c_str() );
Scene_EntitySetKeyValue_Selected( key.c_str(), "" );
}
return TRUE;
}
return FALSE;
}
void EntityInspector_clearAllKeyValues(){ void EntityInspector_clearAllKeyValues(){
UndoableCommand undo( "entityClear" ); UndoableCommand undo( "entityClear" );
@ -1285,8 +1302,19 @@ static gint EntityEntry_keypress( GtkEntry* widget, GdkEventKey* event, gpointer
} }
return TRUE; return TRUE;
} }
if ( event->keyval == GDK_Tab ) {
if ( widget == g_entityKeyEntry ) {
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityValueEntry ) );
}
else
{
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityKeyEntry ) );
}
return TRUE;
}
if ( event->keyval == GDK_Escape ) { if ( event->keyval == GDK_Escape ) {
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), NULL ); //gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), NULL );
GroupDialog_showPage( g_page_entity );
return TRUE; return TRUE;
} }
@ -1301,11 +1329,26 @@ void EntityInspector_destroyWindow( GtkWidget* widget, gpointer data ){
GlobalEntityAttributes_clear(); GlobalEntityAttributes_clear();
} }
static gint EntityInspector_destroyWindowKB( GtkWidget* widget, GdkEventKey* event, gpointer data ){
//if ( event->keyval == GDK_Escape && GTK_WIDGET_VISIBLE( GTK_WIDGET( widget ) ) ) {
if ( event->keyval == GDK_Escape ) {
//globalErrorStream() << "Doom3Light_getBounds: failed to parse default light radius\n";
GroupDialog_showPage( g_page_entity );
return TRUE;
}
if ( event->keyval == GDK_Tab ) {
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( widget ) ) ), GTK_WIDGET( g_entityKeyEntry ) );
return TRUE;
}
return FALSE;
}
GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
GtkWidget* vbox = gtk_vbox_new( FALSE, 2 ); GtkWidget* vbox = gtk_vbox_new( FALSE, 2 );
gtk_widget_show( vbox ); gtk_widget_show( vbox );
gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 2 );
g_signal_connect( G_OBJECT( toplevel ), "key_press_event", G_CALLBACK( EntityInspector_destroyWindowKB ), 0 );
g_signal_connect( G_OBJECT( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 ); g_signal_connect( G_OBJECT( vbox ), "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 );
{ {
@ -1420,6 +1463,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) ); GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE ); gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
g_signal_connect( G_OBJECT( view ), "key_press_event", G_CALLBACK( EntityInspector_clearKeyValueKB ), 0 );
{ {
GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); GtkCellRenderer* renderer = gtk_cell_renderer_text_new();

View File

@ -554,6 +554,7 @@ int main( int argc, char* argv[] ){
if ( lib != 0 ) { if ( lib != 0 ) {
void ( WINAPI *qDwmEnableComposition )( bool bEnable ) = ( void (WINAPI *) ( bool bEnable ) )GetProcAddress( lib, "DwmEnableComposition" ); void ( WINAPI *qDwmEnableComposition )( bool bEnable ) = ( void (WINAPI *) ( bool bEnable ) )GetProcAddress( lib, "DwmEnableComposition" );
if ( qDwmEnableComposition ) { if ( qDwmEnableComposition ) {
// disable Aero
qDwmEnableComposition( FALSE ); qDwmEnableComposition( FALSE );
} }
FreeLibrary( lib ); FreeLibrary( lib );

View File

@ -2314,6 +2314,7 @@ void CSG_constructToolbar( GtkToolbar* toolbar ){
toolbar_append_button( toolbar, "CSG Subtract (SHIFT + U)", "selection_csgsubtract.bmp", "CSGSubtract" ); toolbar_append_button( toolbar, "CSG Subtract (SHIFT + U)", "selection_csgsubtract.bmp", "CSGSubtract" );
toolbar_append_button( toolbar, "CSG Merge (CTRL + U)", "selection_csgmerge.bmp", "CSGMerge" ); toolbar_append_button( toolbar, "CSG Merge (CTRL + U)", "selection_csgmerge.bmp", "CSGMerge" );
toolbar_append_button( toolbar, "Hollow", "selection_makehollow.bmp", "CSGHollow" ); toolbar_append_button( toolbar, "Hollow", "selection_makehollow.bmp", "CSGHollow" );
toolbar_append_button( toolbar, "Room", "selection_makeroom.bmp", "CSGroom" );
} }
void ComponentModes_constructToolbar( GtkToolbar* toolbar ){ void ComponentModes_constructToolbar( GtkToolbar* toolbar ){
@ -2841,42 +2842,35 @@ void MainFrame::Create(){
if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft ) { if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft ) {
{ {
GtkWidget* vsplit = gtk_vpaned_new(); GtkWidget* hsplit = gtk_hpaned_new();
m_vSplit = vsplit; m_hSplit = hsplit;
gtk_box_pack_start( GTK_BOX( vbox ), vsplit, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX( vbox ), hsplit, TRUE, TRUE, 0 );
gtk_widget_show( vsplit ); gtk_widget_show( hsplit );
// console
GtkWidget* console_window = Console_constructWindow( window );
gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE );
{ {
GtkWidget* hsplit = gtk_hpaned_new(); GtkWidget* vsplit = gtk_vpaned_new();
gtk_widget_show( hsplit ); gtk_widget_show( vsplit );
m_hSplit = hsplit; m_vSplit = vsplit;
gtk_paned_add1( GTK_PANED( vsplit ), hsplit ); GtkWidget* vsplit2 = gtk_vpaned_new();
gtk_widget_show( vsplit2 );
m_vSplit2 = vsplit2;
if ( CurrentStyle() == eRegular ){
gtk_paned_add1( GTK_PANED( hsplit ), vsplit );
gtk_paned_add2( GTK_PANED( hsplit ), vsplit2 );
}
else{
gtk_paned_add2( GTK_PANED( hsplit ), vsplit );
gtk_paned_add1( GTK_PANED( hsplit ), vsplit2 );
}
// console
GtkWidget* console_window = Console_constructWindow( window );
gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE );
// xy // xy
m_pXYWnd = new XYWnd(); m_pXYWnd = new XYWnd();
m_pXYWnd->SetViewType( XY ); m_pXYWnd->SetViewType( XY );
GtkWidget* xy_window = GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) ); GtkWidget* xy_window = GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) );
gtk_paned_add1( GTK_PANED( vsplit ), xy_window );
{ {
GtkWidget* vsplit2 = gtk_vpaned_new();
gtk_widget_show( vsplit2 );
m_vSplit2 = vsplit2;
if ( CurrentStyle() == eRegular ) {
gtk_paned_add1( GTK_PANED( hsplit ), xy_window );
gtk_paned_add2( GTK_PANED( hsplit ), vsplit2 );
}
else
{
gtk_paned_add1( GTK_PANED( hsplit ), vsplit2 );
gtk_paned_add2( GTK_PANED( hsplit ), xy_window );
}
// camera // camera
m_pCamWnd = NewCamWnd(); m_pCamWnd = NewCamWnd();
GlobalCamera_setCamWnd( *m_pCamWnd ); GlobalCamera_setCamWnd( *m_pCamWnd );
@ -3317,6 +3311,7 @@ void MainFrame_Construct(){
GlobalCommands_insert( "CSGSubtract", FreeCaller<CSG_Subtract>(), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) ); GlobalCommands_insert( "CSGSubtract", FreeCaller<CSG_Subtract>(), Accelerator( 'U', (GdkModifierType)GDK_SHIFT_MASK ) );
GlobalCommands_insert( "CSGMerge", FreeCaller<CSG_Merge>(), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) ); GlobalCommands_insert( "CSGMerge", FreeCaller<CSG_Merge>(), Accelerator( 'U', (GdkModifierType)GDK_CONTROL_MASK ) );
GlobalCommands_insert( "CSGHollow", FreeCaller<CSG_MakeHollow>() ); GlobalCommands_insert( "CSGHollow", FreeCaller<CSG_MakeHollow>() );
GlobalCommands_insert( "CSGroom", FreeCaller<CSG_MakeRoom>() );
Grid_registerCommands(); Grid_registerCommands();

View File

@ -87,6 +87,7 @@ void Mouse_constructPreferences( PreferencesPage& page ){
page.appendRadio( "Mouse Type", g_glwindow_globals.m_nMouseType, STRING_ARRAY_RANGE( buttons ) ); page.appendRadio( "Mouse Type", g_glwindow_globals.m_nMouseType, STRING_ARRAY_RANGE( buttons ) );
} }
page.appendCheckBox( "Right Button", "Activates Context Menu", g_xywindow_globals.m_bRightClick ); page.appendCheckBox( "Right Button", "Activates Context Menu", g_xywindow_globals.m_bRightClick );
page.appendCheckBox( "", "Improved mousewheel zoom", g_xywindow_globals.m_bImprovedWheelZoom );
} }
void Mouse_constructPage( PreferenceGroup& group ){ void Mouse_constructPage( PreferenceGroup& group ){
PreferencesPage page( group.createPage( "Mouse", "Mouse Preferences" ) ); PreferencesPage page( group.createPage( "Mouse", "Mouse Preferences" ) );

View File

@ -894,6 +894,9 @@ struct RotateDialog
static gboolean rotatedlg_apply( GtkWidget *widget, RotateDialog* rotateDialog ){ static gboolean rotatedlg_apply( GtkWidget *widget, RotateDialog* rotateDialog ){
Vector3 eulerXYZ; Vector3 eulerXYZ;
gtk_spin_button_update ( rotateDialog->x );
gtk_spin_button_update ( rotateDialog->y );
gtk_spin_button_update ( rotateDialog->z );
eulerXYZ[0] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->x ) ); eulerXYZ[0] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->x ) );
eulerXYZ[1] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->y ) ); eulerXYZ[1] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->y ) );
eulerXYZ[2] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->z ) ); eulerXYZ[2] = static_cast<float>( gtk_spin_button_get_value( rotateDialog->z ) );
@ -918,7 +921,8 @@ static gboolean rotatedlg_cancel( GtkWidget *widget, RotateDialog* rotateDialog
static gboolean rotatedlg_ok( GtkWidget *widget, RotateDialog* rotateDialog ){ static gboolean rotatedlg_ok( GtkWidget *widget, RotateDialog* rotateDialog ){
rotatedlg_apply( widget, rotateDialog ); rotatedlg_apply( widget, rotateDialog );
rotatedlg_cancel( widget, rotateDialog ); // rotatedlg_cancel( widget, rotateDialog );
gtk_widget_hide( GTK_WIDGET( rotateDialog->window ) );
return TRUE; return TRUE;
} }
@ -1070,7 +1074,8 @@ static gboolean scaledlg_cancel( GtkWidget *widget, ScaleDialog* scaleDialog ){
static gboolean scaledlg_ok( GtkWidget *widget, ScaleDialog* scaleDialog ){ static gboolean scaledlg_ok( GtkWidget *widget, ScaleDialog* scaleDialog ){
scaledlg_apply( widget, scaleDialog ); scaledlg_apply( widget, scaleDialog );
scaledlg_cancel( widget, scaleDialog ); //scaledlg_cancel( widget, scaleDialog );
gtk_widget_hide( GTK_WIDGET( scaleDialog->window ) );
return TRUE; return TRUE;
} }

View File

@ -132,7 +132,7 @@ typedef ReferenceCaller1<TextureGroups, const char*, TextureGroups_addDirectory>
namespace namespace
{ {
bool g_TextureBrowser_shaderlistOnly = false; bool g_TextureBrowser_shaderlistOnly = false;
bool g_TextureBrowser_fixedSize = false; bool g_TextureBrowser_fixedSize = true;
bool g_TextureBrowser_filterNotex = false; bool g_TextureBrowser_filterNotex = false;
} }
@ -264,40 +264,78 @@ bool m_searchedTags;
bool m_tags; bool m_tags;
// The uniform size (in pixels) that textures are resized to when m_resizeTextures is true. // The uniform size (in pixels) that textures are resized to when m_resizeTextures is true.
int m_uniformTextureSize; int m_uniformTextureSize;
int m_uniformTextureMinSize;
// Return the display width of a texture in the texture browser // Return the display width of a texture in the texture browser
int getTextureWidth( qtexture_t* tex ){ /*void getTextureWH( qtexture_t* tex, int *width, int *height ){
int width;
if ( !g_TextureBrowser_fixedSize ) { if ( !g_TextureBrowser_fixedSize ) {
// Don't use uniform size // Don't use uniform size
width = (int)( tex->width * ( (float)m_textureScale / 100 ) ); *width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
*height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
} }
else if else if ( tex->width >= tex->height ) {
( tex->width >= tex->height ) {
// Texture is square, or wider than it is tall // Texture is square, or wider than it is tall
width = m_uniformTextureSize; if ( tex->width >= m_uniformTextureSize ){
*width = m_uniformTextureSize;
*height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
}
else if ( tex->width <= m_uniformTextureMinSize ){
*width = m_uniformTextureMinSize;
*height = (int)( m_uniformTextureMinSize * ( (float)tex->height / tex->width ) );
}
else {
*width = tex->width;
*height = tex->height;
}
} }
else { else {
// Otherwise, preserve the texture's aspect ratio // Texture taller than it is wide
width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) ); if ( tex->height >= m_uniformTextureSize ){
*height = m_uniformTextureSize;
*width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) );
}
else if ( tex->height <= m_uniformTextureMinSize ){
*height = m_uniformTextureMinSize;
*width = (int)( m_uniformTextureMinSize * ( (float)tex->width / tex->height ) );
}
else {
*width = tex->width;
*height = tex->height;
}
} }
return width;
} }
// Return the display height of a texture in the texture browser */
int getTextureHeight( qtexture_t* tex ){ void getTextureWH( qtexture_t* tex, int *width, int *height ){
int height;
if ( !g_TextureBrowser_fixedSize ) {
// Don't use uniform size // Don't use uniform size
height = (int)( tex->height * ( (float)m_textureScale / 100 ) ); *width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
*height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
if ( g_TextureBrowser_fixedSize ){
int W = *width;
int H = *height;
if ( W >= H ) {
// Texture is square, or wider than it is tall
if ( W >= m_uniformTextureSize ){
*width = m_uniformTextureSize;
*height = m_uniformTextureSize * H / W;
}
else if ( W <= m_uniformTextureMinSize ){
*width = m_uniformTextureMinSize;
*height = m_uniformTextureMinSize * H / W;
}
}
else {
// Texture taller than it is wide
if ( H >= m_uniformTextureSize ){
*height = m_uniformTextureSize;
*width = m_uniformTextureSize * W / H;
}
else if ( H <= m_uniformTextureMinSize ){
*height = m_uniformTextureMinSize;
*width = m_uniformTextureMinSize * W / H;
}
}
} }
else if ( tex->height >= tex->width ) {
// Texture is square, or taller than it is wide
height = m_uniformTextureSize;
}
else {
// Otherwise, preserve the texture's aspect ratio
height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
}
return height;
} }
TextureBrowser() : TextureBrowser() :
@ -320,7 +358,8 @@ TextureBrowser() :
m_rmbSelected( false ), m_rmbSelected( false ),
m_searchedTags( false ), m_searchedTags( false ),
m_tags( false ), m_tags( false ),
m_uniformTextureSize( 128 ){ m_uniformTextureSize( 160 ),
m_uniformTextureMinSize( 48 ){
} }
}; };
@ -421,8 +460,8 @@ void Texture_StartPos( TextureLayout& layout ){
void Texture_NextPos( TextureBrowser& textureBrowser, TextureLayout& layout, qtexture_t* current_texture, int *x, int *y ){ void Texture_NextPos( TextureBrowser& textureBrowser, TextureLayout& layout, qtexture_t* current_texture, int *x, int *y ){
qtexture_t* q = current_texture; qtexture_t* q = current_texture;
int nWidth = textureBrowser.getTextureWidth( q ); int nWidth, nHeight;
int nHeight = textureBrowser.getTextureHeight( q ); textureBrowser.getTextureWH( q, &nWidth, &nHeight );
if ( layout.current_x + nWidth > textureBrowser.width - 8 && layout.current_row ) { // go to the next row unless the texture is the first on the row if ( layout.current_x + nWidth > textureBrowser.width - 8 && layout.current_row ) { // go to the next row unless the texture is the first on the row
layout.current_x = 8; layout.current_x = 8;
layout.current_y -= layout.current_row + TextureBrowser_fontHeight( textureBrowser ) + 4; layout.current_y -= layout.current_row + TextureBrowser_fontHeight( textureBrowser ) + 4;
@ -534,7 +573,9 @@ void TextureBrowser_evaluateHeight( TextureBrowser& textureBrowser ){
int x, y; int x, y;
Texture_NextPos( textureBrowser, layout, shader->getTexture(), &x, &y ); Texture_NextPos( textureBrowser, layout, shader->getTexture(), &x, &y );
textureBrowser.m_nTotalHeight = std::max( textureBrowser.m_nTotalHeight, abs( layout.current_y ) + TextureBrowser_fontHeight( textureBrowser ) + textureBrowser.getTextureHeight( shader->getTexture() ) + 4 ); int nWidth, nHeight;
textureBrowser.getTextureWH( shader->getTexture(), &nWidth, &nHeight );
textureBrowser.m_nTotalHeight = std::max( textureBrowser.m_nTotalHeight, abs( layout.current_y ) + TextureBrowser_fontHeight( textureBrowser ) + nHeight + 4 );
} }
} }
} }
@ -581,12 +622,15 @@ void TextureBrowser_addActiveShadersChangedCallback( const SignalHandler& handle
g_activeShadersChangedCallbacks.connectLast( handler ); g_activeShadersChangedCallbacks.connectLast( handler );
} }
void TextureBrowser_constructTreeStore();
class ShadersObserver : public ModuleObserver class ShadersObserver : public ModuleObserver
{ {
Signal0 m_realiseCallbacks; Signal0 m_realiseCallbacks;
public: public:
void realise(){ void realise(){
m_realiseCallbacks(); m_realiseCallbacks();
TextureBrowser_constructTreeStore();
} }
void unrealise(){ void unrealise(){
} }
@ -915,8 +959,8 @@ IShader* Texture_At( TextureBrowser& textureBrowser, int mx, int my ){
break; break;
} }
int nWidth = textureBrowser.getTextureWidth( q ); int nWidth, nHeight;
int nHeight = textureBrowser.getTextureHeight( q ); textureBrowser.getTextureWH( q, &nWidth, &nHeight );
if ( mx > x && mx - x < nWidth if ( mx > x && mx - x < nWidth
&& my < y && y - my < nHeight + TextureBrowser_fontHeight( textureBrowser ) ) { && my < y && y - my < nHeight + TextureBrowser_fontHeight( textureBrowser ) ) {
return shader; return shader;
@ -1046,8 +1090,8 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
break; break;
} }
int nWidth = textureBrowser.getTextureWidth( q ); int nWidth, nHeight;
int nHeight = textureBrowser.getTextureHeight( q ); textureBrowser.getTextureWH( q, &nWidth, &nHeight );
if ( y != last_y ) { if ( y != last_y ) {
last_y = y; last_y = y;
@ -1167,6 +1211,15 @@ void TextureBrowser_setScale( TextureBrowser& textureBrowser, std::size_t scale
TextureBrowser_queueDraw( textureBrowser ); TextureBrowser_queueDraw( textureBrowser );
} }
void TextureBrowser_setUniformSize( TextureBrowser& textureBrowser, std::size_t scale ){
textureBrowser.m_uniformTextureSize = scale;
TextureBrowser_queueDraw( textureBrowser );
}
void TextureBrowser_setUniformMinSize( TextureBrowser& textureBrowser, std::size_t scale ){
textureBrowser.m_uniformTextureMinSize = scale;
TextureBrowser_queueDraw( textureBrowser );
}
void TextureBrowser_MouseWheel( TextureBrowser& textureBrowser, bool bUp ){ void TextureBrowser_MouseWheel( TextureBrowser& textureBrowser, bool bUp ){
int originy = TextureBrowser_getOriginY( textureBrowser ); int originy = TextureBrowser_getOriginY( textureBrowser );
@ -1477,6 +1530,8 @@ void TreeView_onRowActivated( GtkTreeView* treeview, GtkTreePath* path, GtkTreeV
ScopeDisableScreenUpdates disableScreenUpdates( dirName, "Loading Textures" ); ScopeDisableScreenUpdates disableScreenUpdates( dirName, "Loading Textures" );
TextureBrowser_ShowDirectory( GlobalTextureBrowser(), dirName ); TextureBrowser_ShowDirectory( GlobalTextureBrowser(), dirName );
TextureBrowser_queueDraw( GlobalTextureBrowser() ); TextureBrowser_queueDraw( GlobalTextureBrowser() );
//deactivate, so SPACE and RETURN wont be broken for 2d
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( treeview ) ) ), NULL );
} }
} }
@ -2429,6 +2484,18 @@ void TextureScaleExport( TextureBrowser& textureBrowser, const IntImportCallback
} }
typedef ReferenceCaller1<TextureBrowser, const IntImportCallback&, TextureScaleExport> TextureScaleExportCaller; typedef ReferenceCaller1<TextureBrowser, const IntImportCallback&, TextureScaleExport> TextureScaleExportCaller;
void UniformTextureSizeImport( TextureBrowser& textureBrowser, int value ){
if ( value >= 16 )
TextureBrowser_setUniformSize( textureBrowser, value );
}
typedef ReferenceCaller1<TextureBrowser, int, UniformTextureSizeImport> UniformTextureSizeImportCaller;
void UniformTextureMinSizeImport( TextureBrowser& textureBrowser, int value ){
if ( value >= 16 )
TextureBrowser_setUniformMinSize( textureBrowser, value );
}
typedef ReferenceCaller1<TextureBrowser, int, UniformTextureMinSizeImport> UniformTextureMinSizeImportCaller;
void TextureBrowser_constructPreferences( PreferencesPage& page ){ void TextureBrowser_constructPreferences( PreferencesPage& page ){
page.appendCheckBox( page.appendCheckBox(
"", "Texture scrollbar", "", "Texture scrollbar",
@ -2444,6 +2511,8 @@ void TextureBrowser_constructPreferences( PreferencesPage& page ){
IntExportCallback( TextureScaleExportCaller( GlobalTextureBrowser() ) ) IntExportCallback( TextureScaleExportCaller( GlobalTextureBrowser() ) )
); );
} }
page.appendSpinner( "Thumbnails Max Size", GlobalTextureBrowser().m_uniformTextureSize, GlobalTextureBrowser().m_uniformTextureSize, 16, 8192 );
page.appendSpinner( "Thumbnails Min Size", GlobalTextureBrowser().m_uniformTextureMinSize, GlobalTextureBrowser().m_uniformTextureMinSize, 16, 8192 );
page.appendEntry( "Mousewheel Increment", GlobalTextureBrowser().m_mouseWheelScrollIncrement ); page.appendEntry( "Mousewheel Increment", GlobalTextureBrowser().m_mouseWheelScrollIncrement );
{ {
const char* startup_shaders[] = { "None", TextureBrowser_getComonShadersName() }; const char* startup_shaders[] = { "None", TextureBrowser_getComonShadersName() };
@ -2489,6 +2558,12 @@ void TextureBrowser_Construct(){
makeSizeStringImportCallback( TextureBrowserSetScaleCaller( g_TextureBrowser ) ), makeSizeStringImportCallback( TextureBrowserSetScaleCaller( g_TextureBrowser ) ),
SizeExportStringCaller( g_TextureBrowser.m_textureScale ) SizeExportStringCaller( g_TextureBrowser.m_textureScale )
); );
GlobalPreferenceSystem().registerPreference( "UniformTextureSize",
makeIntStringImportCallback(UniformTextureSizeImportCaller(g_TextureBrowser)),
IntExportStringCaller(g_TextureBrowser.m_uniformTextureSize) );
GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize",
makeIntStringImportCallback(UniformTextureMinSizeImportCaller(g_TextureBrowser)),
IntExportStringCaller(g_TextureBrowser.m_uniformTextureMinSize) );
GlobalPreferenceSystem().registerPreference( "TextureScrollbar", GlobalPreferenceSystem().registerPreference( "TextureScrollbar",
makeBoolStringImportCallback( TextureBrowserImportShowScrollbarCaller( g_TextureBrowser ) ), makeBoolStringImportCallback( TextureBrowserImportShowScrollbarCaller( g_TextureBrowser ) ),
BoolExportStringCaller( GlobalTextureBrowser().m_showTextureScrollbar ) BoolExportStringCaller( GlobalTextureBrowser().m_showTextureScrollbar )

View File

@ -493,17 +493,17 @@ void XYWnd::SetScale( float f ){
XYWnd_Update( *this ); XYWnd_Update( *this );
} }
void XYWnd_ZoomIn( XYWnd* xy ){ void XYWnd::ZoomIn(){
float max_scale = 64; float max_scale = 64;
float scale = xy->Scale() * 5.0f / 4.0f; float scale = Scale() * 5.0f / 4.0f;
if ( scale > max_scale ) { if ( scale > max_scale ) {
if ( xy->Scale() != max_scale ) { if ( Scale() != max_scale ) {
xy->SetScale( max_scale ); SetScale( max_scale );
} }
} }
else else
{ {
xy->SetScale( scale ); SetScale( scale );
} }
} }
@ -511,17 +511,31 @@ void XYWnd_ZoomIn( XYWnd* xy ){
// NOTE: the zoom out factor is 4/5, we could think about customizing it // NOTE: the zoom out factor is 4/5, we could think about customizing it
// we don't go below a zoom factor corresponding to 10% of the max world size // we don't go below a zoom factor corresponding to 10% of the max world size
// (this has to be computed against the window size) // (this has to be computed against the window size)
void XYWnd_ZoomOut( XYWnd* xy ){ void XYWnd::ZoomOut(){
float min_scale = MIN( xy->Width(),xy->Height() ) / ( 1.1f * ( g_MaxWorldCoord - g_MinWorldCoord ) ); float min_scale = MIN( Width(), Height() ) / ( 1.1f * ( g_MaxWorldCoord - g_MinWorldCoord ) );
float scale = xy->Scale() * 4.0f / 5.0f; float scale = Scale() * 4.0f / 5.0f;
if ( scale < min_scale ) { if ( scale < min_scale ) {
if ( xy->Scale() != min_scale ) { if ( Scale() != min_scale ) {
xy->SetScale( min_scale ); SetScale( min_scale );
} }
} }
else else
{ {
xy->SetScale( scale ); SetScale( scale );
}
}
void XYWnd::ZoomInWithMouse( int pointx, int pointy ){
float old_scale = Scale();
ZoomIn();
if ( g_xywindow_globals.m_bImprovedWheelZoom ) {
float scale_diff = 1.0 / old_scale - 1.0 / Scale();
int nDim1 = ( m_viewType == YZ ) ? 1 : 0;
int nDim2 = ( m_viewType == XY ) ? 1 : 2;
Vector3 origin = GetOrigin();
origin[nDim1] += scale_diff * (pointx - 0.5 * Width());
origin[nDim2] -= scale_diff * (pointy - 0.5 * Height());
SetOrigin( origin );
} }
} }
@ -748,10 +762,10 @@ void xywnd_motion( gdouble x, gdouble y, guint state, void* data ){
gboolean xywnd_wheel_scroll( GtkWidget* widget, GdkEventScroll* event, XYWnd* xywnd ){ gboolean xywnd_wheel_scroll( GtkWidget* widget, GdkEventScroll* event, XYWnd* xywnd ){
if ( event->direction == GDK_SCROLL_UP ) { if ( event->direction == GDK_SCROLL_UP ) {
XYWnd_ZoomIn( xywnd ); xywnd->ZoomInWithMouse( (int)event->x, (int)event->y );
} }
else if ( event->direction == GDK_SCROLL_DOWN ) { else if ( event->direction == GDK_SCROLL_DOWN ) {
XYWnd_ZoomOut( xywnd ); xywnd->ZoomOut();
} }
return FALSE; return FALSE;
} }
@ -1201,16 +1215,15 @@ int g_dragZoom = 0;
void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){ void XYWnd_zoomDelta( int x, int y, unsigned int state, void* data ){
if ( y != 0 ) { if ( y != 0 ) {
g_dragZoom += y; g_dragZoom += y;
while ( abs( g_dragZoom ) > 8 ) while ( abs( g_dragZoom ) > 8 )
{ {
if ( g_dragZoom > 0 ) { if ( g_dragZoom > 0 ) {
XYWnd_ZoomOut( reinterpret_cast<XYWnd*>( data ) ); reinterpret_cast<XYWnd*>( data )->ZoomOut();
g_dragZoom -= 8; g_dragZoom -= 8;
} }
else else
{ {
XYWnd_ZoomIn( reinterpret_cast<XYWnd*>( data ) ); reinterpret_cast<XYWnd*>( data )->ZoomIn();
g_dragZoom += 8; g_dragZoom += 8;
} }
} }
@ -2508,14 +2521,14 @@ void XY_Zoom100(){
} }
void XY_ZoomIn(){ void XY_ZoomIn(){
XYWnd_ZoomIn( g_pParentWnd->ActiveXY() ); g_pParentWnd->ActiveXY()->ZoomIn();
} }
// NOTE: the zoom out factor is 4/5, we could think about customizing it // NOTE: the zoom out factor is 4/5, we could think about customizing it
// we don't go below a zoom factor corresponding to 10% of the max world size // we don't go below a zoom factor corresponding to 10% of the max world size
// (this has to be computed against the window size) // (this has to be computed against the window size)
void XY_ZoomOut(){ void XY_ZoomOut(){
XYWnd_ZoomOut( g_pParentWnd->ActiveXY() ); g_pParentWnd->ActiveXY()->ZoomOut();
} }
@ -2756,6 +2769,7 @@ void XYWindow_Construct(){
GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) ); GlobalPreferenceSystem().registerPreference( "ClipCaulk", BoolImportStringCaller( g_clip_useCaulk ), BoolExportStringCaller( g_clip_useCaulk ) );
GlobalPreferenceSystem().registerPreference( "NewRightClick", BoolImportStringCaller( g_xywindow_globals.m_bRightClick ), BoolExportStringCaller( g_xywindow_globals.m_bRightClick ) ); GlobalPreferenceSystem().registerPreference( "NewRightClick", BoolImportStringCaller( g_xywindow_globals.m_bRightClick ), BoolExportStringCaller( g_xywindow_globals.m_bRightClick ) );
GlobalPreferenceSystem().registerPreference( "ImprovedWheelZoom", BoolImportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ), BoolExportStringCaller( g_xywindow_globals.m_bImprovedWheelZoom ) );
GlobalPreferenceSystem().registerPreference( "ChaseMouse", BoolImportStringCaller( g_xywindow_globals_private.m_bChaseMouse ), BoolExportStringCaller( g_xywindow_globals_private.m_bChaseMouse ) ); GlobalPreferenceSystem().registerPreference( "ChaseMouse", BoolImportStringCaller( g_xywindow_globals_private.m_bChaseMouse ), BoolExportStringCaller( g_xywindow_globals_private.m_bChaseMouse ) );
GlobalPreferenceSystem().registerPreference( "SizePainting", BoolImportStringCaller( g_xywindow_globals_private.m_bSizePaint ), BoolExportStringCaller( g_xywindow_globals_private.m_bSizePaint ) ); GlobalPreferenceSystem().registerPreference( "SizePainting", BoolImportStringCaller( g_xywindow_globals_private.m_bSizePaint ), BoolExportStringCaller( g_xywindow_globals_private.m_bSizePaint ) );
GlobalPreferenceSystem().registerPreference( "ShowCrosshair", BoolImportStringCaller( g_bCrossHairs ), BoolExportStringCaller( g_bCrossHairs ) ); GlobalPreferenceSystem().registerPreference( "ShowCrosshair", BoolImportStringCaller( g_bCrossHairs ), BoolExportStringCaller( g_bCrossHairs ) );

View File

@ -126,6 +126,10 @@ void Zoom_End();
bool m_zoom_started; bool m_zoom_started;
guint m_zoom_focusOut; guint m_zoom_focusOut;
void ZoomIn();
void ZoomOut();
void ZoomInWithMouse( int pointx, int pointy );
void SetActive( bool b ){ void SetActive( bool b ){
m_bActive = b; m_bActive = b;
}; };
@ -253,6 +257,7 @@ struct xywindow_globals_t
bool m_bRightClick; bool m_bRightClick;
bool m_bNoStipple; bool m_bNoStipple;
bool m_bImprovedWheelZoom;
xywindow_globals_t() : xywindow_globals_t() :
color_gridback( 0.77f, 0.77f, 0.77f ), color_gridback( 0.77f, 0.77f, 0.77f ),
@ -271,7 +276,8 @@ struct xywindow_globals_t
AxisColorY( 0.f, 1.f, 0.f ), AxisColorY( 0.f, 1.f, 0.f ),
AxisColorZ( 0.f, 0.f, 1.f ), AxisColorZ( 0.f, 0.f, 1.f ),
m_bRightClick( true ), m_bRightClick( true ),
m_bNoStipple( false ){ m_bNoStipple( false ),
m_bImprovedWheelZoom( true ){
} }
}; };

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

View File

@ -538,7 +538,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
size_t stacksize; size_t stacksize;
int start, end; int start, end;
int i = 0, status = 0; int i = 0;
start = I_FloatTime(); start = I_FloatTime();
pacifier = showpacifier; pacifier = showpacifier;
@ -582,7 +582,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
} }
for ( i = 0 ; i < numthreads ; i++ ) for ( i = 0 ; i < numthreads ; i++ )
{ {
if ( pthread_join( work_threads[i], (void **)&status ) != 0 ) { if ( pthread_join( work_threads[i], NULL ) != 0 ) {
Error( "pthread_join failed" ); Error( "pthread_join failed" );
} }
} }

View File

@ -2403,6 +2403,30 @@ int LightMain( int argc, char **argv ){
i++; i++;
} }
/* Lighting brightness */
else if( !strcmp( argv[ i ], "-brightness" ) ){
f = atof( argv[ i + 1 ] );
lightmapBrightness = f;
Sys_Printf( "Lighting brightness set to %f\n", lightmapBrightness );
i++;
}
/* Lighting contrast */
else if( !strcmp( argv[ i ], "-contrast" ) ){
f = atof( argv[ i + 1 ] );
lightmapContrast = f;
if( lightmapContrast > 255 ){
lightmapContrast = 255;
}
else if( lightmapContrast < -255 ){
lightmapContrast = -255;
}
Sys_Printf( "Lighting contrast set to %f\n", lightmapContrast );
i++;
/* change to factor in range of 0 to 129.5 */
lightmapContrast = ( 259 * ( lightmapContrast + 255 ) ) / ( 255 * ( 259 - lightmapContrast ) );
}
/* ydnar switches */ /* ydnar switches */
else if ( !strcmp( argv[ i ], "-bounce" ) ) { else if ( !strcmp( argv[ i ], "-bounce" ) ) {
bounce = atoi( argv[ i + 1 ] ); bounce = atoi( argv[ i + 1 ] );

View File

@ -55,6 +55,8 @@ void ColorToBytes( const float *color, byte *colorBytes, float scale ){
if ( scale <= 0.0f ) { if ( scale <= 0.0f ) {
scale = 1.0f; scale = 1.0f;
} }
/* globally */
scale *= lightmapBrightness;
/* make a local copy */ /* make a local copy */
VectorScale( color, scale, sample ); VectorScale( color, scale, sample );
@ -119,6 +121,23 @@ void ColorToBytes( const float *color, byte *colorBytes, float scale ){
/* compensate for ingame overbrighting/bitshifting */ /* compensate for ingame overbrighting/bitshifting */
VectorScale( sample, ( 1.0f / lightmapCompensate ), sample ); VectorScale( sample, ( 1.0f / lightmapCompensate ), sample );
/* contrast */
if ( lightmapContrast != 1.0f ){
for ( i = 0; i < 3; i++ ){
sample[i] = lightmapContrast * ( sample[i] - 128 ) + 128;
if ( sample[i] < 0 ){
sample[i] = 0;
}
}
if ( ( sample[0] > 255 ) || ( sample[1] > 255 ) || ( sample[2] > 255 ) ) {
max = sample[0] > sample[1] ? sample[0] : sample[1];
max = max > sample[2] ? max : sample[2];
sample[0] = sample[0] * 255 / max;
sample[1] = sample[1] * 255 / max;
sample[2] = sample[2] * 255 / max;
}
}
/* sRGB lightmaps */ /* sRGB lightmaps */
if ( lightmapsRGB ) { if ( lightmapsRGB ) {
sample[0] = floor( Image_sRGBFloatFromLinearFloat( sample[0] * ( 1.0 / 255.0 ) ) * 255.0 + 0.5 ); sample[0] = floor( Image_sRGBFloatFromLinearFloat( sample[0] * ( 1.0 / 255.0 ) ) * 255.0 + 0.5 );

View File

@ -2117,6 +2117,7 @@ skipEXfile:
temp, scriptline, token ); temp, scriptline, token );
} }
qboolean hasmap = qfalse;
while ( 1 ) while ( 1 )
{ {
/* get the next token */ /* get the next token */
@ -2142,13 +2143,19 @@ skipEXfile:
if ( !strcmp( token, "}" ) ) { if ( !strcmp( token, "}" ) ) {
break; break;
} }
if ( !strcmp( token, "{" ) ) {
Sys_Printf( "WARNING9: %s : line %d : opening brace inside shader stage\n", temp, scriptline );
}
if ( !stricmp( token, "mapComp" ) || !stricmp( token, "mapNoComp" ) || !stricmp( token, "animmapcomp" ) || !stricmp( token, "animmapnocomp" ) ){
Sys_Printf( "WARNING7: %s : line %d : unsupported '%s' map directive\n", temp, scriptline, token );
}
/* skip the shader */ /* skip the shader */
if ( !wantShader ) continue; if ( !wantShader ) continue;
/* digest any images */ /* digest any images */
if ( !stricmp( token, "map" ) || if ( !stricmp( token, "map" ) ||
!stricmp( token, "clampMap" ) ) { !stricmp( token, "clampMap" ) ) {
hasmap = qtrue;
/* get an image */ /* get an image */
GetToken( qfalse ); GetToken( qfalse );
if ( token[ 0 ] != '*' && token[ 0 ] != '$' ) { if ( token[ 0 ] != '*' && token[ 0 ] != '$' ) {
@ -2157,6 +2164,7 @@ skipEXfile:
} }
else if ( !stricmp( token, "animMap" ) || else if ( !stricmp( token, "animMap" ) ||
!stricmp( token, "clampAnimMap" ) ) { !stricmp( token, "clampAnimMap" ) ) {
hasmap = qtrue;
GetToken( qfalse );// skip num GetToken( qfalse );// skip num
while ( TokenAvailable() ){ while ( TokenAvailable() ){
GetToken( qfalse ); GetToken( qfalse );
@ -2164,6 +2172,7 @@ skipEXfile:
} }
} }
else if ( !stricmp( token, "videoMap" ) ){ else if ( !stricmp( token, "videoMap" ) ){
hasmap = qtrue;
GetToken( qfalse ); GetToken( qfalse );
FixDOSName( token ); FixDOSName( token );
if ( strchr( token, '/' ) == NULL && strchr( token, '\\' ) == NULL ){ if ( strchr( token, '/' ) == NULL && strchr( token, '\\' ) == NULL ){
@ -2188,6 +2197,9 @@ skipEXfile:
} }
} }
} }
else if ( !strnicmp( token, "implicit", 8 ) ){
Sys_Printf( "WARNING5: %s : line %d : unsupported %s shader\n", temp, scriptline, token );
}
/* skip the shader */ /* skip the shader */
else if ( !wantShader ) continue; else if ( !wantShader ) continue;
@ -2206,6 +2218,7 @@ skipEXfile:
/* skyparms <outer image> <cloud height> <inner image> */ /* skyparms <outer image> <cloud height> <inner image> */
else if ( !stricmp( token, "skyParms" ) ) { else if ( !stricmp( token, "skyParms" ) ) {
hasmap = qtrue;
/* get image base */ /* get image base */
GetToken( qfalse ); GetToken( qfalse );
@ -2229,6 +2242,9 @@ skipEXfile:
GetToken( qfalse ); GetToken( qfalse );
GetToken( qfalse ); GetToken( qfalse );
} }
else if ( !stricmp( token, "fogparms" ) ){
hasmap = qtrue;
}
} }
//exclude shader //exclude shader
@ -2240,6 +2256,9 @@ skipEXfile:
break; break;
} }
} }
if ( !hasmap ){
wantShader = qfalse;
}
if ( wantShader ){ if ( wantShader ){
if ( ShaderFileExcluded ){ if ( ShaderFileExcluded ){
if ( reasonShaderFile != NULL ){ if ( reasonShaderFile != NULL ){
@ -2456,7 +2475,7 @@ skipEXfile:
/* /*
repackBSPMain() repackBSPMain()
repack multiple maps, strip only required shaders repack multiple maps, strip out only required shaders
works for Q3 type of shaders and ents works for Q3 type of shaders and ents
*/ */
@ -3074,6 +3093,10 @@ skipEXrefile:
strcat( shaderText, "\n\t}" ); strcat( shaderText, "\n\t}" );
break; break;
} }
if ( !strcmp( token, "{" ) ) {
strcat( shaderText, "\n\t{" );
Sys_Printf( "WARNING9: %s : line %d : opening brace inside shader stage\n", temp, scriptline );
}
/* skip the shader */ /* skip the shader */
if ( !wantShader ) continue; if ( !wantShader ) continue;
@ -3248,11 +3271,6 @@ skipEXrefile:
} }
//exclude shader //exclude shader
if ( wantShader && !hasmap ){
Sys_Printf( "WARNING8: %s : shader has no known maps\n", pk3Shaders + shader*65 );
wantShader = qfalse;
*( pk3Shaders + shader*65 ) = '\0';
}
if ( wantShader ){ if ( wantShader ){
for ( j = 0; j < ExShadersN; j++ ){ for ( j = 0; j < ExShadersN; j++ ){
if ( !stricmp( ExShaders + j*65, pk3Shaders + shader*65 ) ){ if ( !stricmp( ExShaders + j*65, pk3Shaders + shader*65 ) ){
@ -3261,6 +3279,11 @@ skipEXrefile:
break; break;
} }
} }
if ( wantShader && !hasmap ){
Sys_Printf( "WARNING8: %s : shader has no known maps\n", pk3Shaders + shader*65 );
wantShader = qfalse;
*( pk3Shaders + shader*65 ) = '\0';
}
if ( wantShader ){ if ( wantShader ){
strcat( allShaders, shaderText ); strcat( allShaders, shaderText );
*( pk3Shaders + shader*65 ) = '\0'; *( pk3Shaders + shader*65 ) = '\0';

View File

@ -550,7 +550,7 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap
vec3_t min = { 999999, 999999, 999999 }, max = { -999999, -999999, -999999 }; vec3_t min = { 999999, 999999, 999999 }, max = { -999999, -999999, -999999 };
vec3_t avgDirection = { 0, 0, 0 }; vec3_t avgDirection = { 0, 0, 0 };
int axis; int axis;
#define nonax_clip_dbg 1 #define nonax_clip_dbg 0
/* temp hack */ /* temp hack */
if ( !si->clipModel && !( si->compileFlags & C_SOLID ) ) { if ( !si->clipModel && !( si->compileFlags & C_SOLID ) ) {

View File

@ -2330,6 +2330,8 @@ Q_EXTERN float texturesRGB Q_ASSIGN( qfalse );
Q_EXTERN float colorsRGB Q_ASSIGN( qfalse ); Q_EXTERN float colorsRGB Q_ASSIGN( qfalse );
Q_EXTERN float lightmapExposure Q_ASSIGN( 0.0f ); Q_EXTERN float lightmapExposure Q_ASSIGN( 0.0f );
Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f ); Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f );
Q_EXTERN float lightmapBrightness Q_ASSIGN( 1.0f );
Q_EXTERN float lightmapContrast Q_ASSIGN( 1.0f );
/* ydnar: for runtime tweaking of falloff tolerance */ /* ydnar: for runtime tweaking of falloff tolerance */
Q_EXTERN float falloffTolerance Q_ASSIGN( 1.0f ); Q_EXTERN float falloffTolerance Q_ASSIGN( 1.0f );