indent classes, align by spaces
This commit is contained in:
@@ -98,8 +98,10 @@ bool C2DView::OnRButtonDown( int x, int y ){
|
||||
m_xPosMove = x; // horizontal position of cursor
|
||||
m_yPosMove = y; // vertical position of cursor
|
||||
// store
|
||||
m_MinsMove[0] = m_Mins[0]; m_MinsMove[1] = m_Mins[1];
|
||||
m_MaxsMove[0] = m_Maxs[0]; m_MaxsMove[1] = m_Maxs[1];
|
||||
m_MinsMove[0] = m_Mins[0];
|
||||
m_MinsMove[1] = m_Mins[1];
|
||||
m_MaxsMove[0] = m_Maxs[0];
|
||||
m_MaxsMove[1] = m_Maxs[1];
|
||||
ViewState = View_Move;
|
||||
// set popup to true
|
||||
m_bPopup = true;
|
||||
|
||||
@@ -32,38 +32,42 @@
|
||||
|
||||
class C2DView
|
||||
{
|
||||
enum E2DViewState { View_Idle, View_Move } ViewState;
|
||||
int m_xPosMove, m_yPosMove;
|
||||
float m_MinsMove[2], m_MaxsMove[2];
|
||||
qboolean m_bDoGrid;
|
||||
float m_GridStep[2];
|
||||
qboolean m_bPopup;
|
||||
enum E2DViewState { View_Idle, View_Move } ViewState;
|
||||
int m_xPosMove, m_yPosMove;
|
||||
float m_MinsMove[2], m_MaxsMove[2];
|
||||
qboolean m_bDoGrid;
|
||||
float m_GridStep[2];
|
||||
qboolean m_bPopup;
|
||||
public:
|
||||
RECT m_rect;
|
||||
float m_Mins[2],m_Maxs[2],m_Center[2];
|
||||
C2DView(){
|
||||
ViewState = View_Idle;
|
||||
m_bDoGrid = false;
|
||||
m_bPopup = false;
|
||||
}
|
||||
~C2DView() { }
|
||||
void SetGrid( float xGridStep, float yGridStep )
|
||||
{ m_bDoGrid = true; m_GridStep[0] = xGridStep; m_GridStep[1] = yGridStep; }
|
||||
RECT m_rect;
|
||||
float m_Mins[2],m_Maxs[2],m_Center[2];
|
||||
C2DView(){
|
||||
ViewState = View_Idle;
|
||||
m_bDoGrid = false;
|
||||
m_bPopup = false;
|
||||
}
|
||||
~C2DView() { }
|
||||
void SetGrid( float xGridStep, float yGridStep )
|
||||
{
|
||||
m_bDoGrid = true;
|
||||
m_GridStep[0] = xGridStep;
|
||||
m_GridStep[1] = yGridStep;
|
||||
}
|
||||
|
||||
// get window coordinates for space coordinates
|
||||
void WindowForSpace( int &x, int &y, const float c[2] );
|
||||
void SpaceForWindow( float c[2], int x, int y );
|
||||
void GridForWindow( float c[2], int x, int y );
|
||||
qboolean DoesSelect( int x, int y, float c[2] );
|
||||
void PreparePaint();
|
||||
void WindowForSpace( int &x, int &y, const float c[2] );
|
||||
void SpaceForWindow( float c[2], int x, int y );
|
||||
void GridForWindow( float c[2], int x, int y );
|
||||
qboolean DoesSelect( int x, int y, float c[2] );
|
||||
void PreparePaint();
|
||||
|
||||
bool OnRButtonDown( int x, int y );
|
||||
bool OnMouseMove( int x, int y );
|
||||
bool OnRButtonUp( int x, int y );
|
||||
bool OnKeyDown( char *s );
|
||||
bool OnRButtonDown( int x, int y );
|
||||
bool OnMouseMove( int x, int y );
|
||||
bool OnRButtonUp( int x, int y );
|
||||
bool OnKeyDown( char *s );
|
||||
|
||||
void ZoomIn();
|
||||
void ZoomOut();
|
||||
void ZoomIn();
|
||||
void ZoomOut();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
void CControlPointsManagerBFace::Init( int iPts, CtrlPts_t *Pts, C2DView *p2DView, int TexSize[2],
|
||||
_QERFaceData* pFaceData, OpenGLBinding *pQglTable ){
|
||||
_QERFaceData* pFaceData, OpenGLBinding *pQglTable ){
|
||||
ManagerState = Idle;
|
||||
m_NumPoints = iPts;
|
||||
m_pPts = Pts;
|
||||
@@ -37,9 +37,11 @@ void CControlPointsManagerBFace::Init( int iPts, CtrlPts_t *Pts, C2DView *p2DVie
|
||||
memcpy( &m_RefPts, Pts, sizeof( CtrlPts_t ) );
|
||||
// init TM
|
||||
memset( m_TM, 0, sizeof( float[2][3] ) );
|
||||
m_TM[0][0] = 1.0f; m_TM[1][1] = 1.0f;
|
||||
m_TM[0][0] = 1.0f;
|
||||
m_TM[1][1] = 1.0f;
|
||||
m_bGotAnchor = false;
|
||||
m_TransOffset[0] = 0.0f; m_TransOffset[1] = 0.0f;
|
||||
m_TransOffset[0] = 0.0f;
|
||||
m_TransOffset[1] = 0.0f;
|
||||
m_TexSize[0] = TexSize[0];
|
||||
m_TexSize[1] = TexSize[1];
|
||||
m_pFaceData = pFaceData;
|
||||
@@ -110,11 +112,13 @@ bool CControlPointsManagerBFace::OnMouseMove( int xPos, int yPos ){
|
||||
// current position of the Anchor in XY space
|
||||
XYSpaceForSTSpace( XYAnchor, m_Anchor );
|
||||
// compute transformation matrix
|
||||
XYTM[0][0] = c; XYTM[1][1] = c;
|
||||
XYTM[0][0] = c;
|
||||
XYTM[1][1] = c;
|
||||
if ( cross[2] > 0 ) {
|
||||
s *= -1.0f;
|
||||
}
|
||||
XYTM[0][1] = s; XYTM[1][0] = -s;
|
||||
XYTM[0][1] = s;
|
||||
XYTM[1][0] = -s;
|
||||
XYTM[0][2] = -c * XYRefAnchor[0] - s * XYRefAnchor[1] + XYAnchor[0];
|
||||
XYTM[1][2] = s * XYRefAnchor[0] - c * XYRefAnchor[1] + XYAnchor[1];
|
||||
// express this transformation matrix in ST space
|
||||
|
||||
@@ -41,93 +41,103 @@ class CControlPointsManager
|
||||
{
|
||||
protected:
|
||||
// used by Render
|
||||
OpenGLBinding *m_pQglTable;
|
||||
C2DView *m_p2DView;
|
||||
OpenGLBinding *m_pQglTable;
|
||||
C2DView *m_p2DView;
|
||||
public:
|
||||
CControlPointsManager() { m_pQglTable = NULL; m_p2DView = NULL; }
|
||||
virtual ~CControlPointsManager() { }
|
||||
void Init( C2DView *p2DView, OpenGLBinding *pQglTable ) { m_pQglTable = pQglTable; m_p2DView = p2DView; }
|
||||
CControlPointsManager() {
|
||||
m_pQglTable = NULL;
|
||||
m_p2DView = NULL;
|
||||
}
|
||||
virtual ~CControlPointsManager() { }
|
||||
void Init( C2DView *p2DView, OpenGLBinding *pQglTable ) {
|
||||
m_pQglTable = pQglTable;
|
||||
m_p2DView = p2DView;
|
||||
}
|
||||
|
||||
virtual bool OnLButtonDown( int x, int y ) = 0;
|
||||
virtual bool OnMouseMove( int x, int y ) = 0;
|
||||
virtual bool OnLButtonUp( int x, int y ) = 0;
|
||||
virtual bool OnLButtonDown( int x, int y ) = 0;
|
||||
virtual bool OnMouseMove( int x, int y ) = 0;
|
||||
virtual bool OnLButtonUp( int x, int y ) = 0;
|
||||
|
||||
virtual void render() = 0;
|
||||
virtual void Commit() = 0;
|
||||
virtual void render() = 0;
|
||||
virtual void Commit() = 0;
|
||||
};
|
||||
|
||||
// brush face manager
|
||||
class CControlPointsManagerBFace : public CControlPointsManager
|
||||
{
|
||||
enum EManagerState { Idle, Drag } ManagerState;
|
||||
int m_NumPoints;
|
||||
enum EManagerState { Idle, Drag } ManagerState;
|
||||
int m_NumPoints;
|
||||
// initial geometry
|
||||
CtrlPts_t m_RefPts;
|
||||
CtrlPts_t m_RefPts;
|
||||
// current geometry
|
||||
CtrlPts_t *m_pPts;
|
||||
CtrlPts_t *m_pPts;
|
||||
// transform matrix ( 2DView is Window <-> ST )
|
||||
float m_TM[2][3];
|
||||
float m_TM[2][3];
|
||||
// texture size for ST <-> XY
|
||||
int m_TexSize[2];
|
||||
int m_TexSize[2];
|
||||
// used when translating
|
||||
float m_TransOffset[2];
|
||||
float m_TransOffset[2];
|
||||
// dragged point index
|
||||
int m_iDragPoint;
|
||||
int m_iDragPoint;
|
||||
// do we have an anchor ?
|
||||
bool m_bGotAnchor;
|
||||
bool m_bGotAnchor;
|
||||
// anchor point index
|
||||
int m_iAnchorPoint;
|
||||
int m_iAnchorPoint;
|
||||
// coordinates of Anchor
|
||||
float m_Anchor[2];
|
||||
float m_Anchor[2];
|
||||
// used for commit
|
||||
_QERFaceData *m_pFaceData;
|
||||
_QERFaceData *m_pFaceData;
|
||||
|
||||
public:
|
||||
// construction / init -------------------------------------------------
|
||||
CControlPointsManagerBFace() { ManagerState = Idle; }
|
||||
virtual ~CControlPointsManagerBFace() { }
|
||||
CControlPointsManagerBFace() {
|
||||
ManagerState = Idle;
|
||||
}
|
||||
virtual ~CControlPointsManagerBFace() { }
|
||||
// NOTE: pQglTable is sent to CControlPointsManager::Init
|
||||
void Init( int iPts, CtrlPts_t * Pts, C2DView * p2DView, int TexSize[2], _QERFaceData * pFaceData, OpenGLBinding * pQglTable );
|
||||
void Init( int iPts, CtrlPts_t * Pts, C2DView * p2DView, int TexSize[2], _QERFaceData * pFaceData, OpenGLBinding * pQglTable );
|
||||
// CControlPointsManager interface -------------------------------------
|
||||
|
||||
virtual bool OnLButtonDown( int x, int y );
|
||||
virtual bool OnMouseMove( int x, int y );
|
||||
virtual bool OnLButtonUp( int x, int y );
|
||||
virtual bool OnLButtonDown( int x, int y );
|
||||
virtual bool OnMouseMove( int x, int y );
|
||||
virtual bool OnLButtonUp( int x, int y );
|
||||
|
||||
virtual void render();
|
||||
virtual void Commit();
|
||||
virtual void render();
|
||||
virtual void Commit();
|
||||
|
||||
private:
|
||||
// internal members
|
||||
void UpdateCtrlPts();
|
||||
void ComputeTransOffset( int i );
|
||||
void XYSpaceForSTSpace( float xy[2], const float st[2] );
|
||||
void UpdateCtrlPts();
|
||||
void ComputeTransOffset( int i );
|
||||
void XYSpaceForSTSpace( float xy[2], const float st[2] );
|
||||
};
|
||||
|
||||
// patch manager
|
||||
class CControlPointsManagerPatch : public CControlPointsManager
|
||||
{
|
||||
enum EManagerState { Idle, Drag } ManagerState;
|
||||
enum EManagerState { Idle, Drag } ManagerState;
|
||||
// reference data, used for commits
|
||||
patchMesh_t* m_pPatch;
|
||||
patchMesh_t* m_pPatch;
|
||||
// work patch, holds current data
|
||||
patchMesh_t* m_pWorkPatch;
|
||||
int m_iDragPoint[2];
|
||||
patchMesh_t* m_pWorkPatch;
|
||||
int m_iDragPoint[2];
|
||||
|
||||
public:
|
||||
// construction / init -------------------------------------------------
|
||||
CControlPointsManagerPatch() { ManagerState = Idle; }
|
||||
virtual ~CControlPointsManagerPatch() { }
|
||||
CControlPointsManagerPatch() {
|
||||
ManagerState = Idle;
|
||||
}
|
||||
virtual ~CControlPointsManagerPatch() { }
|
||||
// NOTE: pQglTable is sent to CControlPointsManager::Init
|
||||
void Init( patchMesh_t* pWorkPatch, C2DView *p2DView, OpenGLBinding *pQglTable, patchMesh_t* pPatch );
|
||||
void Init( patchMesh_t* pWorkPatch, C2DView *p2DView, OpenGLBinding *pQglTable, patchMesh_t* pPatch );
|
||||
// CControlPointsManager interface -------------------------------------
|
||||
|
||||
virtual bool OnLButtonDown( int x, int y );
|
||||
virtual bool OnMouseMove( int x, int y );
|
||||
virtual bool OnLButtonUp( int x, int y );
|
||||
virtual bool OnLButtonDown( int x, int y );
|
||||
virtual bool OnMouseMove( int x, int y );
|
||||
virtual bool OnLButtonUp( int x, int y );
|
||||
|
||||
virtual void render();
|
||||
virtual void Commit();
|
||||
virtual void render();
|
||||
virtual void Commit();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -99,27 +99,33 @@ extern "C" void Sys_Printf( char *text, ... );
|
||||
// NOTE: I'm not too sure about the bool flags being any use.. they are supposed to tell if we handle the event or not
|
||||
class CWindowListener : public IWindowListener
|
||||
{
|
||||
int refCount;
|
||||
int refCount;
|
||||
public:
|
||||
// Increment the number of references to this object
|
||||
void IncRef() { refCount++; }
|
||||
// Decrement the reference count
|
||||
void DecRef() {
|
||||
if ( --refCount <= 0 ) {
|
||||
delete this;
|
||||
void IncRef() {
|
||||
refCount++;
|
||||
}
|
||||
// Decrement the reference count
|
||||
void DecRef() {
|
||||
if ( --refCount <= 0 ) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
}
|
||||
// IWindowListener ---------------------------------------
|
||||
bool OnLButtonDown( guint32 nFlags, double x, double y );
|
||||
bool OnMButtonDown( guint32 nFlags, double x, double y ) { return false; }
|
||||
bool OnRButtonDown( guint32 nFlags, double x, double y );
|
||||
bool OnLButtonUp( guint32 nFlags, double x, double y );
|
||||
bool OnMButtonUp( guint32 nFlags, double x, double y ) { return false; }
|
||||
bool OnRButtonUp( guint32 nFlags, double x, double y );
|
||||
bool OnMouseMove( guint32 nFlags, double x, double y );
|
||||
bool OnKeyPressed( char *s );
|
||||
bool Paint();
|
||||
void Close();
|
||||
bool OnLButtonDown( guint32 nFlags, double x, double y );
|
||||
bool OnMButtonDown( guint32 nFlags, double x, double y ) {
|
||||
return false;
|
||||
}
|
||||
bool OnRButtonDown( guint32 nFlags, double x, double y );
|
||||
bool OnLButtonUp( guint32 nFlags, double x, double y );
|
||||
bool OnMButtonUp( guint32 nFlags, double x, double y ) {
|
||||
return false;
|
||||
}
|
||||
bool OnRButtonUp( guint32 nFlags, double x, double y );
|
||||
bool OnMouseMove( guint32 nFlags, double x, double y );
|
||||
bool OnKeyPressed( char *s );
|
||||
bool Paint();
|
||||
void Close();
|
||||
};
|
||||
|
||||
#include "2DView.h"
|
||||
@@ -148,11 +154,11 @@ class CSynapseClientTexTool : public CSynapseClient
|
||||
{
|
||||
public:
|
||||
// CSynapseClient API
|
||||
bool RequestAPI( APIDescriptor_t *pAPI );
|
||||
const char* GetInfo();
|
||||
bool RequestAPI( APIDescriptor_t *pAPI );
|
||||
const char* GetInfo();
|
||||
|
||||
CSynapseClientTexTool() { }
|
||||
virtual ~CSynapseClientTexTool() { }
|
||||
CSynapseClientTexTool() { }
|
||||
virtual ~CSynapseClientTexTool() { }
|
||||
};
|
||||
|
||||
extern IWindow *g_pToolWnd;
|
||||
|
||||
@@ -56,9 +56,9 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
|
||||
|
||||
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
|
||||
g_signal_connect( G_OBJECT( window ), "delete_event",
|
||||
G_CALLBACK( dialog_delete_callback ), NULL );
|
||||
G_CALLBACK( dialog_delete_callback ), NULL );
|
||||
g_signal_connect( G_OBJECT( window ), "destroy",
|
||||
G_CALLBACK( gtk_widget_destroy ), NULL );
|
||||
G_CALLBACK( gtk_widget_destroy ), NULL );
|
||||
gtk_window_set_title( GTK_WINDOW( window ), lpCaption );
|
||||
gtk_container_set_border_width( GTK_CONTAINER( window ), 10 );
|
||||
g_object_set_data( G_OBJECT( window ), "loop", &loop );
|
||||
@@ -86,7 +86,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
|
||||
w = gtk_button_new_with_label( "Ok" );
|
||||
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
|
||||
g_signal_connect( G_OBJECT( w ), "clicked",
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
|
||||
gtk_widget_set_can_default( w, TRUE );
|
||||
gtk_widget_grab_default( w );
|
||||
gtk_widget_show( w );
|
||||
@@ -96,7 +96,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
|
||||
w = gtk_button_new_with_label( "Ok" );
|
||||
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
|
||||
g_signal_connect( G_OBJECT( w ), "clicked",
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
|
||||
gtk_widget_set_can_default( w, TRUE );
|
||||
gtk_widget_grab_default( w );
|
||||
gtk_widget_show( w );
|
||||
@@ -104,7 +104,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
|
||||
w = gtk_button_new_with_label( "Cancel" );
|
||||
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
|
||||
g_signal_connect( G_OBJECT( w ), "clicked",
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
|
||||
gtk_widget_show( w );
|
||||
ret = IDCANCEL;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
|
||||
w = gtk_button_new_with_label( "Yes" );
|
||||
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
|
||||
g_signal_connect( G_OBJECT( w ), "clicked",
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
|
||||
gtk_widget_set_can_default( w, TRUE );
|
||||
gtk_widget_grab_default( w );
|
||||
gtk_widget_show( w );
|
||||
@@ -120,13 +120,13 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
|
||||
w = gtk_button_new_with_label( "No" );
|
||||
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
|
||||
g_signal_connect( G_OBJECT( w ), "clicked",
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
|
||||
gtk_widget_show( w );
|
||||
|
||||
w = gtk_button_new_with_label( "Cancel" );
|
||||
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
|
||||
g_signal_connect( G_OBJECT( w ), "clicked",
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
|
||||
gtk_widget_show( w );
|
||||
ret = IDCANCEL;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
|
||||
w = gtk_button_new_with_label( "Yes" );
|
||||
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
|
||||
g_signal_connect( G_OBJECT( w ), "clicked",
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDYES ) );
|
||||
gtk_widget_set_can_default( w, TRUE );
|
||||
gtk_widget_grab_default( w );
|
||||
gtk_widget_show( w );
|
||||
@@ -143,7 +143,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){
|
||||
w = gtk_button_new_with_label( "No" );
|
||||
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
|
||||
g_signal_connect( G_OBJECT( w ), "clicked",
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
|
||||
G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDNO ) );
|
||||
gtk_widget_show( w );
|
||||
ret = IDNO;
|
||||
}
|
||||
@@ -231,8 +231,8 @@ bool g_bHelp = false;
|
||||
bool g_bClosing = false;
|
||||
|
||||
const char *PLUGIN_ABOUT = "Texture Tools for Radiant\n\n"
|
||||
"Gtk port by Leonardo Zide (leo@lokigames.com)\n"
|
||||
"Original version by Timothee \"TTimo\" Besset (timo@qeradiant.com)";
|
||||
"Gtk port by Leonardo Zide (leo@lokigames.com)\n"
|
||||
"Original version by Timothee \"TTimo\" Besset (timo@qeradiant.com)";
|
||||
|
||||
extern "C" void* WINAPI QERPlug_GetFuncTable(){
|
||||
return &g_FuncTable;
|
||||
@@ -340,8 +340,10 @@ void InitTexView( IWindow* hwndDlg ){
|
||||
// we have something selected
|
||||
// setup: compute BBox for the winding ( in ST space )
|
||||
//++timo FIXME: move this in a C2DView member ? used as well for patches
|
||||
g_2DView.m_Mins[0] = +9999.0f; g_2DView.m_Mins[1] = +9999.0f;
|
||||
g_2DView.m_Maxs[0] = -9999.0f; g_2DView.m_Maxs[1] = -9999.0f;
|
||||
g_2DView.m_Mins[0] = +9999.0f;
|
||||
g_2DView.m_Mins[1] = +9999.0f;
|
||||
g_2DView.m_Maxs[0] = -9999.0f;
|
||||
g_2DView.m_Maxs[1] = -9999.0f;
|
||||
for ( i = 0; i < g_pSelectedFaceWinding->numpoints; i++ )
|
||||
{
|
||||
if ( g_pSelectedFaceWinding->points[i][3] < g_2DView.m_Mins[0] ) {
|
||||
@@ -383,8 +385,10 @@ void InitTexView( IWindow* hwndDlg ){
|
||||
g_bPatch = true;
|
||||
int i,j;
|
||||
// compute BBox for all patch points
|
||||
g_2DView.m_Mins[0] = +9999.0f; g_2DView.m_Mins[1] = +9999.0f;
|
||||
g_2DView.m_Maxs[0] = -9999.0f; g_2DView.m_Maxs[1] = -9999.0f;
|
||||
g_2DView.m_Mins[0] = +9999.0f;
|
||||
g_2DView.m_Mins[1] = +9999.0f;
|
||||
g_2DView.m_Maxs[0] = -9999.0f;
|
||||
g_2DView.m_Maxs[1] = -9999.0f;
|
||||
for ( i = 0; i < g_pPatch->width; i++ )
|
||||
{
|
||||
for ( j = 0; j < g_pPatch->height; j++ )
|
||||
@@ -523,8 +527,8 @@ static bool CanProcess(){
|
||||
if ( !g_bTexViewReady ) {
|
||||
g_bClosing = true;
|
||||
DoMessageBox( "You must have brush primitives activated in your project settings and\n"
|
||||
"have a patch or a single face selected to use the TexTool plugin.\n"
|
||||
"See plugins/TexToolHelp for documentation.", "TexTool plugin", MB_ICONERROR | MB_OK );
|
||||
"have a patch or a single face selected to use the TexTool plugin.\n"
|
||||
"See plugins/TexToolHelp for documentation.", "TexTool plugin", MB_ICONERROR | MB_OK );
|
||||
// decref, this will destroy
|
||||
g_pToolWnd->DecRef();
|
||||
g_pToolWnd = NULL;
|
||||
@@ -547,9 +551,11 @@ static void button_press( GtkWidget *widget, GdkEventButton *event, gpointer dat
|
||||
switch ( event->button )
|
||||
{
|
||||
case 1:
|
||||
g_pManager->OnLButtonDown( event->x, event->y ); break;
|
||||
g_pManager->OnLButtonDown( event->x, event->y );
|
||||
break;
|
||||
case 3:
|
||||
g_2DView.OnRButtonDown( event->x, event->y ); break;
|
||||
g_2DView.OnRButtonDown( event->x, event->y );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -559,9 +565,11 @@ static void button_release( GtkWidget *widget, GdkEventButton *event, gpointer d
|
||||
switch ( event->button )
|
||||
{
|
||||
case 1:
|
||||
g_pManager->OnLButtonUp( event->x, event->y ); break;
|
||||
g_pManager->OnLButtonUp( event->x, event->y );
|
||||
break;
|
||||
case 3:
|
||||
g_2DView.OnRButtonUp( event->x, event->y ); break;
|
||||
g_2DView.OnRButtonUp( event->x, event->y );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -640,20 +648,20 @@ static GtkWidget* CreateOpenGLWidget(){
|
||||
g_pToolWidget = g_QglTable.m_pfn_glwidget_new( FALSE, g_QglTable.m_pfn_GetQeglobalsGLWidget() );
|
||||
|
||||
gtk_widget_set_events( g_pToolWidget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK |
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK );
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK );
|
||||
|
||||
// Connect signal handlers
|
||||
g_signal_connect( G_OBJECT( g_pToolWidget ), "expose_event", G_CALLBACK( expose ), NULL );
|
||||
g_signal_connect( G_OBJECT( g_pToolWidget ), "motion_notify_event",
|
||||
G_CALLBACK( motion ), NULL );
|
||||
G_CALLBACK( motion ), NULL );
|
||||
g_signal_connect( G_OBJECT( g_pToolWidget ), "button_press_event",
|
||||
G_CALLBACK( button_press ), NULL );
|
||||
G_CALLBACK( button_press ), NULL );
|
||||
g_signal_connect( G_OBJECT( g_pToolWidget ), "button_release_event",
|
||||
G_CALLBACK( button_release ), NULL );
|
||||
G_CALLBACK( button_release ), NULL );
|
||||
|
||||
g_signal_connect( G_OBJECT( g_pToolWnd ), "delete_event", G_CALLBACK( close ), NULL );
|
||||
g_signal_connect( G_OBJECT( g_pToolWnd ), "key_press_event",
|
||||
G_CALLBACK( keypress ), NULL );
|
||||
G_CALLBACK( keypress ), NULL );
|
||||
|
||||
return g_pToolWidget;
|
||||
}
|
||||
@@ -771,7 +779,7 @@ bool CWindowListener::OnKeyPressed( char *s ){
|
||||
}
|
||||
|
||||
extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool bSingleBrush ){
|
||||
#if 0
|
||||
#if 0
|
||||
// if it's the first call, perhaps we need some additional init steps
|
||||
if ( !g_bQglInitDone ) {
|
||||
g_QglTable.m_nSize = sizeof( OpenGLBinding );
|
||||
@@ -788,7 +796,7 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool
|
||||
if ( !g_bSelectedFaceInitDone ) {
|
||||
g_SelectedFaceTable.m_nSize = sizeof( _QERSelectedFaceTable );
|
||||
if ( g_FuncTable.m_pfnRequestInterface( QERSelectedFaceTable_GUID,
|
||||
static_cast<LPVOID>( &g_SelectedFaceTable ) ) ) {
|
||||
static_cast<LPVOID>( &g_SelectedFaceTable ) ) ) {
|
||||
g_bSelectedFaceInitDone = true;
|
||||
}
|
||||
else
|
||||
@@ -821,7 +829,7 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if ( !strcmp( p, "About..." ) ) {
|
||||
DoMessageBox( PLUGIN_ABOUT, "About ...", MB_OK );
|
||||
@@ -847,7 +855,7 @@ extern "C" void QERPlug_Dispatch( const char* p, vec3_t vMin, vec3_t vMax, bool
|
||||
else if ( !strcmp( p, "Help..." ) ) {
|
||||
if ( !g_bHelp ) {
|
||||
DoMessageBox( "Select a brush face (ctrl+shift+left mouse) or a patch, and hit Go...\n"
|
||||
"See tutorials for more", "TexTool plugin", MB_OK );
|
||||
"See tutorials for more", "TexTool plugin", MB_OK );
|
||||
}
|
||||
else{
|
||||
DoMessageBox( "Are you kidding me ?", "TexTool plugin", MB_OK );
|
||||
|
||||
Reference in New Issue
Block a user