my own uncrustify run

This commit is contained in:
Rudolf Polzer
2012-03-27 12:03:21 +02:00
parent 203343b01a
commit e4287c28bb
1056 changed files with 194610 additions and 205971 deletions

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//-----------------------------------------------------------------------------
//
@@ -29,174 +29,155 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "StdAfx.h"
static void view_ZoomIn (GtkWidget* widget, gpointer data)
{
((C2DView*)data)->ZoomIn ();
static void view_ZoomIn( GtkWidget* widget, gpointer data ){
( (C2DView*)data )->ZoomIn();
}
static void view_ZoomOut (GtkWidget* widget, gpointer data)
{
((C2DView*)data)->ZoomOut ();
static void view_ZoomOut( GtkWidget* widget, gpointer data ){
( (C2DView*)data )->ZoomOut();
}
void C2DView::PreparePaint()
{
g_QglTable.m_pfn_qglClearColor( 0, 0, 0, 0 );
g_QglTable.m_pfn_qglViewport( 0, 0, m_rect.right, m_rect.bottom );
g_QglTable.m_pfn_qglMatrixMode( GL_PROJECTION );
g_QglTable.m_pfn_qglLoadIdentity();
g_QglTable.m_pfn_qglOrtho( m_Mins[0], m_Maxs[0], m_Maxs[1], m_Mins[1], -1, 1 );
void C2DView::PreparePaint(){
g_QglTable.m_pfn_qglClearColor( 0, 0, 0, 0 );
g_QglTable.m_pfn_qglViewport( 0, 0, m_rect.right, m_rect.bottom );
g_QglTable.m_pfn_qglMatrixMode( GL_PROJECTION );
g_QglTable.m_pfn_qglLoadIdentity();
g_QglTable.m_pfn_qglOrtho( m_Mins[0], m_Maxs[0], m_Maxs[1], m_Mins[1], -1, 1 );
}
void C2DView::SpaceForWindow( float c[2], int x, int y)
{
c[0] = ((float)(x))/((float)(m_rect.right-m_rect.left))*(m_Maxs[0]-m_Mins[0])+m_Mins[0];
c[1] = ((float)(y))/((float)(m_rect.bottom-m_rect.top))*(m_Maxs[1]-m_Mins[1])+m_Mins[1];
void C2DView::SpaceForWindow( float c[2], int x, int y ){
c[0] = ( (float)( x ) ) / ( (float)( m_rect.right - m_rect.left ) ) * ( m_Maxs[0] - m_Mins[0] ) + m_Mins[0];
c[1] = ( (float)( y ) ) / ( (float)( m_rect.bottom - m_rect.top ) ) * ( m_Maxs[1] - m_Mins[1] ) + m_Mins[1];
}
void C2DView::GridForWindow( float c[2], int x, int y)
{
SpaceForWindow( c, x, y );
if ( !m_bDoGrid )
return;
c[0] /= m_GridStep[0];
c[1] /= m_GridStep[1];
c[0] = (float)floor( c[0] + 0.5f );
c[1] = (float)floor( c[1] + 0.5f );
c[0] *= m_GridStep[0];
c[1] *= m_GridStep[1];
void C2DView::GridForWindow( float c[2], int x, int y ){
SpaceForWindow( c, x, y );
if ( !m_bDoGrid ) {
return;
}
c[0] /= m_GridStep[0];
c[1] /= m_GridStep[1];
c[0] = (float)floor( c[0] + 0.5f );
c[1] = (float)floor( c[1] + 0.5f );
c[0] *= m_GridStep[0];
c[1] *= m_GridStep[1];
}
void C2DView::WindowForSpace( int &x, int &y, const float c[2] )
{
x = m_rect.left + (int)( ((float)(m_rect.right-m_rect.left))*(c[0]-m_Mins[0])/(m_Maxs[0]-m_Mins[0]) );
y = m_rect.top + (int)( ((float)(m_rect.bottom-m_rect.top))*(c[1]-m_Mins[1])/(m_Maxs[1]-m_Mins[1]) );
void C2DView::WindowForSpace( int &x, int &y, const float c[2] ){
x = m_rect.left + (int)( ( (float)( m_rect.right - m_rect.left ) ) * ( c[0] - m_Mins[0] ) / ( m_Maxs[0] - m_Mins[0] ) );
y = m_rect.top + (int)( ( (float)( m_rect.bottom - m_rect.top ) ) * ( c[1] - m_Mins[1] ) / ( m_Maxs[1] - m_Mins[1] ) );
}
qboolean C2DView::DoesSelect( int x, int y, float c[2] )
{
int xc,yc;
WindowForSpace( xc, yc, c );
if ( abs(xc-x)<=3 && abs(yc-y)<=3 )
return true;
return false;
qboolean C2DView::DoesSelect( int x, int y, float c[2] ){
int xc,yc;
WindowForSpace( xc, yc, c );
if ( abs( xc - x ) <= 3 && abs( yc - y ) <= 3 ) {
return true;
}
return false;
}
void C2DView::ZoomIn()
{
m_Mins[0] = 0.5f * ( m_Mins[0] - m_Center[0] ) + m_Center[0];
m_Mins[1] = 0.5f * ( m_Mins[1] - m_Center[1] ) + m_Center[1];
m_Maxs[0] = 0.5f * ( m_Maxs[0] - m_Center[0] ) + m_Center[0];
m_Maxs[1] = 0.5f * ( m_Maxs[1] - m_Center[1] ) + m_Center[1];
g_pToolWnd->Redraw ();
void C2DView::ZoomIn(){
m_Mins[0] = 0.5f * ( m_Mins[0] - m_Center[0] ) + m_Center[0];
m_Mins[1] = 0.5f * ( m_Mins[1] - m_Center[1] ) + m_Center[1];
m_Maxs[0] = 0.5f * ( m_Maxs[0] - m_Center[0] ) + m_Center[0];
m_Maxs[1] = 0.5f * ( m_Maxs[1] - m_Center[1] ) + m_Center[1];
g_pToolWnd->Redraw();
}
void C2DView::ZoomOut()
{
m_Mins[0] = 2.0f * ( m_Mins[0] - m_Center[0] ) + m_Center[0];
m_Mins[1] = 2.0f * ( m_Mins[1] - m_Center[1] ) + m_Center[1];
m_Maxs[0] = 2.0f * ( m_Maxs[0] - m_Center[0] ) + m_Center[0];
m_Maxs[1] = 2.0f * ( m_Maxs[1] - m_Center[1] ) + m_Center[1];
g_pToolWnd->Redraw ();
void C2DView::ZoomOut(){
m_Mins[0] = 2.0f * ( m_Mins[0] - m_Center[0] ) + m_Center[0];
m_Mins[1] = 2.0f * ( m_Mins[1] - m_Center[1] ) + m_Center[1];
m_Maxs[0] = 2.0f * ( m_Maxs[0] - m_Center[0] ) + m_Center[0];
m_Maxs[1] = 2.0f * ( m_Maxs[1] - m_Center[1] ) + m_Center[1];
g_pToolWnd->Redraw();
}
bool C2DView::OnRButtonDown (int x, int y)
{
if (ViewState == View_Idle)
{
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];
ViewState = View_Move;
// set popup to true
m_bPopup = true;
return true;
}
return false;
bool C2DView::OnRButtonDown( int x, int y ){
if ( ViewState == View_Idle ) {
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];
ViewState = View_Move;
// set popup to true
m_bPopup = true;
return true;
}
return false;
}
bool C2DView::OnRButtonUp (int x, int y)
{
if (ViewState == View_Move)
{
// maybe it's time for popup menu
if (m_bPopup)
{
GtkWidget *menu, *item;
bool C2DView::OnRButtonUp( int x, int y ){
if ( ViewState == View_Move ) {
// maybe it's time for popup menu
if ( m_bPopup ) {
GtkWidget *menu, *item;
menu = gtk_menu_new ();
menu = gtk_menu_new();
item = gtk_menu_item_new_with_label ("Validate (RETURN)");
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (Textool_Validate), NULL);
gtk_widget_show (item);
gtk_menu_append (GTK_MENU (menu), item);
item = gtk_menu_item_new_with_label( "Validate (RETURN)" );
gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( Textool_Validate ), NULL );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
item = gtk_menu_item_new_with_label ("Zoom in (INSERT)");
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (view_ZoomIn), this);
gtk_widget_show (item);
gtk_menu_append (GTK_MENU (menu), item);
item = gtk_menu_item_new_with_label( "Zoom in (INSERT)" );
gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( view_ZoomIn ), this );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
item = gtk_menu_item_new_with_label ("Zoom out (DELETE)");
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (view_ZoomOut), this);
gtk_widget_show (item);
gtk_menu_append (GTK_MENU (menu), item);
item = gtk_menu_item_new_with_label( "Zoom out (DELETE)" );
gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( view_ZoomOut ), this );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
item = gtk_menu_item_new_with_label ("Cancel (ESC)");
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (Textool_Cancel), NULL);
gtk_widget_show (item);
gtk_menu_append (GTK_MENU (menu), item);
item = gtk_menu_item_new_with_label( "Cancel (ESC)" );
gtk_signal_connect( GTK_OBJECT( item ), "activate", GTK_SIGNAL_FUNC( Textool_Cancel ), NULL );
gtk_widget_show( item );
gtk_menu_append( GTK_MENU( menu ), item );
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME);
}
gtk_menu_popup( GTK_MENU( menu ), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME );
}
// back to Idle mode
ViewState = View_Idle;
return true;
}
return false;
// back to Idle mode
ViewState = View_Idle;
return true;
}
return false;
}
bool C2DView::OnMouseMove (int xPos, int yPos)
{
if (ViewState == View_Move)
{
float V[2];
// V is the offset
V[0] = ((float)( xPos - m_xPosMove )) * ( m_MaxsMove[0] - m_MinsMove[0] ) / ((float)( m_rect.left - m_rect.right ));
V[1] = ((float)( yPos - m_yPosMove )) * ( m_MaxsMove[1] - m_MinsMove[1] ) / ((float)( m_rect.top - m_rect.bottom ));
// update m_Mins m_Maxs and m_Center
m_Mins[0] = m_MinsMove[0] + V[0];
m_Mins[1] = m_MinsMove[1] + V[1];
m_Maxs[0] = m_MaxsMove[0] + V[0];
m_Maxs[1] = m_MaxsMove[1] + V[1];
m_Center[0] = 0.5f * ( m_Mins[0] + m_Maxs[0] );
m_Center[1] = 0.5f * ( m_Mins[1] + m_Maxs[1] );
// no popup menu if we moved
m_bPopup = false;
// send a repaint message
g_pToolWnd->Redraw ();
return true;
}
return false;
bool C2DView::OnMouseMove( int xPos, int yPos ){
if ( ViewState == View_Move ) {
float V[2];
// V is the offset
V[0] = ( (float)( xPos - m_xPosMove ) ) * ( m_MaxsMove[0] - m_MinsMove[0] ) / ( (float)( m_rect.left - m_rect.right ) );
V[1] = ( (float)( yPos - m_yPosMove ) ) * ( m_MaxsMove[1] - m_MinsMove[1] ) / ( (float)( m_rect.top - m_rect.bottom ) );
// update m_Mins m_Maxs and m_Center
m_Mins[0] = m_MinsMove[0] + V[0];
m_Mins[1] = m_MinsMove[1] + V[1];
m_Maxs[0] = m_MaxsMove[0] + V[0];
m_Maxs[1] = m_MaxsMove[1] + V[1];
m_Center[0] = 0.5f * ( m_Mins[0] + m_Maxs[0] );
m_Center[1] = 0.5f * ( m_Mins[1] + m_Maxs[1] );
// no popup menu if we moved
m_bPopup = false;
// send a repaint message
g_pToolWnd->Redraw();
return true;
}
return false;
}
bool C2DView::OnKeyDown (char *s)
{
if (ViewState == View_Idle)
{
if (!strcmp(s,"Insert"))
{
ZoomOut();
return true;
}
if (!strcmp(s,"Delete"))
{
ZoomIn();
return true;
}
}
return false;
bool C2DView::OnKeyDown( char *s ){
if ( ViewState == View_Idle ) {
if ( !strcmp( s,"Insert" ) ) {
ZoomOut();
return true;
}
if ( !strcmp( s,"Delete" ) ) {
ZoomIn();
return true;
}
}
return false;
}

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//-----------------------------------------------------------------------------
//
@@ -32,39 +32,38 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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();
// 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();
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

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//-----------------------------------------------------------------------------
//
@@ -28,305 +28,281 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "StdAfx.h"
void CControlPointsManagerBFace::Init (int iPts, CtrlPts_t *Pts, C2DView *p2DView, int TexSize[2],
_QERFaceData* pFaceData, OpenGLBinding *pQglTable)
{
ManagerState = Idle;
m_NumPoints = iPts;
m_pPts = Pts;
// store the initial config
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_bGotAnchor = false;
m_TransOffset[0] = 0.0f; m_TransOffset[1] = 0.0f;
m_TexSize[0] = TexSize[0];
m_TexSize[1] = TexSize[1];
m_pFaceData = pFaceData;
void CControlPointsManagerBFace::Init( int iPts, CtrlPts_t *Pts, C2DView *p2DView, int TexSize[2],
_QERFaceData* pFaceData, OpenGLBinding *pQglTable ){
ManagerState = Idle;
m_NumPoints = iPts;
m_pPts = Pts;
// store the initial config
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_bGotAnchor = false;
m_TransOffset[0] = 0.0f; m_TransOffset[1] = 0.0f;
m_TexSize[0] = TexSize[0];
m_TexSize[1] = TexSize[1];
m_pFaceData = pFaceData;
CControlPointsManager::Init( p2DView, pQglTable );
CControlPointsManager::Init( p2DView, pQglTable );
}
bool CControlPointsManagerBFace::OnLButtonDown (int xPos, int yPos)
{
if (ManagerState == Idle)
{
int i;
bool CControlPointsManagerBFace::OnLButtonDown( int xPos, int yPos ){
if ( ManagerState == Idle ) {
int i;
// scan the point list to see if we selected something
for ( i=0; i<m_NumPoints; i++ )
if ( m_p2DView->DoesSelect( xPos, yPos, m_pPts->data[i] ) )
{
m_iDragPoint = i;
ManagerState = Drag;
if (m_bGotAnchor && i == m_iAnchorPoint)
{
// this means we selected the Anchor, so we'll translate
m_bGotAnchor = false;
// scan the point list to see if we selected something
for ( i = 0; i < m_NumPoints; i++ )
if ( m_p2DView->DoesSelect( xPos, yPos, m_pPts->data[i] ) ) {
m_iDragPoint = i;
ManagerState = Drag;
if ( m_bGotAnchor && i == m_iAnchorPoint ) {
// this means we selected the Anchor, so we'll translate
m_bGotAnchor = false;
}
// perhaps we won't use translation, but we can compute it anyway
ComputeTransOffset( i );
if ( m_bGotAnchor ) {
// we have an Anchor and selected another point
m_Anchor[0] = m_pPts->data[m_iAnchorPoint][0];
m_Anchor[1] = m_pPts->data[m_iAnchorPoint][1];
}
}
// send a repaint message
g_pToolWnd->Redraw();
return true;
}
// perhaps we won't use translation, but we can compute it anyway
ComputeTransOffset(i);
if (m_bGotAnchor)
{
// we have an Anchor and selected another point
m_Anchor[0] = m_pPts->data[m_iAnchorPoint][0];
m_Anchor[1] = m_pPts->data[m_iAnchorPoint][1];
return false;
}
bool CControlPointsManagerBFace::OnMouseMove( int xPos, int yPos ){
if ( ManagerState == Drag ) {
if ( m_bGotAnchor ) {
// there's an anchor, we are rotating the shape
// we need to work in XY space for orthonormality
float Pt[2];
vec3_t V1,V2;
vec3_t cross;
float c,s;
// used in XY space
float XYTM[2][3];
float XYRefAnchor[2];
float XYAnchor[2];
m_p2DView->GridForWindow( Pt, xPos, yPos );
V2[0] = Pt[0] - m_Anchor[0];
V2[1] = Pt[1] - m_Anchor[1];
V2[2] = 0.0f;
V1[0] = m_RefPts.data[m_iDragPoint][0] - m_RefPts.data[m_iAnchorPoint][0];
V1[1] = m_RefPts.data[m_iDragPoint][1] - m_RefPts.data[m_iAnchorPoint][1];
V1[2] = 0.0f;
// compute transformation from V1 to V2
// we need to work in XY orthonormal space
XYSpaceForSTSpace( V1, V1 );
XYSpaceForSTSpace( V2, V2 );
VectorNormalize( V2, V2 );
VectorNormalize( V1, V1 );
c = DotProduct( V1, V2 );
CrossProduct( V1, V2, cross );
s = VectorLength( cross );
// we compute the transformation matrix in XY space
// reference position of the Anchor in XY space
XYSpaceForSTSpace( XYRefAnchor, m_RefPts.data[m_iAnchorPoint] );
// current position of the Anchor in XY space
XYSpaceForSTSpace( XYAnchor, m_Anchor );
// compute transformation matrix
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][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
m_TM[0][0] = XYTM[0][0];
m_TM[1][0] = XYTM[1][0] * (float)m_TexSize[0] / (float)m_TexSize[1];
m_TM[0][1] = XYTM[0][1] * (float)m_TexSize[1] / (float)m_TexSize[0];
m_TM[1][1] = XYTM[1][1];
m_TM[0][2] = XYTM[0][2] / (float)m_TexSize[0];
m_TM[1][2] = XYTM[1][2] / (float)m_TexSize[1];
// update all points
UpdateCtrlPts();
}
else
{
// no Anchor point is defined, we translate all points
m_p2DView->GridForWindow( m_pPts->data[m_iDragPoint], xPos, yPos );
m_TM[0][2] = m_pPts->data[m_iDragPoint][0] + m_TransOffset[0];
m_TM[1][2] = m_pPts->data[m_iDragPoint][1] + m_TransOffset[1];
// update all points
UpdateCtrlPts();
}
// send a repaint message
g_pToolWnd->Redraw();
return true;
}
}
// send a repaint message
g_pToolWnd->Redraw ();
return true;
}
return false;
return false;
}
bool CControlPointsManagerBFace::OnMouseMove (int xPos, int yPos)
{
if (ManagerState == Drag)
{
if (m_bGotAnchor)
{
// there's an anchor, we are rotating the shape
// we need to work in XY space for orthonormality
float Pt[2];
vec3_t V1,V2;
vec3_t cross;
float c,s;
// used in XY space
float XYTM[2][3];
float XYRefAnchor[2];
float XYAnchor[2];
m_p2DView->GridForWindow( Pt, xPos, yPos );
V2[0] = Pt[0] - m_Anchor[0];
V2[1] = Pt[1] - m_Anchor[1];
V2[2] = 0.0f;
V1[0] = m_RefPts.data[m_iDragPoint][0] - m_RefPts.data[m_iAnchorPoint][0];
V1[1] = m_RefPts.data[m_iDragPoint][1] - m_RefPts.data[m_iAnchorPoint][1];
V1[2] = 0.0f;
// compute transformation from V1 to V2
// we need to work in XY orthonormal space
XYSpaceForSTSpace( V1, V1 );
XYSpaceForSTSpace( V2, V2 );
VectorNormalize( V2, V2 );
VectorNormalize( V1, V1 );
c = DotProduct( V1, V2 );
CrossProduct( V1, V2, cross );
s = VectorLength( cross );
// we compute the transformation matrix in XY space
// reference position of the Anchor in XY space
XYSpaceForSTSpace( XYRefAnchor, m_RefPts.data[m_iAnchorPoint] );
// current position of the Anchor in XY space
XYSpaceForSTSpace( XYAnchor, m_Anchor );
// compute transformation matrix
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][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
m_TM[0][0] = XYTM[0][0];
m_TM[1][0] = XYTM[1][0] * (float)m_TexSize[0] / (float)m_TexSize[1];
m_TM[0][1] = XYTM[0][1] * (float)m_TexSize[1] / (float)m_TexSize[0];
m_TM[1][1] = XYTM[1][1];
m_TM[0][2] = XYTM[0][2] / (float)m_TexSize[0];
m_TM[1][2] = XYTM[1][2] / (float)m_TexSize[1];
// update all points
UpdateCtrlPts();
}
else
{
// no Anchor point is defined, we translate all points
m_p2DView->GridForWindow( m_pPts->data[m_iDragPoint], xPos, yPos );
m_TM[0][2] = m_pPts->data[m_iDragPoint][0] + m_TransOffset[0];
m_TM[1][2] = m_pPts->data[m_iDragPoint][1] + m_TransOffset[1];
// update all points
UpdateCtrlPts();
}
// send a repaint message
g_pToolWnd->Redraw ();
return true;
}
return false;
bool CControlPointsManagerBFace::OnLButtonUp( int x, int y ){
if ( ManagerState == Drag ) {
// this button is gonna become our Anchor
m_bGotAnchor = true;
m_iAnchorPoint = m_iDragPoint;
// let's get out of Drag mode
ManagerState = Idle;
// send a repaint message
g_pToolWnd->Redraw();
return true;
}
return false;
}
bool CControlPointsManagerBFace::OnLButtonUp (int x, int y)
{
if (ManagerState == Drag)
{
// this button is gonna become our Anchor
m_bGotAnchor = true;
m_iAnchorPoint = m_iDragPoint;
// let's get out of Drag mode
ManagerState = Idle;
// send a repaint message
g_pToolWnd->Redraw ();
return true;
}
return false;
void CControlPointsManagerBFace::render(){
int i;
m_pQglTable->m_pfn_qglColor3f( 0, 1, 0 );
m_pQglTable->m_pfn_qglPointSize( 6 );
m_pQglTable->m_pfn_qglBegin( GL_POINTS );
for ( i = 0; i < m_NumPoints; i++ )
{
if ( ManagerState == Drag && i == m_iDragPoint ) {
m_pQglTable->m_pfn_qglColor3f( 1, 0, 0 );
}
else if ( m_bGotAnchor && i == m_iAnchorPoint ) {
m_pQglTable->m_pfn_qglColor3f( 0, 0, 1 );
}
m_pQglTable->m_pfn_qglVertex2f( m_pPts->data[i][0], m_pPts->data[i][1] );
m_pQglTable->m_pfn_qglColor3f( 0, 1, 0 );
}
m_pQglTable->m_pfn_qglEnd();
}
void CControlPointsManagerBFace::render()
{
int i;
void CControlPointsManagerBFace::UpdateCtrlPts(){
int i;
m_pQglTable->m_pfn_qglColor3f(0, 1, 0);
m_pQglTable->m_pfn_qglPointSize(6);
m_pQglTable->m_pfn_qglBegin( GL_POINTS );
for ( i=0; i<m_NumPoints; i++ )
{
if ( ManagerState == Drag && i == m_iDragPoint )
m_pQglTable->m_pfn_qglColor3f(1, 0, 0);
else if ( m_bGotAnchor && i == m_iAnchorPoint )
m_pQglTable->m_pfn_qglColor3f(0, 0, 1);
m_pQglTable->m_pfn_qglVertex2f( m_pPts->data[i][0], m_pPts->data[i][1] );
m_pQglTable->m_pfn_qglColor3f(0, 1, 0);
}
m_pQglTable->m_pfn_qglEnd();
}
// update all points
for ( i = 0; i < m_NumPoints; i++ )
{
m_pPts->data[i][0] = m_RefPts.data[i][0] * m_TM[0][0] + m_RefPts.data[i][1] * m_TM[0][1] + m_TM[0][2];
m_pPts->data[i][1] = m_RefPts.data[i][0] * m_TM[1][0] + m_RefPts.data[i][1] * m_TM[1][1] + m_TM[1][2];
}
void CControlPointsManagerBFace::UpdateCtrlPts()
{
int i;
// update all points
for ( i=0; i<m_NumPoints; i++ )
{
m_pPts->data[i][0] = m_RefPts.data[i][0]*m_TM[0][0]+m_RefPts.data[i][1]*m_TM[0][1]+m_TM[0][2];
m_pPts->data[i][1] = m_RefPts.data[i][0]*m_TM[1][0]+m_RefPts.data[i][1]*m_TM[1][1]+m_TM[1][2];
}
if (g_bPrefsUpdateCameraView)
{
Commit();
// tell Radiant to update
// NOTE: little speed optimisation, disable window updates, and only update camera view
g_FuncTable.m_pfnSetScreenUpdate( false );
g_SelectedFaceTable.m_pfnSetFaceInfo( 0, m_pFaceData );
g_FuncTable.m_pfnSetScreenUpdate( true );
g_FuncTable.m_pfnSysUpdateWindows( W_CAMERA );
}
if ( g_bPrefsUpdateCameraView ) {
Commit();
// tell Radiant to update
// NOTE: little speed optimisation, disable window updates, and only update camera view
g_FuncTable.m_pfnSetScreenUpdate( false );
g_SelectedFaceTable.m_pfnSetFaceInfo( 0, m_pFaceData );
g_FuncTable.m_pfnSetScreenUpdate( true );
g_FuncTable.m_pfnSysUpdateWindows( W_CAMERA );
}
}
//++timo FIXME: we are using a global for the reference data, use a m_pCancelFaceData instead
void CControlPointsManagerBFace::Commit( )
{
brushprimit_texdef_t aux;
aux.coords[0][0] = m_TM[0][0]*g_CancelFaceData.brushprimit_texdef.coords[0][0] + m_TM[0][1]*g_CancelFaceData.brushprimit_texdef.coords[1][0];
aux.coords[0][1] = m_TM[0][0]*g_CancelFaceData.brushprimit_texdef.coords[0][1] + m_TM[0][1]*g_CancelFaceData.brushprimit_texdef.coords[1][1];
aux.coords[0][2] = m_TM[0][0]*g_CancelFaceData.brushprimit_texdef.coords[0][2] + m_TM[0][1]*g_CancelFaceData.brushprimit_texdef.coords[1][2] + m_TM[0][2];
aux.coords[1][0] = m_TM[1][0]*g_CancelFaceData.brushprimit_texdef.coords[0][0] + m_TM[1][1]*g_CancelFaceData.brushprimit_texdef.coords[1][0];
aux.coords[1][1] = m_TM[1][0]*g_CancelFaceData.brushprimit_texdef.coords[0][1] + m_TM[1][1]*g_CancelFaceData.brushprimit_texdef.coords[1][1];
aux.coords[1][2] = m_TM[1][0]*g_CancelFaceData.brushprimit_texdef.coords[0][2] + m_TM[1][1]*g_CancelFaceData.brushprimit_texdef.coords[1][2] + m_TM[1][2];
memcpy( &m_pFaceData->brushprimit_texdef, &aux, sizeof(brushprimit_texdef_t) );
void CControlPointsManagerBFace::Commit(){
brushprimit_texdef_t aux;
aux.coords[0][0] = m_TM[0][0] * g_CancelFaceData.brushprimit_texdef.coords[0][0] + m_TM[0][1] * g_CancelFaceData.brushprimit_texdef.coords[1][0];
aux.coords[0][1] = m_TM[0][0] * g_CancelFaceData.brushprimit_texdef.coords[0][1] + m_TM[0][1] * g_CancelFaceData.brushprimit_texdef.coords[1][1];
aux.coords[0][2] = m_TM[0][0] * g_CancelFaceData.brushprimit_texdef.coords[0][2] + m_TM[0][1] * g_CancelFaceData.brushprimit_texdef.coords[1][2] + m_TM[0][2];
aux.coords[1][0] = m_TM[1][0] * g_CancelFaceData.brushprimit_texdef.coords[0][0] + m_TM[1][1] * g_CancelFaceData.brushprimit_texdef.coords[1][0];
aux.coords[1][1] = m_TM[1][0] * g_CancelFaceData.brushprimit_texdef.coords[0][1] + m_TM[1][1] * g_CancelFaceData.brushprimit_texdef.coords[1][1];
aux.coords[1][2] = m_TM[1][0] * g_CancelFaceData.brushprimit_texdef.coords[0][2] + m_TM[1][1] * g_CancelFaceData.brushprimit_texdef.coords[1][2] + m_TM[1][2];
memcpy( &m_pFaceData->brushprimit_texdef, &aux, sizeof( brushprimit_texdef_t ) );
}
void CControlPointsManagerBFace::ComputeTransOffset(int i)
{
// compute the translation offset used to counteract rotation
m_TransOffset[0] = -m_TM[0][0]*m_RefPts.data[i][0] - m_TM[0][1]*m_RefPts.data[i][1];
m_TransOffset[1] = -m_TM[1][0]*m_RefPts.data[i][0] - m_TM[1][1]*m_RefPts.data[i][1];
void CControlPointsManagerBFace::ComputeTransOffset( int i ){
// compute the translation offset used to counteract rotation
m_TransOffset[0] = -m_TM[0][0] * m_RefPts.data[i][0] - m_TM[0][1] * m_RefPts.data[i][1];
m_TransOffset[1] = -m_TM[1][0] * m_RefPts.data[i][0] - m_TM[1][1] * m_RefPts.data[i][1];
}
void CControlPointsManagerBFace::XYSpaceForSTSpace( float xy[2], const float st[2] )
{
xy[0] = st[0] * (float)m_TexSize[0];
xy[1] = st[1] * (float)m_TexSize[1];
void CControlPointsManagerBFace::XYSpaceForSTSpace( float xy[2], const float st[2] ){
xy[0] = st[0] * (float)m_TexSize[0];
xy[1] = st[1] * (float)m_TexSize[1];
}
/*
======================================================================
patch manager
======================================================================
*/
======================================================================
patch manager
======================================================================
*/
void CControlPointsManagerPatch::Init( patchMesh_t* pWorkPatch, C2DView *p2DView, OpenGLBinding *pQglTable, patchMesh_t* pPatch )
{
CControlPointsManager::Init( p2DView, pQglTable );
m_pPatch = pPatch;
m_pWorkPatch = pWorkPatch;
void CControlPointsManagerPatch::Init( patchMesh_t* pWorkPatch, C2DView *p2DView, OpenGLBinding *pQglTable, patchMesh_t* pPatch ){
CControlPointsManager::Init( p2DView, pQglTable );
m_pPatch = pPatch;
m_pWorkPatch = pWorkPatch;
}
bool CControlPointsManagerPatch::OnLButtonDown (int xPos, int yPos)
{
if (ManagerState == Idle)
{
int i,j;
bool CControlPointsManagerPatch::OnLButtonDown( int xPos, int yPos ){
if ( ManagerState == Idle ) {
int i,j;
// scan the point list to see if we selected something
for ( i=0; i<m_pPatch->width; i++ )
for ( j=0; j<m_pPatch->height; j++ )
if ( m_p2DView->DoesSelect( xPos, yPos, m_pWorkPatch->ctrl[i][j].st ) )
{
m_iDragPoint[0] = i;
m_iDragPoint[1] = j;
ManagerState = Drag;
// scan the point list to see if we selected something
for ( i = 0; i < m_pPatch->width; i++ )
for ( j = 0; j < m_pPatch->height; j++ )
if ( m_p2DView->DoesSelect( xPos, yPos, m_pWorkPatch->ctrl[i][j].st ) ) {
m_iDragPoint[0] = i;
m_iDragPoint[1] = j;
ManagerState = Drag;
}
// send a repaint message
g_pToolWnd->Redraw();
return true;
}
// send a repaint message
g_pToolWnd->Redraw ();
return true;
}
return false;
return false;
}
bool CControlPointsManagerPatch::OnMouseMove (int xPos, int yPos)
{
if (ManagerState == Drag)
{
m_p2DView->GridForWindow( m_pWorkPatch->ctrl[ m_iDragPoint[0] ][ m_iDragPoint[1] ].st, xPos, yPos );
if (g_bPrefsUpdateCameraView)
{
Commit();
// ask to rebuild the patch display data
m_pPatch->bDirty = true;
// send a repaint to the camera window as well
g_FuncTable.m_pfnSysUpdateWindows( W_CAMERA );
}
// send a repaint message
g_pToolWnd->Redraw ();
return true;
}
return false;
bool CControlPointsManagerPatch::OnMouseMove( int xPos, int yPos ){
if ( ManagerState == Drag ) {
m_p2DView->GridForWindow( m_pWorkPatch->ctrl[ m_iDragPoint[0] ][ m_iDragPoint[1] ].st, xPos, yPos );
if ( g_bPrefsUpdateCameraView ) {
Commit();
// ask to rebuild the patch display data
m_pPatch->bDirty = true;
// send a repaint to the camera window as well
g_FuncTable.m_pfnSysUpdateWindows( W_CAMERA );
}
// send a repaint message
g_pToolWnd->Redraw();
return true;
}
return false;
}
bool CControlPointsManagerPatch::OnLButtonUp (int x, int y)
{
if (ManagerState == Drag)
{
ManagerState = Idle;
// send a repaint message
g_pToolWnd->Redraw ();
}
return false;
bool CControlPointsManagerPatch::OnLButtonUp( int x, int y ){
if ( ManagerState == Drag ) {
ManagerState = Idle;
// send a repaint message
g_pToolWnd->Redraw();
}
return false;
}
void CControlPointsManagerPatch::render()
{
int i,j;
void CControlPointsManagerPatch::render(){
int i,j;
m_pQglTable->m_pfn_qglColor3f(0, 1, 0);
m_pQglTable->m_pfn_qglPointSize(6);
m_pQglTable->m_pfn_qglBegin( GL_POINTS );
for ( i=0; i<m_pPatch->width; i++ )
for ( j=0; j<m_pPatch->height; j++ )
{
if ( ManagerState == Drag && i == m_iDragPoint[0] && j == m_iDragPoint[1] )
m_pQglTable->m_pfn_qglColor3f(1, 0, 0);
m_pQglTable->m_pfn_qglVertex2f( m_pWorkPatch->ctrl[i][j].st[0], m_pWorkPatch->ctrl[i][j].st[1] );
m_pQglTable->m_pfn_qglColor3f(0, 1, 0);
}
m_pQglTable->m_pfn_qglEnd();
m_pQglTable->m_pfn_qglColor3f( 0, 1, 0 );
m_pQglTable->m_pfn_qglPointSize( 6 );
m_pQglTable->m_pfn_qglBegin( GL_POINTS );
for ( i = 0; i < m_pPatch->width; i++ )
for ( j = 0; j < m_pPatch->height; j++ )
{
if ( ManagerState == Drag && i == m_iDragPoint[0] && j == m_iDragPoint[1] ) {
m_pQglTable->m_pfn_qglColor3f( 1, 0, 0 );
}
m_pQglTable->m_pfn_qglVertex2f( m_pWorkPatch->ctrl[i][j].st[0], m_pWorkPatch->ctrl[i][j].st[1] );
m_pQglTable->m_pfn_qglColor3f( 0, 1, 0 );
}
m_pQglTable->m_pfn_qglEnd();
}
void CControlPointsManagerPatch::Commit()
{
int i,j;
for ( i=0; i<m_pPatch->width; i++ )
for ( j=0; j<m_pPatch->height; j++ )
{
m_pPatch->ctrl[i][j].st[0] = m_pWorkPatch->ctrl[i][j].st[0];
m_pPatch->ctrl[i][j].st[1] = m_pWorkPatch->ctrl[i][j].st[1];
}
void CControlPointsManagerPatch::Commit(){
int i,j;
for ( i = 0; i < m_pPatch->width; i++ )
for ( j = 0; j < m_pPatch->height; j++ )
{
m_pPatch->ctrl[i][j].st[0] = m_pWorkPatch->ctrl[i][j].st[0];
m_pPatch->ctrl[i][j].st[1] = m_pWorkPatch->ctrl[i][j].st[1];
}
}

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//-----------------------------------------------------------------------------
//
@@ -40,94 +40,94 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
class CControlPointsManager
{
protected:
// used by Render
OpenGLBinding *m_pQglTable;
C2DView *m_p2DView;
// used by Render
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;
// initial geometry
CtrlPts_t m_RefPts;
// current geometry
CtrlPts_t *m_pPts;
// transform matrix ( 2DView is Window <-> ST )
float m_TM[2][3];
// texture size for ST <-> XY
int m_TexSize[2];
// used when translating
float m_TransOffset[2];
// dragged point index
int m_iDragPoint;
// do we have an anchor ?
bool m_bGotAnchor;
// anchor point index
int m_iAnchorPoint;
// coordinates of Anchor
float m_Anchor[2];
// used for commit
_QERFaceData *m_pFaceData;
enum EManagerState { Idle, Drag } ManagerState;
int m_NumPoints;
// initial geometry
CtrlPts_t m_RefPts;
// current geometry
CtrlPts_t *m_pPts;
// transform matrix ( 2DView is Window <-> ST )
float m_TM[2][3];
// texture size for ST <-> XY
int m_TexSize[2];
// used when translating
float m_TransOffset[2];
// dragged point index
int m_iDragPoint;
// do we have an anchor ?
bool m_bGotAnchor;
// anchor point index
int m_iAnchorPoint;
// coordinates of Anchor
float m_Anchor[2];
// used for commit
_QERFaceData *m_pFaceData;
public:
// construction / init -------------------------------------------------
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);
// CControlPointsManager interface -------------------------------------
// construction / init -------------------------------------------------
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 );
// 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] );
// internal members
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;
// reference data, used for commits
patchMesh_t* m_pPatch;
// work patch, holds current data
patchMesh_t* m_pWorkPatch;
int m_iDragPoint[2];
enum EManagerState { Idle, Drag } ManagerState;
// reference data, used for commits
patchMesh_t* m_pPatch;
// work patch, holds current data
patchMesh_t* m_pWorkPatch;
int m_iDragPoint[2];
public:
// construction / init -------------------------------------------------
CControlPointsManagerPatch() { ManagerState = Idle; }
virtual ~CControlPointsManagerPatch() { }
// NOTE: pQglTable is sent to CControlPointsManager::Init
void Init( patchMesh_t* pWorkPatch, C2DView *p2DView, OpenGLBinding *pQglTable, patchMesh_t* pPatch );
// CControlPointsManager interface -------------------------------------
// construction / init -------------------------------------------------
CControlPointsManagerPatch() { ManagerState = Idle; }
virtual ~CControlPointsManagerPatch() { }
// NOTE: pQglTable is sent to CControlPointsManager::Init
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

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// stdafx.cpp : source file that includes just the standard includes
// stdafx.obj will contain the pre-compiled type information

View File

@@ -1,23 +1,23 @@
/*
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// stdafx.h
// precompiled headers
@@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <stdio.h>
#include <stdlib.h>
#if !defined(WIN32)
#if !defined( WIN32 )
// Necessary for proper boolean type declaration
#include "qertypes.h"
@@ -43,25 +43,25 @@ typedef char* LPCSTR;
#define MB_YESNOCANCEL 0x00000003L
#define MB_YESNO 0x00000004L
#define MB_RETRYCANCEL 0x00000005L
#define MB_ICONHAND 0x00000010L
#define MB_ICONQUESTION 0x00000020L
#define MB_ICONEXCLAMATION 0x00000030L
#define MB_ICONASTERISK 0x00000040L
#define MB_USERICON 0x00000080L
#define MB_ICONWARNING MB_ICONEXCLAMATION
#define MB_ICONERROR MB_ICONHAND
#define MB_ICONINFORMATION MB_ICONASTERISK
#define MB_ICONSTOP MB_ICONHAND
#define MB_TYPEMASK 0x0000000FL
#define MB_ICONMASK 0x000000F0L
#define MB_DEFMASK 0x00000F00L
#define MB_MODEMASK 0x00003000L
#define MB_MISCMASK 0x0000C000L
#define IDOK 1
#define IDCANCEL 2
#define IDABORT 3
@@ -72,17 +72,17 @@ typedef char* LPCSTR;
typedef struct tagRECT
{
long left;
long top;
long right;
long bottom;
long left;
long top;
long right;
long bottom;
} RECT, *PRECT, *LPRECT;
#endif // __linux__
// plugin
// FIXME TTimo: drop this
extern "C" void Sys_Printf (char *text, ...);
extern "C" void Sys_Printf( char *text, ... );
#include "synapse.h"
#include "iplugin.h"
@@ -99,39 +99,43 @@ 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; }
// 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();
// Increment the number of references to this object
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();
};
#include "2DView.h"
typedef struct
{
float data[MAX_POINTS_ON_WINDING][2];
float data[MAX_POINTS_ON_WINDING][2];
} CtrlPts_t;
#include "ControlPointsManager.h"
extern OpenGLBinding g_QglTable;
extern _QERFuncTable_1 g_FuncTable;
extern OpenGLBinding g_QglTable;
extern _QERFuncTable_1 g_FuncTable;
// prefs globals
// NOTE: these are used by the CControlPointsManager classes, not very C++ish
extern bool g_bPrefsUpdateCameraView;
extern _QERSelectedFaceTable g_SelectedFaceTable;
extern _QERFaceData g_CancelFaceData;
extern bool g_bPrefsUpdateCameraView;
extern _QERSelectedFaceTable g_SelectedFaceTable;
extern _QERFaceData g_CancelFaceData;
#define Sys_Printf g_FuncTable.m_pfnSysPrintf
#define Sys_FPrintf g_FuncTable.m_pfnSysFPrintf
@@ -143,12 +147,12 @@ extern void Textool_Cancel();
class CSynapseClientTexTool : public CSynapseClient
{
public:
// CSynapseClient API
bool RequestAPI(APIDescriptor_t *pAPI);
const char* GetInfo();
CSynapseClientTexTool() { }
virtual ~CSynapseClientTexTool() { }
// CSynapseClient API
bool RequestAPI( APIDescriptor_t *pAPI );
const char* GetInfo();
CSynapseClientTexTool() { }
virtual ~CSynapseClientTexTool() { }
};
extern IWindow *g_pToolWnd;

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@
#define ID_DROP_CANCEL 40004
// Next default values for new objects
//
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104