mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 12:01:10 +00:00
Merge branch 'master' of https://github.com/TTimo/GtkRadiant
This commit is contained in:
commit
3446bf9b27
27 changed files with 95 additions and 31 deletions
|
@ -68,7 +68,9 @@ typedef bool qboolean;
|
||||||
#define COLOR_GRIDMINOR_ALT 13
|
#define COLOR_GRIDMINOR_ALT 13
|
||||||
#define COLOR_GRIDMAJOR_ALT 14
|
#define COLOR_GRIDMAJOR_ALT 14
|
||||||
|
|
||||||
#define COLOR_LAST 15
|
#define COLOR_DETAIL 15
|
||||||
|
|
||||||
|
#define COLOR_LAST 16
|
||||||
|
|
||||||
// ----------------------------
|
// ----------------------------
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ void CamWnd::OnMouseMove( guint32 flags, int pointx, int pointy ){
|
||||||
update_xor_rectangle( m_XORRectangle );
|
update_xor_rectangle( m_XORRectangle );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CamWnd::OnMouseWheel( bool bUp ){
|
void CamWnd::OnMouseWheel( bool bUp, int pointx, int pointy ){
|
||||||
if ( bUp ) {
|
if ( bUp ) {
|
||||||
VectorMA( m_Camera.origin, g_PrefsDlg.m_nMoveSpeed, m_Camera.forward, m_Camera.origin );
|
VectorMA( m_Camera.origin, g_PrefsDlg.m_nMoveSpeed, m_Camera.forward, m_Camera.origin );
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ void OnLButtonUp( guint32 flags, int pointx, int pointy );
|
||||||
void OnRButtonUp( guint32 flags, int pointx, int pointy );
|
void OnRButtonUp( guint32 flags, int pointx, int pointy );
|
||||||
void OnMButtonUp( guint32 flags, int pointx, int pointy );
|
void OnMButtonUp( guint32 flags, int pointx, int pointy );
|
||||||
void OnMouseMove( guint32 flags, int pointx, int pointy );
|
void OnMouseMove( guint32 flags, int pointx, int pointy );
|
||||||
void OnMouseWheel( bool bUp );
|
void OnMouseWheel( bool bUp, int pointx, int pointy );
|
||||||
void OnSize( int cx, int cy );
|
void OnSize( int cx, int cy );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -159,8 +159,9 @@ eclass_t *Eclass_InitFromText( char *text ){
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
// get the size
|
// get the size
|
||||||
text = COM_Parse( text );
|
t = COM_Parse( text );
|
||||||
if ( Get_COM_Token()[0] == '(' ) { // parse the size as two vectors
|
if ( Get_COM_Token()[0] == '(' ) { // parse the size as two vectors
|
||||||
|
text = t;
|
||||||
e->fixedsize = true;
|
e->fixedsize = true;
|
||||||
r = sscanf( text,"%f %f %f) (%f %f %f)", &e->mins[0], &e->mins[1], &e->mins[2],
|
r = sscanf( text,"%f %f %f) (%f %f %f)", &e->mins[0], &e->mins[1], &e->mins[2],
|
||||||
&e->maxs[0], &e->maxs[1], &e->maxs[2] );
|
&e->maxs[0], &e->maxs[1], &e->maxs[2] );
|
||||||
|
|
|
@ -79,8 +79,8 @@ static void button_press( GtkWidget *widget, GdkEventButton *event, gpointer dat
|
||||||
case 2: flags |= MK_MBUTTON; break;
|
case 2: flags |= MK_MBUTTON; break;
|
||||||
case 3: flags |= MK_RBUTTON; break;
|
case 3: flags |= MK_RBUTTON; break;
|
||||||
#if !GTK_CHECK_VERSION( 1,3,0 )
|
#if !GTK_CHECK_VERSION( 1,3,0 )
|
||||||
case 4: wnd->OnMouseWheel( true ); break;
|
case 4: wnd->OnMouseWheel( true, (int)event->x, (int)event->y ); break;
|
||||||
case 5: wnd->OnMouseWheel( false ); break;
|
case 5: wnd->OnMouseWheel( false, (int)event->x, (int)event->y ); break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ static gint scroll_event( GtkWidget *widget,
|
||||||
GdkEventScroll *event,
|
GdkEventScroll *event,
|
||||||
gpointer data ){
|
gpointer data ){
|
||||||
GLWindow *wnd = (GLWindow*)data;
|
GLWindow *wnd = (GLWindow*)data;
|
||||||
wnd->OnMouseWheel( ( event->direction == GDK_SCROLL_UP ) ? true : false );
|
wnd->OnMouseWheel( ( event->direction == GDK_SCROLL_UP ) ? true : false, (int)event->x, (int)event->y );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
virtual void OnSize( int cx, int cy ) { }
|
virtual void OnSize( int cx, int cy ) { }
|
||||||
virtual void OnTimer() { }
|
virtual void OnTimer() { }
|
||||||
|
|
||||||
virtual void OnMouseWheel( bool bUp ) { }
|
virtual void OnMouseWheel( bool bUp, int pointx, int pointy ) { }
|
||||||
|
|
||||||
void RedrawWindow() { gtk_widget_queue_draw( m_pWidget ); }
|
void RedrawWindow() { gtk_widget_queue_draw( m_pWidget ); }
|
||||||
|
|
||||||
|
|
|
@ -549,6 +549,7 @@ gint HandleCommand( GtkWidget *widget, gpointer data ){
|
||||||
case ID_COLORS_SELECTEDBRUSH3D: g_pParentWnd->OnColorsSelectedbrush3D(); break;
|
case ID_COLORS_SELECTEDBRUSH3D: g_pParentWnd->OnColorsSelectedbrush3D(); break;
|
||||||
case ID_COLORS_CLIPPER: g_pParentWnd->OnColorsClipper(); break;
|
case ID_COLORS_CLIPPER: g_pParentWnd->OnColorsClipper(); break;
|
||||||
case ID_COLORS_VIEWNAME: g_pParentWnd->OnColorsViewname(); break;
|
case ID_COLORS_VIEWNAME: g_pParentWnd->OnColorsViewname(); break;
|
||||||
|
case ID_COLORS_DETAIL: g_pParentWnd->OnColorsDetail(); break;
|
||||||
case ID_MISC_GAMMA: g_pParentWnd->OnMiscGamma(); break;
|
case ID_MISC_GAMMA: g_pParentWnd->OnMiscGamma(); break;
|
||||||
case ID_MISC_FINDBRUSH: g_pParentWnd->OnMiscFindbrush(); break;
|
case ID_MISC_FINDBRUSH: g_pParentWnd->OnMiscFindbrush(); break;
|
||||||
case ID_MISC_NEXTLEAKSPOT: g_pParentWnd->OnMiscNextleakspot(); break;
|
case ID_MISC_NEXTLEAKSPOT: g_pParentWnd->OnMiscNextleakspot(); break;
|
||||||
|
@ -1418,6 +1419,8 @@ void MainFrame::create_main_menu( GtkWidget *window, GtkWidget *vbox ){
|
||||||
GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_CLIPPER );
|
GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_CLIPPER );
|
||||||
create_menu_item_with_mnemonic( menu_in_menu, _( "Active View name..." ),
|
create_menu_item_with_mnemonic( menu_in_menu, _( "Active View name..." ),
|
||||||
GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_VIEWNAME );
|
GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_VIEWNAME );
|
||||||
|
create_menu_item_with_mnemonic( menu_in_menu, _( "Detail Brush..." ),
|
||||||
|
GTK_SIGNAL_FUNC( HandleCommand ), ID_COLORS_DETAIL );
|
||||||
|
|
||||||
create_menu_item_with_mnemonic( menu, _( "_Gamma..." ),
|
create_menu_item_with_mnemonic( menu, _( "_Gamma..." ),
|
||||||
GTK_SIGNAL_FUNC( HandleCommand ), ID_MISC_GAMMA );
|
GTK_SIGNAL_FUNC( HandleCommand ), ID_MISC_GAMMA );
|
||||||
|
@ -5884,6 +5887,10 @@ void MainFrame::OnColorSetoriginal(){
|
||||||
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][1] = 0.0f;
|
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][1] = 0.0f;
|
||||||
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][2] = 0.0f;
|
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][2] = 0.0f;
|
||||||
|
|
||||||
|
g_qeglobals.d_savedinfo.colors[COLOR_DETAIL][0] = 0.0f;
|
||||||
|
g_qeglobals.d_savedinfo.colors[COLOR_DETAIL][1] = 0.0f;
|
||||||
|
g_qeglobals.d_savedinfo.colors[COLOR_DETAIL][2] = 0.0f;
|
||||||
|
|
||||||
g_PrefsDlg.SavePrefs();
|
g_PrefsDlg.SavePrefs();
|
||||||
Sys_UpdateWindows( W_ALL );
|
Sys_UpdateWindows( W_ALL );
|
||||||
}
|
}
|
||||||
|
@ -6088,6 +6095,11 @@ void MainFrame::OnColorsViewname(){
|
||||||
Sys_UpdateWindows( W_ALL );
|
Sys_UpdateWindows( W_ALL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainFrame::OnColorsDetail(){
|
||||||
|
DoColor( COLOR_DETAIL );
|
||||||
|
Sys_UpdateWindows( W_ALL );
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::OnMiscGamma(){
|
void MainFrame::OnMiscGamma(){
|
||||||
float fSave = g_qeglobals.d_savedinfo.fGamma;
|
float fSave = g_qeglobals.d_savedinfo.fGamma;
|
||||||
DoGamma();
|
DoGamma();
|
||||||
|
|
|
@ -105,6 +105,7 @@ struct SKeyInfo
|
||||||
#define ID_COLORS_CLIPPER 32836
|
#define ID_COLORS_CLIPPER 32836
|
||||||
#define ID_COLORS_GRIDBLOCK 32837
|
#define ID_COLORS_GRIDBLOCK 32837
|
||||||
#define ID_COLORS_VIEWNAME 32838
|
#define ID_COLORS_VIEWNAME 32838
|
||||||
|
#define ID_COLORS_DETAIL 37002
|
||||||
#define ID_COLOR_SETORIGINAL 32839
|
#define ID_COLOR_SETORIGINAL 32839
|
||||||
#define ID_COLOR_SETQER 32840
|
#define ID_COLOR_SETQER 32840
|
||||||
#define ID_COLOR_SETBLACK 32841
|
#define ID_COLOR_SETBLACK 32841
|
||||||
|
@ -735,6 +736,7 @@ void OnColorsSelectedbrush3D();
|
||||||
void OnColorsCameraBack();
|
void OnColorsCameraBack();
|
||||||
void OnColorsGridblock();
|
void OnColorsGridblock();
|
||||||
void OnColorsViewname();
|
void OnColorsViewname();
|
||||||
|
void OnColorsDetail();
|
||||||
void OnColorSetoriginal();
|
void OnColorSetoriginal();
|
||||||
void OnColorSetqer();
|
void OnColorSetqer();
|
||||||
void OnColorSetblack();
|
void OnColorSetblack();
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
#define ROTATION_KEY "Rotation"
|
#define ROTATION_KEY "Rotation"
|
||||||
#define BUGGYICD_KEY "BuggyICD"
|
#define BUGGYICD_KEY "BuggyICD"
|
||||||
#define CHASEMOUSE_KEY "ChaseMouse"
|
#define CHASEMOUSE_KEY "ChaseMouse"
|
||||||
|
#define MOUSEWHEELZOOM_KEY "MousewheelZoom"
|
||||||
#define ENTITYSHOW_KEY "EntityShow"
|
#define ENTITYSHOW_KEY "EntityShow"
|
||||||
#define TEXTURESCALE_KEY "TextureScale"
|
#define TEXTURESCALE_KEY "TextureScale"
|
||||||
#define TEXTURESCROLLBAR_KEY "TextureScrollbar"
|
#define TEXTURESCROLLBAR_KEY "TextureScrollbar"
|
||||||
|
@ -620,6 +621,7 @@ PrefsDlg::PrefsDlg (){
|
||||||
m_strUserPath = "";
|
m_strUserPath = "";
|
||||||
m_nRotation = 0;
|
m_nRotation = 0;
|
||||||
m_bChaseMouse = FALSE;
|
m_bChaseMouse = FALSE;
|
||||||
|
m_bMousewheelZoom = FALSE;
|
||||||
m_bTextureScrollbar = TRUE;
|
m_bTextureScrollbar = TRUE;
|
||||||
m_bDisplayLists = TRUE;
|
m_bDisplayLists = TRUE;
|
||||||
m_bAntialiasedPointsAndLines = FALSE; // Fishman - Add antialiazed points and lines support. 09/03/00
|
m_bAntialiasedPointsAndLines = FALSE; // Fishman - Add antialiazed points and lines support. 09/03/00
|
||||||
|
@ -2271,6 +2273,12 @@ void PrefsDlg::BuildDialog(){
|
||||||
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
|
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
|
||||||
AddDialogData( check, &m_bALTEdge, DLG_CHECK_BOOL );
|
AddDialogData( check, &m_bALTEdge, DLG_CHECK_BOOL );
|
||||||
|
|
||||||
|
// Imroved mouse wheel zoom in
|
||||||
|
check = gtk_check_button_new_with_label( _( "Improved mousewheel zoom-in" ) );
|
||||||
|
gtk_widget_show( check );
|
||||||
|
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
|
||||||
|
AddDialogData( check, &m_bMousewheelZoom, DLG_CHECK_BOOL );
|
||||||
|
|
||||||
// Mouse wheel increments
|
// Mouse wheel increments
|
||||||
// container
|
// container
|
||||||
hbox2 = gtk_hbox_new( FALSE, 5 );
|
hbox2 = gtk_hbox_new( FALSE, 5 );
|
||||||
|
@ -2996,6 +3004,7 @@ void PrefsDlg::LoadPrefs(){
|
||||||
mLocalPrefs.GetPref( USERINI_KEY, &m_strUserPath, "" );
|
mLocalPrefs.GetPref( USERINI_KEY, &m_strUserPath, "" );
|
||||||
mLocalPrefs.GetPref( ROTATION_KEY, &m_nRotation, 45 );
|
mLocalPrefs.GetPref( ROTATION_KEY, &m_nRotation, 45 );
|
||||||
mLocalPrefs.GetPref( CHASEMOUSE_KEY, &m_bChaseMouse, TRUE );
|
mLocalPrefs.GetPref( CHASEMOUSE_KEY, &m_bChaseMouse, TRUE );
|
||||||
|
mLocalPrefs.GetPref( MOUSEWHEELZOOM_KEY, &m_bMousewheelZoom, FALSE );
|
||||||
mLocalPrefs.GetPref( ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED );
|
mLocalPrefs.GetPref( ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED );
|
||||||
|
|
||||||
// this will probably need to be 75 or 100 for Q1.
|
// this will probably need to be 75 or 100 for Q1.
|
||||||
|
|
|
@ -619,6 +619,7 @@ bool m_bSnap;
|
||||||
Str m_strUserPath;
|
Str m_strUserPath;
|
||||||
int m_nRotation;
|
int m_nRotation;
|
||||||
bool m_bChaseMouse;
|
bool m_bChaseMouse;
|
||||||
|
bool m_bMousewheelZoom;
|
||||||
bool m_bTextureScrollbar;
|
bool m_bTextureScrollbar;
|
||||||
bool m_bDisplayLists;
|
bool m_bDisplayLists;
|
||||||
bool m_bAntialiasedPointsAndLines; // Fishman - Add antialiazed points and lines support. 09/03/00
|
bool m_bAntialiasedPointsAndLines; // Fishman - Add antialiazed points and lines support. 09/03/00
|
||||||
|
|
|
@ -1794,7 +1794,7 @@ void TexWnd::FocusEdit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TexWnd::OnMouseWheel( bool bUp ){
|
void TexWnd::OnMouseWheel( bool bUp, int pointx, int pointy ){
|
||||||
if ( bUp ) {
|
if ( bUp ) {
|
||||||
if ( g_qeglobals.d_texturewin.originy < 0 ) {
|
if ( g_qeglobals.d_texturewin.originy < 0 ) {
|
||||||
g_qeglobals.d_texturewin.originy += g_PrefsDlg.m_nWheelInc;
|
g_qeglobals.d_texturewin.originy += g_PrefsDlg.m_nWheelInc;
|
||||||
|
|
|
@ -50,7 +50,7 @@ void OnMButtonUp( guint32 flags, int pointx, int pointy );
|
||||||
void OnMouseMove( guint32 flags, int pointx, int pointy );
|
void OnMouseMove( guint32 flags, int pointx, int pointy );
|
||||||
void OnSize( int cx, int cy );
|
void OnSize( int cx, int cy );
|
||||||
|
|
||||||
void OnMouseWheel( bool bUp );
|
void OnMouseWheel( bool bUp, int pointx, int pointy );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void OnVScroll();
|
void OnVScroll();
|
||||||
|
|
|
@ -1156,9 +1156,22 @@ void XYWnd::OnMouseMove( guint32 nFlags, int pointx, int pointy ){
|
||||||
update_xor_rectangle_xy( m_XORRectangle );
|
update_xor_rectangle_xy( m_XORRectangle );
|
||||||
}
|
}
|
||||||
|
|
||||||
void XYWnd::OnMouseWheel( bool bUp ){
|
void XYWnd::OnMouseWheel( bool bUp, int pointx, int pointy ){
|
||||||
if ( bUp ) {
|
if ( bUp ) {
|
||||||
g_pParentWnd->OnViewZoomin();
|
if ( g_PrefsDlg.m_bMousewheelZoom == TRUE ) {
|
||||||
|
// improved zoom-in
|
||||||
|
// frame coverges to part of window where the cursor currently resides
|
||||||
|
float old_scale = m_fScale;
|
||||||
|
g_pParentWnd->OnViewZoomin();
|
||||||
|
float scale_diff = 1.0 / old_scale - 1.0 / m_fScale;
|
||||||
|
int nDim1 = ( m_nViewType == YZ ) ? 1 : 0;
|
||||||
|
int nDim2 = ( m_nViewType == XY ) ? 1 : 2;
|
||||||
|
m_vOrigin[nDim1] += scale_diff * (pointx - 0.5 * m_nWidth);
|
||||||
|
m_vOrigin[nDim2] -= scale_diff * (pointy - 0.5 * m_nHeight);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
g_pParentWnd->OnViewZoomin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
g_pParentWnd->OnViewZoomout();
|
g_pParentWnd->OnViewZoomout();
|
||||||
|
@ -2851,6 +2864,10 @@ void XYWnd::XY_Draw(){
|
||||||
if ( brush->owner != e && brush->owner ) {
|
if ( brush->owner != e && brush->owner ) {
|
||||||
qglColor3fv( brush->owner->eclass->color );
|
qglColor3fv( brush->owner->eclass->color );
|
||||||
}
|
}
|
||||||
|
else if ( brush->brush_faces->texdef.contents & CONTENTS_DETAIL )
|
||||||
|
{
|
||||||
|
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_DETAIL] );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES] );
|
qglColor3fv( g_qeglobals.d_savedinfo.colors[COLOR_BRUSHES] );
|
||||||
|
|
|
@ -191,7 +191,7 @@ void OnLButtonUp( guint32 flags, int pointx, int pointy );
|
||||||
void OnRButtonUp( guint32 flags, int pointx, int pointy );
|
void OnRButtonUp( guint32 flags, int pointx, int pointy );
|
||||||
void OnMButtonUp( guint32 flags, int pointx, int pointy );
|
void OnMButtonUp( guint32 flags, int pointx, int pointy );
|
||||||
void OnMouseMove( guint32 nFlags, int pointx, int pointy );
|
void OnMouseMove( guint32 nFlags, int pointx, int pointy );
|
||||||
void OnMouseWheel( bool bUp );
|
void OnMouseWheel( bool bUp, int pointx, int pointy );
|
||||||
void OnSize( int cx, int cy );
|
void OnSize( int cx, int cy );
|
||||||
void OnTimer();
|
void OnTimer();
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,8 @@ void IncDrawVerts(){
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( numBSPDrawVerts > numBSPDrawVertsBuffer ) {
|
else if ( numBSPDrawVerts > numBSPDrawVertsBuffer ) {
|
||||||
|
bspDrawVert_t *newBspDrawVerts;
|
||||||
|
|
||||||
numBSPDrawVertsBuffer *= 3; // multiply by 1.5
|
numBSPDrawVertsBuffer *= 3; // multiply by 1.5
|
||||||
numBSPDrawVertsBuffer /= 2;
|
numBSPDrawVertsBuffer /= 2;
|
||||||
|
|
||||||
|
@ -75,11 +77,14 @@ void IncDrawVerts(){
|
||||||
numBSPDrawVertsBuffer = MAX_MAP_DRAW_VERTS;
|
numBSPDrawVertsBuffer = MAX_MAP_DRAW_VERTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bspDrawVerts = realloc( bspDrawVerts, sizeof( bspDrawVert_t ) * numBSPDrawVertsBuffer );
|
newBspDrawVerts = realloc( bspDrawVerts, sizeof( bspDrawVert_t ) * numBSPDrawVertsBuffer );
|
||||||
|
|
||||||
if ( !bspDrawVerts ) {
|
if ( !newBspDrawVerts ) {
|
||||||
|
free (bspDrawVerts);
|
||||||
Error( "realloc() failed (IncDrawVerts)" );
|
Error( "realloc() failed (IncDrawVerts)" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bspDrawVerts = newBspDrawVerts;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset( bspDrawVerts + ( numBSPDrawVerts - 1 ), 0, sizeof( bspDrawVert_t ) );
|
memset( bspDrawVerts + ( numBSPDrawVerts - 1 ), 0, sizeof( bspDrawVert_t ) );
|
||||||
|
|
|
@ -185,10 +185,10 @@ static void RadClipWindingEpsilon( radWinding_t *in, vec3_t normal, vec_t dist,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* error check */
|
/* error check */
|
||||||
if ( front->numVerts > maxPoints || front->numVerts > maxPoints ) {
|
if ( front->numVerts > maxPoints ) {
|
||||||
Error( "RadClipWindingEpsilon: points exceeded estimate" );
|
Error( "RadClipWindingEpsilon: points exceeded estimate" );
|
||||||
}
|
}
|
||||||
if ( front->numVerts > MAX_POINTS_ON_WINDING || front->numVerts > MAX_POINTS_ON_WINDING ) {
|
if ( front->numVerts > MAX_POINTS_ON_WINDING ) {
|
||||||
Error( "RadClipWindingEpsilon: MAX_POINTS_ON_WINDING" );
|
Error( "RadClipWindingEpsilon: MAX_POINTS_ON_WINDING" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
|
||||||
/* multiply by texture color */
|
/* multiply by texture color */
|
||||||
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, rw->verts[ samples ].st, textureColor ) ) {
|
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, rw->verts[ samples ].st, textureColor ) ) {
|
||||||
VectorCopy( si->averageColor, textureColor );
|
VectorCopy( si->averageColor, textureColor );
|
||||||
textureColor[ 4 ] = 255.0f;
|
textureColor[ 3 ] = 255.0f;
|
||||||
}
|
}
|
||||||
for ( i = 0; i < 3; i++ )
|
for ( i = 0; i < 3; i++ )
|
||||||
color[ i ] = ( textureColor[ i ] / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ][ i ] / 255.0f );
|
color[ i ] = ( textureColor[ i ] / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ][ i ] / 255.0f );
|
||||||
|
@ -363,7 +363,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
|
||||||
/* multiply by texture color */
|
/* multiply by texture color */
|
||||||
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, st, textureColor ) ) {
|
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, st, textureColor ) ) {
|
||||||
VectorCopy( si->averageColor, textureColor );
|
VectorCopy( si->averageColor, textureColor );
|
||||||
textureColor[ 4 ] = 255;
|
textureColor[ 3 ] = 255;
|
||||||
}
|
}
|
||||||
for ( i = 0; i < 3; i++ )
|
for ( i = 0; i < 3; i++ )
|
||||||
color[ i ] = ( textureColor[ i ] / 255 ) * ( radLuxel[ i ] / 255 );
|
color[ i ] = ( textureColor[ i ] / 255 ) * ( radLuxel[ i ] / 255 );
|
||||||
|
|
|
@ -2104,6 +2104,11 @@ static void FindOutLightmaps( rawLightmap_t *lm ){
|
||||||
/* allocate two new output lightmaps */
|
/* allocate two new output lightmaps */
|
||||||
numOutLightmaps += 2;
|
numOutLightmaps += 2;
|
||||||
olm = safe_malloc( numOutLightmaps * sizeof( outLightmap_t ) );
|
olm = safe_malloc( numOutLightmaps * sizeof( outLightmap_t ) );
|
||||||
|
if ( !olm )
|
||||||
|
{
|
||||||
|
Error( "FindOutLightmaps: Failed to allocate memory.\n" );
|
||||||
|
}
|
||||||
|
|
||||||
if ( outLightmaps != NULL && numOutLightmaps > 2 ) {
|
if ( outLightmaps != NULL && numOutLightmaps > 2 ) {
|
||||||
memcpy( olm, outLightmaps, ( numOutLightmaps - 2 ) * sizeof( outLightmap_t ) );
|
memcpy( olm, outLightmaps, ( numOutLightmaps - 2 ) * sizeof( outLightmap_t ) );
|
||||||
free( outLightmaps );
|
free( outLightmaps );
|
||||||
|
|
|
@ -279,7 +279,7 @@ int AnalyzeBSP( int argc, char **argv ){
|
||||||
lumpInt = LittleLong( (int) *( (int*) lump ) );
|
lumpInt = LittleLong( (int) *( (int*) lump ) );
|
||||||
lumpFloat = LittleFloat( (float) *( (float*) lump ) );
|
lumpFloat = LittleFloat( (float) *( (float*) lump ) );
|
||||||
memcpy( lumpString, (char*) lump, ( length < 1024 ? length : 1024 ) );
|
memcpy( lumpString, (char*) lump, ( length < 1024 ? length : 1024 ) );
|
||||||
lumpString[ 1024 ] = '\0';
|
lumpString[ 1023 ] = '\0';
|
||||||
|
|
||||||
/* print basic lump info */
|
/* print basic lump info */
|
||||||
Sys_Printf( "Lump: %d\n", i );
|
Sys_Printf( "Lump: %d\n", i );
|
||||||
|
|
|
@ -763,7 +763,7 @@ typedef struct shaderInfo_s
|
||||||
sun_t *sun; /* ydnar */
|
sun_t *sun; /* ydnar */
|
||||||
|
|
||||||
vec3_t color; /* normalized color */
|
vec3_t color; /* normalized color */
|
||||||
vec3_t averageColor;
|
vec4_t averageColor;
|
||||||
byte lightStyle;
|
byte lightStyle;
|
||||||
|
|
||||||
qb_t lmMergable; /* ydnar */
|
qb_t lmMergable; /* ydnar */
|
||||||
|
|
|
@ -791,6 +791,7 @@ static void LoadShaderImages( shaderInfo_t *si ){
|
||||||
ColorNormalize( color, si->color );
|
ColorNormalize( color, si->color );
|
||||||
}
|
}
|
||||||
VectorScale( color, ( 1.0f / count ), si->averageColor );
|
VectorScale( color, ( 1.0f / count ), si->averageColor );
|
||||||
|
si->averageColor[ 3 ] = color[ 3 ] / count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -740,7 +740,8 @@ static qboolean PointTriangleIntersect( vec3_t pt, vec4_t plane, vec3_t a, vec3_
|
||||||
|
|
||||||
typedef struct edge_s
|
typedef struct edge_s
|
||||||
{
|
{
|
||||||
vec3_t origin, edge;
|
vec3_t origin;
|
||||||
|
vec4_t edge;
|
||||||
vec_t length, kingpinLength;
|
vec_t length, kingpinLength;
|
||||||
int kingpin;
|
int kingpin;
|
||||||
vec4_t plane;
|
vec4_t plane;
|
||||||
|
|
|
@ -68,6 +68,8 @@ void IncDrawVerts(){
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( numBSPDrawVerts > numBSPDrawVertsBuffer ) {
|
else if ( numBSPDrawVerts > numBSPDrawVertsBuffer ) {
|
||||||
|
bspDrawVert_t *newBspDrawVerts;
|
||||||
|
|
||||||
numBSPDrawVertsBuffer *= 3; // multiply by 1.5
|
numBSPDrawVertsBuffer *= 3; // multiply by 1.5
|
||||||
numBSPDrawVertsBuffer /= 2;
|
numBSPDrawVertsBuffer /= 2;
|
||||||
|
|
||||||
|
@ -75,11 +77,14 @@ void IncDrawVerts(){
|
||||||
numBSPDrawVertsBuffer = MAX_MAP_DRAW_VERTS;
|
numBSPDrawVertsBuffer = MAX_MAP_DRAW_VERTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bspDrawVerts = realloc( bspDrawVerts, sizeof( bspDrawVert_t ) * numBSPDrawVertsBuffer );
|
newBspDrawVerts = realloc( bspDrawVerts, sizeof( bspDrawVert_t ) * numBSPDrawVertsBuffer );
|
||||||
|
|
||||||
if ( !bspDrawVerts ) {
|
if ( !newBspDrawVerts ) {
|
||||||
|
free (bspDrawVerts);
|
||||||
Error( "realloc() failed (IncDrawVerts)" );
|
Error( "realloc() failed (IncDrawVerts)" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bspDrawVerts = newBspDrawVerts;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset( bspDrawVerts + ( numBSPDrawVerts - 1 ), 0, sizeof( bspDrawVert_t ) );
|
memset( bspDrawVerts + ( numBSPDrawVerts - 1 ), 0, sizeof( bspDrawVert_t ) );
|
||||||
|
|
|
@ -185,10 +185,10 @@ static void RadClipWindingEpsilon( radWinding_t *in, vec3_t normal, vec_t dist,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* error check */
|
/* error check */
|
||||||
if ( front->numVerts > maxPoints || front->numVerts > maxPoints ) {
|
if ( front->numVerts > maxPoints ) {
|
||||||
Error( "RadClipWindingEpsilon: points exceeded estimate" );
|
Error( "RadClipWindingEpsilon: points exceeded estimate" );
|
||||||
}
|
}
|
||||||
if ( front->numVerts > MAX_POINTS_ON_WINDING || front->numVerts > MAX_POINTS_ON_WINDING ) {
|
if ( front->numVerts > MAX_POINTS_ON_WINDING ) {
|
||||||
Error( "RadClipWindingEpsilon: MAX_POINTS_ON_WINDING" );
|
Error( "RadClipWindingEpsilon: MAX_POINTS_ON_WINDING" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
|
||||||
/* multiply by texture color */
|
/* multiply by texture color */
|
||||||
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, rw->verts[ samples ].st, textureColor ) ) {
|
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, rw->verts[ samples ].st, textureColor ) ) {
|
||||||
VectorCopy( si->averageColor, textureColor );
|
VectorCopy( si->averageColor, textureColor );
|
||||||
textureColor[ 4 ] = 255.0f;
|
textureColor[ 3 ] = 255.0f;
|
||||||
}
|
}
|
||||||
for ( i = 0; i < 3; i++ )
|
for ( i = 0; i < 3; i++ )
|
||||||
color[ i ] = ( textureColor[ i ] / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ][ i ] / 255.0f );
|
color[ i ] = ( textureColor[ i ] / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ][ i ] / 255.0f );
|
||||||
|
@ -363,7 +363,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
|
||||||
/* multiply by texture color */
|
/* multiply by texture color */
|
||||||
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, st, textureColor ) ) {
|
if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, st, textureColor ) ) {
|
||||||
VectorCopy( si->averageColor, textureColor );
|
VectorCopy( si->averageColor, textureColor );
|
||||||
textureColor[ 4 ] = 255;
|
textureColor[ 3 ] = 255;
|
||||||
}
|
}
|
||||||
for ( i = 0; i < 3; i++ )
|
for ( i = 0; i < 3; i++ )
|
||||||
color[ i ] = ( textureColor[ i ] / 255 ) * ( radLuxel[ i ] / 255 );
|
color[ i ] = ( textureColor[ i ] / 255 ) * ( radLuxel[ i ] / 255 );
|
||||||
|
|
|
@ -169,7 +169,7 @@ int AnalyzeBSP( int argc, char **argv ){
|
||||||
lumpInt = LittleLong( (int) *( (int*) lump ) );
|
lumpInt = LittleLong( (int) *( (int*) lump ) );
|
||||||
lumpFloat = LittleFloat( (float) *( (float*) lump ) );
|
lumpFloat = LittleFloat( (float) *( (float*) lump ) );
|
||||||
memcpy( lumpString, (char*) lump, ( length < 1024 ? length : 1024 ) );
|
memcpy( lumpString, (char*) lump, ( length < 1024 ? length : 1024 ) );
|
||||||
lumpString[ 1024 ] = '\0';
|
lumpString[ 1023 ] = '\0';
|
||||||
|
|
||||||
/* print basic lump info */
|
/* print basic lump info */
|
||||||
Sys_Printf( "Lump: %d\n", i );
|
Sys_Printf( "Lump: %d\n", i );
|
||||||
|
|
|
@ -743,7 +743,7 @@ typedef struct shaderInfo_s
|
||||||
int sun_done;
|
int sun_done;
|
||||||
|
|
||||||
vec3_t color; /* normalized color */
|
vec3_t color; /* normalized color */
|
||||||
vec3_t averageColor;
|
vec4_t averageColor;
|
||||||
byte lightStyle;
|
byte lightStyle;
|
||||||
|
|
||||||
qb_t lmMergable; /* ydnar */
|
qb_t lmMergable; /* ydnar */
|
||||||
|
|
|
@ -789,10 +789,12 @@ static void LoadShaderImages( shaderInfo_t *si ){
|
||||||
if ( VectorLength( si->color ) <= 0.0f ) {
|
if ( VectorLength( si->color ) <= 0.0f ) {
|
||||||
ColorNormalize( color, si->color );
|
ColorNormalize( color, si->color );
|
||||||
VectorScale( color, ( 1.0f / count ), si->averageColor );
|
VectorScale( color, ( 1.0f / count ), si->averageColor );
|
||||||
|
si->averageColor[ 3 ] = color[ 3 ] / count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VectorCopy( si->color, si->averageColor );
|
VectorCopy( si->color, si->averageColor );
|
||||||
|
si->averageColor[ 3 ] = 1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -743,7 +743,8 @@ static qboolean PointTriangleIntersect( vec3_t pt, vec4_t plane, vec3_t a, vec3_
|
||||||
|
|
||||||
typedef struct edge_s
|
typedef struct edge_s
|
||||||
{
|
{
|
||||||
vec3_t origin, edge;
|
vec3_t origin;
|
||||||
|
vec4_t edge;
|
||||||
vec_t length, kingpinLength;
|
vec_t length, kingpinLength;
|
||||||
int kingpin;
|
int kingpin;
|
||||||
vec4_t plane;
|
vec4_t plane;
|
||||||
|
|
Loading…
Reference in a new issue