From 30277762436a37ddd0e38ce820ef18759770570d Mon Sep 17 00:00:00 2001 From: Mateos81 Date: Wed, 11 Nov 2015 11:56:29 +0100 Subject: [PATCH 01/21] Make NULL models rendered as a box, and selectable (were already editable) TODO: - Handle the case "Model not found". - Add relevant console prints. - Fix glitchy-looking selected box. --- include/imodel.h | 1 + plugins/entity/entity_entitymodel.h | 2 ++ plugins/model/cpicomodel.h | 1 + plugins/model/remap.cpp | 6 ++++++ plugins/spritemodel/spritemodel.h | 1 + radiant/brush.cpp | 3 ++- radiant/camwindow.cpp | 16 ++++++++++++++-- 7 files changed, 27 insertions(+), 3 deletions(-) diff --git a/include/imodel.h b/include/imodel.h index 65d88678..2ae1e631 100644 --- a/include/imodel.h +++ b/include/imodel.h @@ -77,6 +77,7 @@ virtual ~IRender() { } virtual void IncRef() = 0; // increments the reference counter for this object virtual void DecRef() = 0; // decrements the reference counter for this object, deletes the object if reference count is zero virtual void Draw( int state, int rflags ) const = 0; // render the object - state = the opengl state +virtual const bool IsModelNotNull() const = 0; virtual const aabb_t *GetAABB() const = 0; }; diff --git a/plugins/entity/entity_entitymodel.h b/plugins/entity/entity_entitymodel.h index f523630b..f3b49324 100644 --- a/plugins/entity/entity_entitymodel.h +++ b/plugins/entity/entity_entitymodel.h @@ -40,6 +40,7 @@ void DecRef() { // IRender void Draw( int state, int rflags ) const; +const bool IsModelNotNull() const { return m_model && m_model->pRender; } const aabb_t *GetAABB() const { return &m_BBox; } // ISelect @@ -105,6 +106,7 @@ void DecRef() { // IRender void Draw( int state, int rflags ) const; +const bool IsModelNotNull() const { return m_model && m_model->pRender; } const aabb_t *GetAABB() const { return &m_BBox; } // ISelect diff --git a/plugins/model/cpicomodel.h b/plugins/model/cpicomodel.h index a5556f24..6432eb9d 100644 --- a/plugins/model/cpicomodel.h +++ b/plugins/model/cpicomodel.h @@ -66,6 +66,7 @@ void Reload( void ); void Draw( int state, vector shaders, int rflags ) const; //IRender virtual void Draw( int state, int rflags ) const; +virtual const bool IsModelNotNull() const { return true; } virtual const aabb_t *GetAABB() const { return &m_BBox; } //ISelect diff --git a/plugins/model/remap.cpp b/plugins/model/remap.cpp index 5e313222..69683eae 100644 --- a/plugins/model/remap.cpp +++ b/plugins/model/remap.cpp @@ -141,6 +141,9 @@ virtual void DecRef(){ virtual void Draw( int state, int rflags ) const { m_model->Draw( state, m_shaders, rflags ); } +virtual const bool IsModelNotNull() const { + return m_model != NULL; +} virtual const aabb_t *GetAABB() const { return m_model->GetAABB(); } @@ -300,6 +303,9 @@ virtual void DecRef(){ virtual void Draw( int state, int rflags ) const { m_model->Draw( state, rflags ); } +virtual const bool IsModelNotNull() const { + return m_model != NULL; +} virtual const aabb_t *GetAABB() const { return m_model->GetAABB(); } diff --git a/plugins/spritemodel/spritemodel.h b/plugins/spritemodel/spritemodel.h index d9be5152..34015df5 100644 --- a/plugins/spritemodel/spritemodel.h +++ b/plugins/spritemodel/spritemodel.h @@ -45,6 +45,7 @@ void DecRef() { //IRender void Draw( int state, int rflags ) const; +const bool IsModelNotNull() const { return true; } const aabb_t *GetAABB() const { return &m_BBox; } //ISelect diff --git a/radiant/brush.cpp b/radiant/brush.cpp index 05ec12fb..6b3d3bbf 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -2223,7 +2223,8 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag if ( b->owner->eclass->fixedsize && b->owner->model.pSelect && !( !IsBrushSelected( b ) && ( g_PrefsDlg.m_nEntityShowState & ENTITY_SELECTED_ONLY ) ) - && g_PrefsDlg.m_nEntityShowState != ENTITY_BOX ) { + && g_PrefsDlg.m_nEntityShowState != ENTITY_BOX + && b->owner->model.pRender->IsModelNotNull()) { ray_t ray_local; vec_t dist_local = FLT_MAX; ray_construct_for_vec3( &ray_local, origin, dir ); diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 8a952be0..466fa612 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -922,12 +922,24 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ if ( !( nGLState & DRAW_GL_TEXTURE_2D ) ) { qglColor4fv( material ); } - else{ qglColor4fv( identity ); } + else { + qglColor4fv( identity ); + } + if ( nGLState & DRAW_GL_LIGHTING ) { qglShadeModel( GL_SMOOTH ); } - b->owner->model.pRender->Draw( nGLState, DRAW_RF_CAM ); + // Check model validity + // If the model is NULL or invalid, draw a box instead + bool temp = b->owner->model.pRender->IsModelNotNull(); + if ( temp ) { + b->owner->model.pRender->Draw(nGLState, DRAW_RF_CAM); + } + else { + qglColor4fv( material ); + aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); + } } break; case DRAW_WIRE: From a0e076ce9b3fa8c5aef92ba24f2268713fdd9e9c Mon Sep 17 00:00:00 2001 From: Mateos81 Date: Sat, 12 Mar 2016 20:05:45 +0100 Subject: [PATCH 02/21] Alignments in code. --- radiant/brush.cpp | 448 +++++++++++++++++++++--------------------- radiant/camwindow.cpp | 10 +- radiant/select.cpp | 28 +-- 3 files changed, 242 insertions(+), 244 deletions(-) diff --git a/radiant/brush.cpp b/radiant/brush.cpp index 6b3d3bbf..8846eb0c 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -74,18 +74,18 @@ void PrintVector( vec3_t v ){ /* - ============================================================================= + ============================================================================= - TEXTURE COORDINATES + TEXTURE COORDINATES - ============================================================================= + ============================================================================= */ /* - ================== - textureAxisFromPlane - ================== + ================== + textureAxisFromPlane + ================== */ vec3_t baseaxis[18] = { @@ -108,7 +108,7 @@ void TextureAxisFromPlane( plane_t *pln, vec3_t xv, vec3_t yv ) { for ( i = 0 ; i < 6 ; i++ ) { dot = DotProduct( pln->normal, baseaxis[i * 3] ); - // see q3map2 source - added () for clarity + // see q3map2 source - added () for clarity if ( ( g_PrefsDlg.m_bQ3Map2Texturing && dot > best + 0.0001f ) || dot > best ) { best = dot; bestaxis = i; @@ -604,18 +604,18 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz // find the STfromXYZ 4-vectors /* - SARRUS-SOLVE: - xyzst1[3] == xyzst1[sv] * STfromXYZ[0][sv] + xyzst1[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - xyzst2[3] == xyzst2[sv] * STfromXYZ[0][sv] + xyzst2[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - xyzst3[3] == xyzst3[sv] * STfromXYZ[0][sv] + xyzst3[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - FOR: STfromXYZ[0] - GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) - SARRUS-SOLVE: - xyzst1[4] == xyzst1[sv] * STfromXYZ[1][sv] + xyzst1[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - xyzst2[4] == xyzst2[sv] * STfromXYZ[1][sv] + xyzst2[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - xyzst3[4] == xyzst3[sv] * STfromXYZ[1][sv] + xyzst3[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - FOR: STfromXYZ[1] - GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) + SARRUS-SOLVE: + xyzst1[3] == xyzst1[sv] * STfromXYZ[0][sv] + xyzst1[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + xyzst2[3] == xyzst2[sv] * STfromXYZ[0][sv] + xyzst2[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + xyzst3[3] == xyzst3[sv] * STfromXYZ[0][sv] + xyzst3[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + FOR: STfromXYZ[0] + GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) + SARRUS-SOLVE: + xyzst1[4] == xyzst1[sv] * STfromXYZ[1][sv] + xyzst1[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + xyzst2[4] == xyzst2[sv] * STfromXYZ[1][sv] + xyzst2[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + xyzst3[4] == xyzst3[sv] * STfromXYZ[1][sv] + xyzst3[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + FOR: STfromXYZ[1] + GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) */ STfromXYZ[0][uv] = 0; @@ -647,8 +647,8 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz float newSTfromXYZ[2][4]; printf("old: %Lf,%Lf,%Lf,%Lf %Lf,%Lf,%Lf,%Lf\n", - STfromXYZ[0][0], STfromXYZ[0][1], STfromXYZ[0][2], STfromXYZ[0][3], - STfromXYZ[1][0], STfromXYZ[1][1], STfromXYZ[1][2], STfromXYZ[1][3]); + STfromXYZ[0][0], STfromXYZ[0][1], STfromXYZ[0][2], STfromXYZ[0][3], + STfromXYZ[1][0], STfromXYZ[1][1], STfromXYZ[1][2], STfromXYZ[1][3]); */ Face_TexdefFromTextureVectors( f, STfromXYZ, pvecs, sv, tv ); @@ -657,8 +657,8 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz Face_TextureVectors(f, newSTfromXYZ); printf("new: %f,%f,%f,%f %f,%f,%f,%f\n", - newSTfromXYZ[0][0], newSTfromXYZ[0][1], newSTfromXYZ[0][2], newSTfromXYZ[0][3], - newSTfromXYZ[1][0], newSTfromXYZ[1][1], newSTfromXYZ[1][2], newSTfromXYZ[1][3]); + newSTfromXYZ[0][0], newSTfromXYZ[0][1], newSTfromXYZ[0][2], newSTfromXYZ[0][3], + newSTfromXYZ[1][0], newSTfromXYZ[1][1], newSTfromXYZ[1][2], newSTfromXYZ[1][3]); float newxyzst1[5]; float newxyzst2[5]; @@ -670,12 +670,12 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz EmitTextureCoordinates (newxyzst2, q, f); EmitTextureCoordinates (newxyzst3, q, f); printf("Face_TexdefFromTextureCoordinates: %f,%f %f,%f %f,%f -> %f,%f %f,%f %f,%f\n", - xyzst1[3], xyzst1[4], - xyzst2[3], xyzst2[4], - xyzst3[3], xyzst3[4], - newxyzst1[3], newxyzst1[4], - newxyzst2[3], newxyzst2[4], - newxyzst3[3], newxyzst3[4]); + xyzst1[3], xyzst1[4], + xyzst2[3], xyzst2[4], + xyzst3[3], xyzst3[4], + newxyzst1[3], newxyzst1[4], + newxyzst2[3], newxyzst2[4], + newxyzst3[3], newxyzst3[4]); // TODO why do these differ, but not the previous ones? this makes no sense whatsoever */ } @@ -1040,16 +1040,16 @@ face_t *Brush_BestSplitFace( brush_t *b ){ } /* - ================= - Brush_MakeConvexBrushes + ================= + Brush_MakeConvexBrushes - MrE FIXME: this doesn't work because the old - Brush_SplitBrushByFace is used - Turns the brush into a minimal number of convex brushes. - If the input brush is convex then it will be returned. - Otherwise the input brush will be freed. - NOTE: the input brush should have windings for the faces. - ================= + MrE FIXME: this doesn't work because the old + Brush_SplitBrushByFace is used + Turns the brush into a minimal number of convex brushes. + If the input brush is convex then it will be returned. + Otherwise the input brush will be freed. + NOTE: the input brush should have windings for the faces. + ================= */ brush_t *Brush_MakeConvexBrushes( brush_t *b ){ brush_t *front, *back, *end; @@ -2078,130 +2078,130 @@ brush_t *Brush_FullClone( brush_t *b ){ // FIXME - spog - finish this later.. /* - bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) - { - int i; - vec3_t v1, v2, normal[3]; - float d; + bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) + { + int i; + vec3_t v1, v2, normal[3]; + float d; - //Sys_Printf("p1: %f %f %f\n",p1[0],p1[1],p1[2]); - //Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]); - //Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]); - //Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]); + //Sys_Printf("p1: %f %f %f\n",p1[0],p1[1],p1[2]); + //Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]); + //Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]); + //Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]); - // test ray against triangle - // get triangle plane normal - //VectorSubtract(p1, p2, v1); - //VectorSubtract(p1, p3, v2); - //CrossProduct(v1, v2, v1); - // check normal against direction - //if (DotProduct(dir, v1) >= 0) - //{ - // generate cone normals - VectorSubtract(origin, p1, v1); - VectorSubtract(origin, p2, v2); - CrossProduct(v1, v2, normal[0]); - VectorSubtract(origin, p2, v1); - VectorSubtract(origin, p3, v2); - CrossProduct(v1, v2, normal[1]); - VectorSubtract(origin, p3, v1); - VectorSubtract(origin, p1, v2); - CrossProduct(v1, v2, normal[2]); - //} - //else - //{ - // flip normals if triangle faces away - // Sys_Printf("flipped\n"); - // VectorSubtract(origin, p1, v1); - // VectorSubtract(origin, p3, v2); - // CrossProduct(v1, v2, normal[0]); - // VectorSubtract(origin, p3, v1); - // VectorSubtract(origin, p2, v2); - // CrossProduct(v1, v2, normal[1]); - // VectorSubtract(origin, p2, v1); - // VectorSubtract(origin, p1, v2); - // CrossProduct(v1, v2, normal[2]); - //} + // test ray against triangle + // get triangle plane normal + //VectorSubtract(p1, p2, v1); + //VectorSubtract(p1, p3, v2); + //CrossProduct(v1, v2, v1); + // check normal against direction + //if (DotProduct(dir, v1) >= 0) + //{ + // generate cone normals + VectorSubtract(origin, p1, v1); + VectorSubtract(origin, p2, v2); + CrossProduct(v1, v2, normal[0]); + VectorSubtract(origin, p2, v1); + VectorSubtract(origin, p3, v2); + CrossProduct(v1, v2, normal[1]); + VectorSubtract(origin, p3, v1); + VectorSubtract(origin, p1, v2); + CrossProduct(v1, v2, normal[2]); + //} + //else + //{ + // flip normals if triangle faces away + // Sys_Printf("flipped\n"); + // VectorSubtract(origin, p1, v1); + // VectorSubtract(origin, p3, v2); + // CrossProduct(v1, v2, normal[0]); + // VectorSubtract(origin, p3, v1); + // VectorSubtract(origin, p2, v2); + // CrossProduct(v1, v2, normal[1]); + // VectorSubtract(origin, p2, v1); + // VectorSubtract(origin, p1, v2); + // CrossProduct(v1, v2, normal[2]); + //} - for (i=0; i<3; i++) - { - VectorNormalize(normal[i]); - //Sys_Printf("direction: %f %f %f\n",dir[0],dir[1],dir[2]); - //Sys_Printf("normal: %f %f %f\n",normal[i][0],normal[i][1],normal[i][2]); - d = DotProduct(dir, normal[i]); - //Sys_Printf("dotproduct: %f\n",d); - if (d < 0) - return false; - } - return true; - } + for (i=0; i<3; i++) + { + VectorNormalize(normal[i]); + //Sys_Printf("direction: %f %f %f\n",dir[0],dir[1],dir[2]); + //Sys_Printf("normal: %f %f %f\n",normal[i][0],normal[i][1],normal[i][2]); + d = DotProduct(dir, normal[i]); + //Sys_Printf("dotproduct: %f\n",d); + if (d < 0) + return false; + } + return true; + } */ /* - extern int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, - float vert0[3], float vert1[3], float vert2[3], - double *t, double *u, double *v); + extern int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, + float vert0[3], float vert1[3], float vert2[3], + double *t, double *u, double *v); - bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, double *v) - { - bool bIntersect = false; - float tBest = FLT_MAX; - int i, j; - vec3_t xyz[3]; - vec3_t vRay[2]; + bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, double *v) + { + bool bIntersect = false; + float tBest = FLT_MAX; + int i, j; + vec3_t xyz[3]; + vec3_t vRay[2]; - float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set + float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set - VectorSubtract (origin, b->owner->origin, vRay[0]); - VectorCopy (dir, vRay[1]); + VectorSubtract (origin, b->owner->origin, vRay[0]); + VectorCopy (dir, vRay[1]); - if (angle > 0) - { - int i; - float s, c; - float x, y; + if (angle > 0) + { + int i; + float s, c; + float x, y; - s = sin (-angle/180*Q_PI); - c = cos (-angle/180*Q_PI); + s = sin (-angle/180*Q_PI); + c = cos (-angle/180*Q_PI); - for (i=0; i<2; i++) - { - x = vRay[i][0]; - y = vRay[i][1]; - vRay[i][0] = (x * c) - (y * s); - vRay[i][1] = (x * s) + (y * c); - } - } + for (i=0; i<2; i++) + { + x = vRay[i][0]; + y = vRay[i][1]; + vRay[i][0] = (x * c) - (y * s); + vRay[i][1] = (x * s) + (y * c); + } + } - entitymodel *model = b->owner->md3Class->model; + entitymodel *model = b->owner->md3Class->model; - while (model != NULL) - { - for (i = 0; i < model->nTriCount; i++) - { - for (j = 0; j < 3; j++) - VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]); + while (model != NULL) + { + for (i = 0; i < model->nTriCount; i++) + { + for (j = 0; j < 3; j++) + VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]); - if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v)) - { - bIntersect = true; - if (*t < tBest) - tBest = *t; - } - } - model = model->pNext; - } - if (bIntersect) - { - *t = tBest; - return true; - } - else - { - *t = 0; - return false; - } - } + if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v)) + { + bIntersect = true; + if (*t < tBest) + tBest = *t; + } + } + model = model->pNext; + } + if (bIntersect) + { + *t = tBest; + return true; + } + else + { + *t = 0; + return false; + } + } */ /* @@ -2224,7 +2224,7 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag && b->owner->model.pSelect && !( !IsBrushSelected( b ) && ( g_PrefsDlg.m_nEntityShowState & ENTITY_SELECTED_ONLY ) ) && g_PrefsDlg.m_nEntityShowState != ENTITY_BOX - && b->owner->model.pRender->IsModelNotNull()) { + && b->owner->model.pRender->IsModelNotNull() ) { ray_t ray_local; vec_t dist_local = FLT_MAX; ray_construct_for_vec3( &ray_local, origin, dir ); @@ -2261,8 +2261,7 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag for ( i = 0 ; i < 3 ; i++ ) p1[i] = p1[i] + frac * ( p2[i] - p1[i] ); } - else - { + else { for ( i = 0 ; i < 3 ; i++ ) p2[i] = p1[i] + frac * ( p2[i] - p1[i] ); } @@ -2368,23 +2367,23 @@ void Brush_RemoveFromList( brush_t *b ){ } /* - =============== - SetFaceTexdef + =============== + SetFaceTexdef - Doesn't set the curve flags + Doesn't set the curve flags - NOTE : ( TTimo ) - never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture - use Texture_ForName() to find the right shader - FIXME : send the right shader ( qtexture_t * ) in the parameters ? + NOTE : ( TTimo ) + never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture + use Texture_ForName() to find the right shader + FIXME : send the right shader ( qtexture_t * ) in the parameters ? - TTimo: surface plugin, added an IPluginTexdef* parameter - if not NULL, get ->Copy() of it into the face ( and remember to hook ) - if NULL, ask for a default + TTimo: surface plugin, added an IPluginTexdef* parameter + if not NULL, get ->Copy() of it into the face ( and remember to hook ) + if NULL, ask for a default - TTimo - shader code cleanup - added IShader* parameter - =============== + TTimo - shader code cleanup + added IShader* parameter + =============== */ void SetFaceTexdef2( brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef ) { int oldFlags; @@ -2436,20 +2435,20 @@ void SetFaceTexdef2( brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, } /* - =============== - SetFaceTexdef + =============== + SetFaceTexdef - Doesn't set the curve flags + Doesn't set the curve flags - NOTE : ( TTimo ) - never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture - use Texture_ForName() to find the right shader - FIXME : send the right shader ( qtexture_t * ) in the parameters ? + NOTE : ( TTimo ) + never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture + use Texture_ForName() to find the right shader + FIXME : send the right shader ( qtexture_t * ) in the parameters ? - TTimo: surface plugin, added an IPluginTexdef* parameter - if not NULL, get ->Copy() of it into the face ( and remember to hook ) - if NULL, ask for a default - =============== + TTimo: surface plugin, added an IPluginTexdef* parameter + if not NULL, get ->Copy() of it into the face ( and remember to hook ) + if NULL, ask for a default + =============== */ void SetFaceTexdef( face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef ) { int oldFlags; @@ -2642,8 +2641,9 @@ void Brush_SelectFaceForDragging( brush_t *b, face_t *f, qboolean shear ){ // leave it alone // if ( i != w->numpoints ) { - if ( i == 0 ) { // see if the first clockwise point was the - // last point on the winding + // see if the first clockwise point was the + // last point on the winding + if ( i == 0 ) { d = DotProduct( w->points[w->numpoints - 1] , f->plane.normal ) - f->plane.dist; if ( d > -ON_EPSILON && d < ON_EPSILON ) { @@ -2823,15 +2823,15 @@ void Brush_BuildWindings( brush_t *b, bool bSnap ){ if ( g_qeglobals.bNeedConvert ) { BrushPrimitFaceToFace( face ); /* - // we have parsed brush primitives and need conversion back to standard format - // NOTE: converting back is a quick hack, there's some information lost and we can't do anything about it - // FIXME: if we normalize the texture matrix to a standard 2x2 size, we end up with wrong scaling - // I tried various tweaks, no luck .. seems shifting is lost - brushprimit_texdef_t aux; - ConvertTexMatWithQTexture( &face->brushprimit_texdef, face->d_texture, &aux, NULL ); - TexMatToFakeTexCoords( aux.coords, face->texdef.shift, &face->texdef.rotate, face->texdef.scale ); - face->texdef.scale[0]/=2.0; - face->texdef.scale[1]/=2.0; + // we have parsed brush primitives and need conversion back to standard format + // NOTE: converting back is a quick hack, there's some information lost and we can't do anything about it + // FIXME: if we normalize the texture matrix to a standard 2x2 size, we end up with wrong scaling + // I tried various tweaks, no luck .. seems shifting is lost + brushprimit_texdef_t aux; + ConvertTexMatWithQTexture( &face->brushprimit_texdef, face->d_texture, &aux, NULL ); + TexMatToFakeTexCoords( aux.coords, face->texdef.shift, &face->texdef.rotate, face->texdef.scale ); + face->texdef.scale[0]/=2.0; + face->texdef.scale[1]/=2.0; */ } for ( i = 0 ; i < w->numpoints ; i++ ) @@ -3065,14 +3065,14 @@ void Brush_FaceDraw( face_t *face, int nGLState ){ qglNormal3fv( face->plane.normal ); } /* - if (mode & DRAW_GL_TEXTURE_2D) - qglTexCoordPointer(2, GL_FLOAT, 5, &w->points[3]); - qglVertexPointer(3, GL_FLOAT, 5, w->points); + if (mode & DRAW_GL_TEXTURE_2D) + qglTexCoordPointer(2, GL_FLOAT, 5, &w->points[3]); + qglVertexPointer(3, GL_FLOAT, 5, w->points); - if (mode & DRAW_GL_FILL) - qglDrawArrays(GL_TRIANGLE_FAN, 0, w->numpoints); - else - qglDrawArrays(GL_POLYGON, 0, w->numpoints); + if (mode & DRAW_GL_FILL) + qglDrawArrays(GL_TRIANGLE_FAN, 0, w->numpoints); + else + qglDrawArrays(GL_POLYGON, 0, w->numpoints); */ if ( nGLState & DRAW_GL_FILL ) { @@ -3792,46 +3792,44 @@ void aabb_draw( const aabb_t *aabb, int mode ){ qglEnd(); /* + vec3_t Coords[8]; + vec3_t vMin, vMax; + VectorSubtract(aabb->origin, aabb->extents, vMin); + VectorAdd(aabb->origin, aabb->extents, vMax); + VectorSet(Coords[0], vMin[0], vMax[1], vMax[2]); + VectorSet(Coords[1], vMax[0], vMax[1], vMax[2]); + VectorSet(Coords[2], vMax[0], vMin[1], vMax[2]); + VectorSet(Coords[3], vMin[0], vMin[1], vMax[2]); + VectorSet(Coords[4], vMin[0], vMax[1], vMin[2]); + VectorSet(Coords[5], vMax[0], vMax[1], vMin[2]); + VectorSet(Coords[6], vMax[0], vMin[1], vMin[2]); + VectorSet(Coords[7], vMin[0], vMin[1], vMin[2]); - vec3_t Coords[8]; + vec3_t Normals[8] = { {-1, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 1 }, + { 0, 0,-1 }, + { 0, 1, 0 }, + { 1, 0, 0 }, + { 0,-1, 0 } }; - vec3_t vMin, vMax; - VectorSubtract(aabb->origin, aabb->extents, vMin); - VectorAdd(aabb->origin, aabb->extents, vMax); - VectorSet(Coords[0], vMin[0], vMax[1], vMax[2]); - VectorSet(Coords[1], vMax[0], vMax[1], vMax[2]); - VectorSet(Coords[2], vMax[0], vMin[1], vMax[2]); - VectorSet(Coords[3], vMin[0], vMin[1], vMax[2]); - VectorSet(Coords[4], vMin[0], vMax[1], vMin[2]); - VectorSet(Coords[5], vMax[0], vMax[1], vMin[2]); - VectorSet(Coords[6], vMax[0], vMin[1], vMin[2]); - VectorSet(Coords[7], vMin[0], vMin[1], vMin[2]); + unsigned short Indices[24] = { 2, 1, 5, 6, + 1, 0, 4, 5, + 0, 1, 2, 3, + 3, 7, 4, 0, + 3, 2, 6, 7, + 7, 6, 5, 4 }; - vec3_t Normals[8] = { {-1, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 1 }, - { 0, 0,-1 }, - { 0, 1, 0 }, - { 1, 0, 0 }, - { 0,-1, 0 } }; + qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays + qglNormalPointer(GL_FLOAT, 0, Normals); - unsigned short Indices[24] = { 2, 1, 5, 6, - 1, 0, 4, 5, - 0, 1, 2, 3, - 3, 7, 4, 0, - 3, 2, 6, 7, - 7, 6, 5, 4 }; + //glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array - qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays - qglNormalPointer(GL_FLOAT, 0, Normals); + qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices); - //glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array - - qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices); - - //glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array + //glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array */ } diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 466fa612..dddb5875 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -932,9 +932,9 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ // Check model validity // If the model is NULL or invalid, draw a box instead - bool temp = b->owner->model.pRender->IsModelNotNull(); - if ( temp ) { - b->owner->model.pRender->Draw(nGLState, DRAW_RF_CAM); + bool isModelValid = b->owner->model.pRender->IsModelNotNull(); + if ( isModelValid ) { + b->owner->model.pRender->Draw( nGLState, DRAW_RF_CAM ); } else { qglColor4fv( material ); @@ -961,8 +961,8 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); } /* - if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) - DrawModelOrigin(b); + if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) + DrawModelOrigin(b); */ } } diff --git a/radiant/select.cpp b/radiant/select.cpp index de8ea82e..a13cb346 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -485,8 +485,8 @@ void Select_Deselect( bool bDeselectFaces ){ ============ */ /*! Moves the currently selected brush/patch - \param delta How far to move the selection (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the selection (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_Move( vec3_t delta, bool bSnap ){ brush_t *b; @@ -510,8 +510,8 @@ void Select_Move( vec3_t delta, bool bSnap ){ ================= */ /*! Moves the currently selected brush/patch vertices - \param delta How far to move the vertices (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the vertices (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_NudgePoint( vec3_t delta, qboolean bSnap ){ if ( g_qeglobals.d_select_mode == sel_vertex ) { @@ -562,11 +562,11 @@ void Select_Clone( void ){ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default TTimo - shader code cleanup added IShader* parameter ============ @@ -608,11 +608,11 @@ void WINAPI Select_SetTexture2( IShader* pShader, texdef_t *texdef, brushprimit_ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default ============ */ void WINAPI Select_SetTexture( texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef ){ @@ -1110,8 +1110,8 @@ void Select_RotateAxis( int axis, float deg, bool bPaint, bool bMouse ){ vec3_t rotation; VectorSet(rotation, 0, 0, 360 - deg); for(brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) - if(b->owner->model.pEdit) - b->owner->model.pEdit->Rotate(select_origin, rotation); + if(b->owner->model.pEdit) + b->owner->model.pEdit->Rotate(select_origin, rotation); } */ From 282f33d813e896b25f0465c916bdfa369f2da6dd Mon Sep 17 00:00:00 2001 From: Pan7 Date: Sun, 21 Aug 2016 21:35:42 +0200 Subject: [PATCH 03/21] Fix for potentially using uninitialized variable --- libs/picomodel/lwo/envelope.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/picomodel/lwo/envelope.c b/libs/picomodel/lwo/envelope.c index db7000ad..4510dade 100644 --- a/libs/picomodel/lwo/envelope.c +++ b/libs/picomodel/lwo/envelope.c @@ -75,6 +75,8 @@ lwEnvelope *lwGetEnvelope( picoMemStream_t *fp, int cksize ){ goto Fail; } + key = NULL; + /* process subchunks as they're encountered */ while ( 1 ) { From c346d43ae06f23084bbdb9bac943eca700ed141e Mon Sep 17 00:00:00 2001 From: Pan7 Date: Mon, 22 Aug 2016 08:48:01 +0200 Subject: [PATCH 04/21] Fix gcc warning i may be used uninitialized --- libs/picomodel/lwo/lwob.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/picomodel/lwo/lwob.c b/libs/picomodel/lwo/lwob.c index 57cc0c52..b98c81a1 100644 --- a/libs/picomodel/lwo/lwob.c +++ b/libs/picomodel/lwo/lwob.c @@ -382,16 +382,17 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){ case ID_TFLG: flags = getU2( fp ); + //only one of the three axis bits should be set if ( flags & 1 ) { - i = 0; + tex->axis = 0; } - if ( flags & 2 ) { - i = 1; + else if ( flags & 2 ) { + tex->axis = 1; } - if ( flags & 4 ) { - i = 2; + else if ( flags & 4 ) { + tex->axis = 2; } - tex->axis = i; + if ( tex->type == ID_IMAP ) { tex->param.imap.axis = i; } From d089ba94541eb7a22aef6d4fb4dca17a2adb9303 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Mon, 22 Aug 2016 10:41:34 +0200 Subject: [PATCH 05/21] Fix gcc warning shdr may be used uninitialized --- libs/picomodel/lwo/lwob.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/picomodel/lwo/lwob.c b/libs/picomodel/lwo/lwob.c index 57cc0c52..d59b8f07 100644 --- a/libs/picomodel/lwo/lwob.c +++ b/libs/picomodel/lwo/lwob.c @@ -244,6 +244,8 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){ goto Fail; } + shdr = NULL; + /* process subchunks as they're encountered */ while ( 1 ) { @@ -494,6 +496,9 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){ break; case ID_SDAT: + if ( !shdr ) { + goto Fail; + } shdr->data = getbytes( fp, sz ); break; From 5b342944e62d2cacdcfcec835e01f89ce60c5689 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Tue, 23 Aug 2016 13:49:43 +0200 Subject: [PATCH 06/21] Fix gcc warning item may be used uninitialized in this function --- radiant/mainframe.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 4fb3b198..211f2da4 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -7172,6 +7172,7 @@ void MainFrame::OnGridPrev(){ case 64: item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_grid_64" ) ); break; case 128: item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_grid_128" ) ); break; case 256: item = GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), "menu_grid_256" ) ); break; + default: return; } } From 3c9676f4286937985cb4ce277a5032331e314740 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Wed, 24 Aug 2016 11:28:08 +0200 Subject: [PATCH 07/21] m4_submat modification --- libs/mathlib/m4x4.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libs/mathlib/m4x4.c b/libs/mathlib/m4x4.c index 5dfdd10d..6f3e75ab 100644 --- a/libs/mathlib/m4x4.c +++ b/libs/mathlib/m4x4.c @@ -702,27 +702,31 @@ void m4_submat( m4x4_t mr, m3x3_t mb, int i, int j ){ idst = 0; for ( ti = 0; ti < 4; ti++ ) { + if ( ti == i ) { + continue; + } if ( ti < i ) { idst = ti; } else - if ( ti > i ) { + { idst = ti - 1; } for ( tj = 0; tj < 4; tj++ ) { + if ( tj == j ) { + continue; + } if ( tj < j ) { jdst = tj; } else - if ( tj > j ) { + { jdst = tj - 1; } - if ( ti != i && tj != j ) { - mb[idst * 3 + jdst] = mr[ti * 4 + tj ]; - } + mb[idst * 3 + jdst] = mr[ti * 4 + tj ]; } } } From 70b90a60c70adcf480ce6c67d5f591304f7e7139 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Thu, 25 Aug 2016 17:47:34 +0200 Subject: [PATCH 08/21] Fix gcc warning sizeof on array function parameter src will return size of float (*)[3] --- libs/splines/math_matrix.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/splines/math_matrix.h b/libs/splines/math_matrix.h index 41216ee0..a6dabb89 100644 --- a/libs/splines/math_matrix.h +++ b/libs/splines/math_matrix.h @@ -84,7 +84,11 @@ ID_INLINE mat3_t::mat3_t() { } ID_INLINE mat3_t::mat3_t( float src[ 3 ][ 3 ] ) { - memcpy( mat, src, sizeof( src ) ); + for( unsigned int i = 0; i < 3; i++ ) { + mat[i].x = src[i][0]; + mat[i].y = src[i][1]; + mat[i].z = src[i][2]; + } } ID_INLINE mat3_t::mat3_t( idVec3 const &x, idVec3 const &y, idVec3 const &z ) { From cdc2dbff32259155d417c8aa08b5e46a246e8021 Mon Sep 17 00:00:00 2001 From: Jay Dolan Date: Thu, 15 Sep 2016 16:27:55 -0400 Subject: [PATCH 09/21] More texture suffix checks for DarkPlaces effect texture names. --- radiant/texwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index ec20e357..4e459065 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -780,7 +780,11 @@ void Texture_ShowDirectory(){ g_str_has_suffix( name, "_h" ) || g_str_has_suffix( name, "_local" ) || g_str_has_suffix( name, "_nm" ) || - g_str_has_suffix( name, "_s" )) { + g_str_has_suffix( name, "_s" ) || + g_str_has_suffix( name, "_bump" ) || + g_str_has_suffix( name, "_gloss" ) || + g_str_has_suffix( name, "_luma" ) || + g_str_has_suffix( name, "_norm" ) ) { continue; } From 787c0cc3cbcbd2955398790b310b36a0aa412910 Mon Sep 17 00:00:00 2001 From: Christophe Mateos Date: Sun, 11 Dec 2016 03:07:28 +0100 Subject: [PATCH 10/21] Update .gitignore Added more exclusions, most of them Windows/Visual Studio related. --- .gitignore | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index afed6944..3dce9620 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,30 @@ -/apple/target/* -/build -/install/games -/install/installs -/install/q3data -/install/q3map2 -/install/q3map2_urt -/install/radiant.bin -/install/share -/packs -/site.sconf -/.sconsign.dblite -*.pyc -*.so .settings .DS_Store + +/apple/target/* +/build +/install +/packs +/tools/urt/tools/quake3/q3map2/Debug +/tools/urt/tools/quake3/q3map2/Release +/.sconsign.dblite +/.vs/radiant/v14/.suo +/radiant.opensdf +/radiant.sdf +/radiant.suo +/radiant.v11.suo +/radiant.v12.suo +/radiant.VC.db +/site.sconf + *.obj +*.pyc +*.so *.tlog +*.vcxproj.user +*.zip + + + + + From 2d08c0518c474c28ff409d1fd3e5344f16a80aa3 Mon Sep 17 00:00:00 2001 From: Christophe Mateos Date: Mon, 19 Dec 2016 23:45:54 +0100 Subject: [PATCH 11/21] PicoModel Backport: Fixed compilation. --- libs/picomodel.h | 1 + libs/picomodel/picomodel.vcxproj | 1 + libs/picomodel/picomodel.vcxproj.filters | 3 +++ libs/picomodel/pm_lwo.c | 4 ++-- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/picomodel.h b/libs/picomodel.h index f33c6da6..23cda9bd 100644 --- a/libs/picomodel.h +++ b/libs/picomodel.h @@ -267,6 +267,7 @@ void PicoSetSurfaceIndex( picoSurface_t *surface, int num void PicoSetSurfaceIndexes( picoSurface_t *surface, int num, picoIndex_t *index, int count ); void PicoSetFaceNormal( picoSurface_t *surface, int num, picoVec3_t normal ); void PicoSetSurfaceSpecial( picoSurface_t *surface, int num, int special ); +void PicoSetSurfaceSmoothingGroup( picoSurface_t *surface, int num, picoIndex_t smoothingGroup ); /* getter functions */ diff --git a/libs/picomodel/picomodel.vcxproj b/libs/picomodel/picomodel.vcxproj index f5c872a5..2faa101c 100644 --- a/libs/picomodel/picomodel.vcxproj +++ b/libs/picomodel/picomodel.vcxproj @@ -147,6 +147,7 @@ + diff --git a/libs/picomodel/picomodel.vcxproj.filters b/libs/picomodel/picomodel.vcxproj.filters index 2760cddb..d22ec524 100644 --- a/libs/picomodel/picomodel.vcxproj.filters +++ b/libs/picomodel/picomodel.vcxproj.filters @@ -77,5 +77,8 @@ src\lwo + + src + \ No newline at end of file diff --git a/libs/picomodel/pm_lwo.c b/libs/picomodel/pm_lwo.c index 5b4f2d60..dfb64c6e 100644 --- a/libs/picomodel/pm_lwo.c +++ b/libs/picomodel/pm_lwo.c @@ -285,8 +285,8 @@ static picoModel_t *_lwo_load( PM_PARAMS_LOAD ){ ///* doom3 lwo data doesn't seem to have smoothing-angle information */ //#if 0 -// if ( surface->smooth <= 0 ) { -// /* use face normals */ + if ( surface->smooth <= 0 ) { + /* use face normals */ normal[ 0 ] = v->norm[ 0 ]; normal[ 1 ] = v->norm[ 2 ]; normal[ 2 ] = v->norm[ 1 ]; From c483b791b09f213938cf655f5c7811096dab126c Mon Sep 17 00:00:00 2001 From: Christophe Mateos Date: Mon, 19 Dec 2016 23:53:11 +0100 Subject: [PATCH 12/21] Aligment. --- libs/picomodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/picomodel.h b/libs/picomodel.h index 23cda9bd..a1f2c5c6 100644 --- a/libs/picomodel.h +++ b/libs/picomodel.h @@ -267,7 +267,7 @@ void PicoSetSurfaceIndex( picoSurface_t *surface, int num void PicoSetSurfaceIndexes( picoSurface_t *surface, int num, picoIndex_t *index, int count ); void PicoSetFaceNormal( picoSurface_t *surface, int num, picoVec3_t normal ); void PicoSetSurfaceSpecial( picoSurface_t *surface, int num, int special ); -void PicoSetSurfaceSmoothingGroup( picoSurface_t *surface, int num, picoIndex_t smoothingGroup ); +void PicoSetSurfaceSmoothingGroup( picoSurface_t *surface, int num, picoIndex_t smoothingGroup ); /* getter functions */ From b529282159f1ed1f752279d5873e7f9a1615b354 Mon Sep 17 00:00:00 2001 From: Jay Dolan Date: Sat, 31 Dec 2016 15:44:18 -0500 Subject: [PATCH 13/21] Fix compilation on OS X. How is this working elsewhere? --- libs/picomodel/picointernal.h | 2 +- libs/picomodel/picomodel.vcproj | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/picomodel/picointernal.h b/libs/picomodel/picointernal.h index 8e9bba25..853809ee 100644 --- a/libs/picomodel/picointernal.h +++ b/libs/picomodel/picointernal.h @@ -132,7 +132,7 @@ void _pico_printf( int level, const char *format, ... ); char *_pico_stristr( char *str, const char *substr ); void _pico_unixify( char *path ); int _pico_nofname( const char *path, char *dest, int destSize ); -char *_pico_nopath( const char *path ); +const char *_pico_nopath( const char *path ); char *_pico_setfext( char *path, const char *ext ); int _pico_getline( char *buf, int bufsize, char *dest, int destsize ); char *_pico_strlwr( char *str ); diff --git a/libs/picomodel/picomodel.vcproj b/libs/picomodel/picomodel.vcproj index 1cfa803c..0ef3325f 100644 --- a/libs/picomodel/picomodel.vcproj +++ b/libs/picomodel/picomodel.vcproj @@ -192,6 +192,10 @@ RelativePath=".\pm_obj.c" > + + Date: Sat, 31 Dec 2016 15:55:29 -0500 Subject: [PATCH 14/21] This generates a different warning now, and is just wrong anyway. --- libs/picomodel/pm_terrain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/picomodel/pm_terrain.c b/libs/picomodel/pm_terrain.c index d0d54653..f5d16423 100644 --- a/libs/picomodel/pm_terrain.c +++ b/libs/picomodel/pm_terrain.c @@ -303,7 +303,7 @@ static int _terrain_canload( PM_PARAMS_CANLOAD ) { /* keep the friggin compiler happy */ - *fileName = *fileName; + /**fileName = *fileName*/; /* create pico parser */ p = _pico_new_parser( (picoByte_t*) buffer, bufSize ); @@ -356,7 +356,7 @@ static picoModel_t *_terrain_load( PM_PARAMS_LOAD ) { /* keep the friggin compiler happy */ - *fileName = *fileName; + /**fileName = *fileName*/; /* create pico parser */ p = _pico_new_parser( (picoByte_t*) buffer, bufSize ); From 5938d4e49f1832ba10d5aa0f8c6ba09dd98cddcd Mon Sep 17 00:00:00 2001 From: Jay Dolan Date: Sat, 31 Dec 2016 16:02:08 -0500 Subject: [PATCH 15/21] Fix a handful of compiler warnings. --- libs/picomodel/picointernal.c | 2 +- radiant/brush.cpp | 14 ++++++-------- tools/quake2/extra/bsp/qbsp3/map.c | 2 -- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/libs/picomodel/picointernal.c b/libs/picomodel/picointernal.c index c6f396ce..d9eeb656 100644 --- a/libs/picomodel/picointernal.c +++ b/libs/picomodel/picointernal.c @@ -272,7 +272,7 @@ void _pico_first_token( char *str ) { return; } while (*str && !isspace(*str)) - *str++; + str++; *str = '\0'; } diff --git a/radiant/brush.cpp b/radiant/brush.cpp index 2d07acad..cb98600d 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -26,7 +26,6 @@ #include "filters.h" extern MainFrame* g_pParentWnd; -extern void MemFile_fprintf( MemStream* pMemFile, const char* pText, ... ); // globals @@ -130,7 +129,6 @@ float lightaxis[3] = {0.6f, 0.8f, 1.0f}; improve recognition ================ */ -extern float ShadeForNormal( vec3_t normal ); float SetShadeForPlane( plane_t *p ){ //return ShadeForNormal(p->normal); @@ -2292,7 +2290,7 @@ face_t *Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag // see Brush_Draw // do some last minute filtering - if ( firstface && nFlags & SF_CAMERA ) { + if ( firstface && ( nFlags & SF_CAMERA ) ) { if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_CAULK ) { if ( strstr( firstface->texdef.GetName(), "caulk" ) ) { *dist = 0; @@ -3060,7 +3058,7 @@ void Brush_FaceDraw( face_t *face, int nGLState ){ if ( w == NULL ) { return; } - if ( nGLState & DRAW_GL_LIGHTING && g_PrefsDlg.m_bGLLighting ) { + if ( ( nGLState & DRAW_GL_LIGHTING ) && g_PrefsDlg.m_bGLLighting ) { qglNormal3fv( face->plane.normal ); } /* @@ -3137,7 +3135,7 @@ void Brush_Draw( brush_t *b ){ if ( bTrans && !( nGLState & DRAW_GL_BLEND ) ) { continue; } - if ( !bTrans && nGLState & DRAW_GL_BLEND ) { + if ( !bTrans && ( nGLState & DRAW_GL_BLEND ) ) { continue; } @@ -3163,17 +3161,17 @@ void Brush_Draw( brush_t *b ){ } } - if ( nGLState & DRAW_GL_TEXTURE_2D && face->d_texture->name[0] == '(' ) { + if ( ( nGLState & DRAW_GL_TEXTURE_2D ) && face->d_texture->name[0] == '(' ) { prev = NULL; qglDisable( GL_TEXTURE_2D ); } - else if ( nGLState & DRAW_GL_TEXTURE_2D && ( nDrawMode == cd_texture || nDrawMode == cd_light ) && face->d_texture != prev ) { + else if ( ( nGLState & DRAW_GL_TEXTURE_2D ) && ( nDrawMode == cd_texture || nDrawMode == cd_light ) && face->d_texture != prev ) { // set the texture for this face prev = face->d_texture; qglBindTexture( GL_TEXTURE_2D, face->d_texture->texture_number ); } - if ( nGLState & DRAW_GL_LIGHTING && !g_PrefsDlg.m_bGLLighting ) { + if ( ( nGLState & DRAW_GL_LIGHTING ) && !g_PrefsDlg.m_bGLLighting ) { if ( !b->owner->eclass->fixedsize ) { material[3] = transVal; } diff --git a/tools/quake2/extra/bsp/qbsp3/map.c b/tools/quake2/extra/bsp/qbsp3/map.c index 232979c7..2af52057 100644 --- a/tools/quake2/extra/bsp/qbsp3/map.c +++ b/tools/quake2/extra/bsp/qbsp3/map.c @@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "qbsp.h" -extern qboolean onlyents; - int nummapbrushes; mapbrush_t mapbrushes[MAX_MAP_BRUSHES]; From d7dafaea33da0f5760454ac8a507395f24f37596 Mon Sep 17 00:00:00 2001 From: TTimo Date: Sun, 1 Jan 2017 08:30:46 -0600 Subject: [PATCH 16/21] tweak previous pull with an assert --- libs/picomodel/lwo/lwob.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/picomodel/lwo/lwob.c b/libs/picomodel/lwo/lwob.c index d9786a86..a8bd25e5 100644 --- a/libs/picomodel/lwo/lwob.c +++ b/libs/picomodel/lwo/lwob.c @@ -8,6 +8,8 @@ Ernie Wright 17 Sep 00 ====================================================================== */ +#include + #include "../picointernal.h" #include "lwo2.h" @@ -391,7 +393,8 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){ else if ( flags & 2 ) { tex->axis = 1; } - else if ( flags & 4 ) { + else { + assert( flags & 4 ); tex->axis = 2; } From ec670ab48fe81abcc470c2073b252448e85d76fe Mon Sep 17 00:00:00 2001 From: TTimo Date: Sun, 1 Jan 2017 08:34:13 -0600 Subject: [PATCH 17/21] remove unused tex_palette --- radiant/texwindow.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 4e459065..87275870 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -50,7 +50,6 @@ #include "texmanip.h" #define TYP_MIPTEX 68 -static unsigned tex_palette[256]; #define FONT_HEIGHT 10 @@ -180,14 +179,6 @@ void Texture_InitPalette( byte *pal ){ g = gammatable[pal[1]]; b = gammatable[pal[2]]; pal += 3; - - //v = (r<<24) + (g<<16) + (b<<8) + 255; - //v = BigLong (v); - - //tex_palette[i] = v; - tex_palette[i * 3 + 0] = r; - tex_palette[i * 3 + 1] = g; - tex_palette[i * 3 + 2] = b; } } From 76a9631a1ae414b046271bb5c466986ec1b330f8 Mon Sep 17 00:00:00 2001 From: TTimo Date: Sun, 1 Jan 2017 09:07:33 -0600 Subject: [PATCH 18/21] read source file lists from .vcxproj files for SCons build --- SConscript.lib | 2 +- SConscript.module | 2 +- SConscript.q3data | 2 +- SConscript.q3map2 | 2 +- SConscript.q3map2.urt | 2 +- SConscript.radiant | 2 +- bspc | 2 +- config.py | 58 +++++++++++++++++++++---------------------- utils.py | 7 +++--- 9 files changed, 40 insertions(+), 39 deletions(-) diff --git a/SConscript.lib b/SConscript.lib index dd0988d7..0aaa81a4 100644 --- a/SConscript.lib +++ b/SConscript.lib @@ -12,7 +12,7 @@ libname = os.path.splitext( libname )[0] env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), project ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), project ) ) # some filtering. may need to improve that add_sources = [] diff --git a/SConscript.module b/SConscript.module index 9d4bdd6a..41885be8 100644 --- a/SConscript.module +++ b/SConscript.module @@ -18,7 +18,7 @@ useZ = True usePNG = True settings.SetupEnvironment( env, config['name'], useGtk = useGtk, useJPEG = useJPEG, useZ = useZ, usePNG = usePNG ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), project ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), project ) ) # some filtering. may need to improve that add_sources = [] diff --git a/SConscript.q3data b/SConscript.q3data index c89012f2..6a089323 100644 --- a/SConscript.q3data +++ b/SConscript.q3data @@ -11,7 +11,7 @@ env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) env.Prepend( CPPPATH = [ '#tools/quake3/common' ] ) env.Append( LIBS = [ 'm', 'pthread' ] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), 'tools/quake3/q3data/q3data.vcproj' ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'tools/quake3/q3data/q3data.vcxproj' ) ) objects = lib_objects objects += [ os.path.join( 'tools/quake3/q3data', i ) for i in proj.getSourceFiles() ] q3data = env.Program( 'q3data', objects ) diff --git a/SConscript.q3map2 b/SConscript.q3map2 index 2c981136..8229b8c9 100644 --- a/SConscript.q3map2 +++ b/SConscript.q3map2 @@ -11,7 +11,7 @@ env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) env.Prepend( CPPPATH = [ '#tools/quake3/common' ] ) env.Append( LIBS = [ 'm', 'pthread', 'png', 'jpeg' ] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), 'tools/quake3/q3map2/q3map2.vcproj' ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'tools/quake3/q3map2/q3map2.vcxproj' ) ) objects = lib_objects objects += [ os.path.join( 'tools/quake3/q3map2', i ) for i in proj.getSourceFiles() ] q3map2 = env.Program( 'q3map2', objects ) diff --git a/SConscript.q3map2.urt b/SConscript.q3map2.urt index c75f73ac..baf383dc 100644 --- a/SConscript.q3map2.urt +++ b/SConscript.q3map2.urt @@ -11,7 +11,7 @@ env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config['name'] ) env.Prepend( CPPPATH = [ '#tools/quake3/common', ] ) env.Append( LIBS = [ 'm', 'pthread', 'png', 'jpeg' ] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), 'tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj' ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'tools/urt/tools/quake3/q3map2/q3map2_urt.vcxproj' ) ) objects = lib_objects def keep_file( n ): diff --git a/SConscript.radiant b/SConscript.radiant index 114689aa..f3d85770 100644 --- a/SConscript.radiant +++ b/SConscript.radiant @@ -10,7 +10,7 @@ Import( [ 'utils', 'config', 'settings', 'lib_objects' ] ) env = Environment( ENV = os.environ ) settings.SetupEnvironment( env, config[ 'name' ], useGtk = True, useGtkGL = True ) env.Append( LIBS = [ 'dl' ] ) -proj = utils.vcproj( os.path.join( GetLaunchDir(), 'radiant/radiant.vcproj' ) ) +proj = utils.vcxproj( os.path.join( GetLaunchDir(), 'radiant/radiant.vcxproj' ) ) radiant = env.Program( 'radiant.bin', lib_objects + [ os.path.join( 'radiant', i ) for i in proj.getSourceFiles() ] ) diff --git a/bspc b/bspc index a1287590..2c840783 160000 --- a/bspc +++ b/bspc @@ -1 +1 @@ -Subproject commit a1287590f17c35a612f33708aeec5815402866b8 +Subproject commit 2c8407838398608cb9c52abae046987bb7a39c08 diff --git a/config.py b/config.py index 10d3ed7e..c91914a9 100644 --- a/config.py +++ b/config.py @@ -72,7 +72,7 @@ class Config: build_dir = os.path.join( 'build', config_name, 'radiant' ) VariantDir( build_dir, '.', duplicate = 0 ) lib_objects = [] - for project in [ 'libs/synapse/synapse.vcproj', 'libs/cmdlib/cmdlib.vcproj', 'libs/mathlib/mathlib.vcproj', 'libs/l_net/l_net.vcproj' ]: + for project in [ 'libs/synapse/synapse.vcxproj', 'libs/cmdlib/cmdlib.vcxproj', 'libs/mathlib/mathlib.vcxproj', 'libs/l_net/l_net.vcxproj' ]: Export( 'project' ) lib_objects += SConscript( os.path.join( build_dir, 'SConscript.lib' ) ) Export( 'lib_objects' ) @@ -81,7 +81,7 @@ class Config: # PIC versions of the libs for the modules shlib_objects_extra = {} - for project in [ 'libs/synapse/synapse.vcproj', 'libs/mathlib/mathlib.vcproj', 'libs/picomodel/picomodel.vcproj', 'libs/cmdlib/cmdlib.vcproj', 'libs/splines/splines.vcproj' ]: + for project in [ 'libs/synapse/synapse.vcxproj', 'libs/mathlib/mathlib.vcxproj', 'libs/picomodel/picomodel.vcxproj', 'libs/cmdlib/cmdlib.vcxproj', 'libs/splines/splines.vcxproj' ]: ( libpath, libname ) = os.path.split( project ) libname = os.path.splitext( libname )[0] config['shared'] = True @@ -90,31 +90,31 @@ class Config: VariantDir( build_dir, '.', duplicate = 0 ) shlib_objects_extra[libname] = SConscript( os.path.join( build_dir, 'SConscript.lib' ) ) - for project in [ 'plugins/vfsqlpk3/vfsqlpk3.vcproj', - 'plugins/vfspk3/vfspk3.vcproj', - 'plugins/vfspak/vfspak.vcproj', - 'plugins/vfswad/vfswad.vcproj', - 'plugins/eclassfgd/fgd.vcproj', - 'plugins/entity/entity.vcproj', - 'plugins/image/image.vcproj', - 'plugins/model/model.vcproj', - 'plugins/imagepng/imagepng.vcproj', - 'plugins/imagewal/imagewal.vcproj', - 'plugins/imagehl/imagehl.vcproj', - 'plugins/imagem8/imagem8.vcproj', - 'plugins/spritemodel/spritemodel.vcproj', - 'plugins/textool/textool.vcproj', - 'plugins/map/map.vcproj', - 'plugins/mapxml/mapxml.vcproj', - 'plugins/shaders/shaders.vcproj', - 'plugins/surface/surface.vcproj', - 'plugins/surface_idtech2/surface_idtech2.vcproj', - 'contrib/camera/camera.vcproj', - 'contrib/prtview/prtview.vcproj', - 'contrib/hydratoolz/hydratoolz.vcproj', - 'contrib/bobtoolz/bobtoolz.vcproj', - 'contrib/gtkgensurf/gtkgensurf.vcproj', - 'contrib/bkgrnd2d/bkgrnd2d.vcproj' + for project in [ 'plugins/vfsqlpk3/vfsqlpk3.vcxproj', + 'plugins/vfspk3/vfspk3.vcxproj', + 'plugins/vfspak/vfspak.vcxproj', + 'plugins/vfswad/vfswad.vcxproj', + 'plugins/eclassfgd/fgd.vcxproj', + 'plugins/entity/entity.vcxproj', + 'plugins/image/image.vcxproj', + 'plugins/model/model.vcxproj', + 'plugins/imagepng/imagepng.vcxproj', + 'plugins/imagewal/imagewal.vcxproj', + 'plugins/imagehl/imagehl.vcxproj', + 'plugins/imagem8/imagem8.vcxproj', + 'plugins/spritemodel/spritemodel.vcxproj', + 'plugins/textool/textool.vcxproj', + 'plugins/map/map.vcxproj', + 'plugins/mapxml/mapxml.vcxproj', + 'plugins/shaders/shaders.vcxproj', + 'plugins/surface/surface.vcxproj', + 'plugins/surface_idtech2/surface_idtech2.vcxproj', + 'contrib/camera/camera.vcxproj', + 'contrib/prtview/prtview.vcxproj', + 'contrib/hydratoolz/hydratoolz.vcxproj', + 'contrib/bobtoolz/bobtoolz.vcxproj', + 'contrib/gtkgensurf/gtkgensurf.vcxproj', + 'contrib/bkgrnd2d/bkgrnd2d.vcxproj' ]: ( libpath, libname ) = os.path.split( project ) libname = os.path.splitext( libname )[0] @@ -158,7 +158,7 @@ class Config: build_dir = os.path.join( 'build', config_name, compiler_name ) VariantDir( build_dir, '.', duplicate = 0 ) lib_objects = [] - for project in [ 'tools/quake3/common/quake3-common.vcproj', 'libs/mathlib/mathlib.vcproj', 'libs/l_net/l_net.vcproj', 'libs/ddslib/ddslib.vcproj', 'libs/picomodel/picomodel.vcproj', 'libs/md5lib/md5lib.vcproj' ]: + for project in [ 'tools/quake3/common/quake3-common.vcxproj', 'libs/mathlib/mathlib.vcxproj', 'libs/l_net/l_net.vcxproj', 'libs/ddslib/ddslib.vcxproj', 'libs/picomodel/picomodel.vcxproj', 'libs/md5lib/md5lib.vcxproj' ]: Export( 'project' ) lib_objects += SConscript( os.path.join( build_dir, 'SConscript.lib' ) ) Export( 'lib_objects' ) @@ -176,7 +176,7 @@ class Config: build_dir = os.path.join( 'build', config_name, 'q3data' ) VariantDir( build_dir, '.', duplicate = 0 ) lib_objects = [] - for project in [ 'libs/mathlib/mathlib.vcproj', 'libs/l_net/l_net.vcproj', 'libs/ddslib/ddslib.vcproj' ]: + for project in [ 'libs/mathlib/mathlib.vcxproj', 'libs/l_net/l_net.vcxproj', 'libs/ddslib/ddslib.vcxproj' ]: Export( 'project' ) lib_objects += SConscript( os.path.join( build_dir, 'SConscript.lib' ) ) Export( 'lib_objects' ) diff --git a/utils.py b/utils.py index ca70ceb9..9521672c 100644 --- a/utils.py +++ b/utils.py @@ -5,7 +5,7 @@ import os, commands, platform, xml.sax, re, string, platform -class vcproj( xml.sax.handler.ContentHandler ): +class vcxproj( xml.sax.handler.ContentHandler ): def __init__( self, filepath ): self.source_files = [] self.misc_files = [] @@ -29,8 +29,9 @@ class vcproj( xml.sax.handler.ContentHandler ): return ( match, nomatch ) def startElement( self, name, attrs ): - if ( name == 'File' ): - self._files.append( attrs.getValue('RelativePath') ) + if ( name == 'ClCompile' ): + if ( attrs.has_key('Include') ): + self._files.append( attrs.getValue('Include') ) def endDocument( self ): # split into source and headers, remap path seperator to the platform From a26c818a1ec54a733bc34fc97ff6739daec746bf Mon Sep 17 00:00:00 2001 From: TTimo Date: Sun, 1 Jan 2017 09:08:37 -0600 Subject: [PATCH 19/21] remove the old .vcproj --- contrib/bkgrnd2d/bkgrnd2d.vcproj | 195 --- contrib/bobtoolz/bobtoolz.vcproj | 292 ----- contrib/camera/camera.vcproj | 211 --- contrib/gtkgensurf/gtkgensurf.vcproj | 227 ---- contrib/hydratoolz/hydratoolz.vcproj | 187 --- contrib/prtview/prtview.vcproj | 207 --- libs/cmdlib/cmdlib.vcproj | 155 --- libs/ddslib/ddslib.vcproj | 153 --- libs/l_net/l_net.vcproj | 157 --- libs/mathlib/mathlib.vcproj | 165 --- libs/md5lib/md5lib.vcproj | 159 --- libs/picomodel/picomodel.vcproj | 248 ---- libs/splines/splines.vcproj | 183 --- libs/synapse/synapse.vcproj | 155 --- plugins/eclassfgd/fgd.vcproj | 187 --- plugins/entity/entity.vcproj | 207 --- plugins/image/image.vcproj | 199 --- plugins/imagehl/imagehl.vcproj | 191 --- plugins/imagem8/imagem8.vcproj | 195 --- plugins/imagepng/imagepng.vcproj | 187 --- plugins/imagewal/imagewal.vcproj | 191 --- plugins/map/map.vcproj | 195 --- plugins/mapxml/mapxml.vcproj | 195 --- plugins/model/model.vcproj | 203 --- plugins/shaders/shaders.vcproj | 191 --- plugins/spritemodel/spritemodel.vcproj | 191 --- plugins/surface/surface.vcproj | 191 --- .../surface_idtech2/surface_idtech2.vcproj | 195 --- plugins/textool/textool.vcproj | 199 --- plugins/vfspak/vfspak.vcproj | 191 --- plugins/vfspk3/vfspk3.vcproj | 195 --- plugins/vfsqlpk3/vfsqlpk3.vcproj | 200 --- plugins/vfswad/vfswad.vcproj | 195 --- radiant/radiant.vcproj | 402 ------ tools/quake3/common/quake3-common.vcproj | 191 --- tools/quake3/q3data/q3data.vcproj | 279 ---- tools/quake3/q3map2/q3map2.vcproj | 362 ------ .../urt/tools/quake3/q3map2/q3map2_urt.vcproj | 1155 ----------------- 38 files changed, 8781 deletions(-) delete mode 100644 contrib/bkgrnd2d/bkgrnd2d.vcproj delete mode 100644 contrib/bobtoolz/bobtoolz.vcproj delete mode 100644 contrib/camera/camera.vcproj delete mode 100644 contrib/gtkgensurf/gtkgensurf.vcproj delete mode 100644 contrib/hydratoolz/hydratoolz.vcproj delete mode 100644 contrib/prtview/prtview.vcproj delete mode 100644 libs/cmdlib/cmdlib.vcproj delete mode 100644 libs/ddslib/ddslib.vcproj delete mode 100644 libs/l_net/l_net.vcproj delete mode 100644 libs/mathlib/mathlib.vcproj delete mode 100644 libs/md5lib/md5lib.vcproj delete mode 100644 libs/picomodel/picomodel.vcproj delete mode 100644 libs/splines/splines.vcproj delete mode 100644 libs/synapse/synapse.vcproj delete mode 100644 plugins/eclassfgd/fgd.vcproj delete mode 100644 plugins/entity/entity.vcproj delete mode 100644 plugins/image/image.vcproj delete mode 100644 plugins/imagehl/imagehl.vcproj delete mode 100644 plugins/imagem8/imagem8.vcproj delete mode 100644 plugins/imagepng/imagepng.vcproj delete mode 100644 plugins/imagewal/imagewal.vcproj delete mode 100644 plugins/map/map.vcproj delete mode 100644 plugins/mapxml/mapxml.vcproj delete mode 100644 plugins/model/model.vcproj delete mode 100644 plugins/shaders/shaders.vcproj delete mode 100644 plugins/spritemodel/spritemodel.vcproj delete mode 100644 plugins/surface/surface.vcproj delete mode 100644 plugins/surface_idtech2/surface_idtech2.vcproj delete mode 100644 plugins/textool/textool.vcproj delete mode 100644 plugins/vfspak/vfspak.vcproj delete mode 100644 plugins/vfspk3/vfspk3.vcproj delete mode 100644 plugins/vfsqlpk3/vfsqlpk3.vcproj delete mode 100644 plugins/vfswad/vfswad.vcproj delete mode 100644 radiant/radiant.vcproj delete mode 100644 tools/quake3/common/quake3-common.vcproj delete mode 100644 tools/quake3/q3data/q3data.vcproj delete mode 100644 tools/quake3/q3map2/q3map2.vcproj delete mode 100644 tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj diff --git a/contrib/bkgrnd2d/bkgrnd2d.vcproj b/contrib/bkgrnd2d/bkgrnd2d.vcproj deleted file mode 100644 index cdaa3c9f..00000000 --- a/contrib/bkgrnd2d/bkgrnd2d.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/bobtoolz/bobtoolz.vcproj b/contrib/bobtoolz/bobtoolz.vcproj deleted file mode 100644 index c8b8609f..00000000 --- a/contrib/bobtoolz/bobtoolz.vcproj +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/camera/camera.vcproj b/contrib/camera/camera.vcproj deleted file mode 100644 index 4aa51dbd..00000000 --- a/contrib/camera/camera.vcproj +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/gtkgensurf/gtkgensurf.vcproj b/contrib/gtkgensurf/gtkgensurf.vcproj deleted file mode 100644 index 5782132c..00000000 --- a/contrib/gtkgensurf/gtkgensurf.vcproj +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/hydratoolz/hydratoolz.vcproj b/contrib/hydratoolz/hydratoolz.vcproj deleted file mode 100644 index 9e327ea2..00000000 --- a/contrib/hydratoolz/hydratoolz.vcproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/prtview/prtview.vcproj b/contrib/prtview/prtview.vcproj deleted file mode 100644 index 332ddd8f..00000000 --- a/contrib/prtview/prtview.vcproj +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/cmdlib/cmdlib.vcproj b/libs/cmdlib/cmdlib.vcproj deleted file mode 100644 index 94d4c253..00000000 --- a/libs/cmdlib/cmdlib.vcproj +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/ddslib/ddslib.vcproj b/libs/ddslib/ddslib.vcproj deleted file mode 100644 index b0b689c0..00000000 --- a/libs/ddslib/ddslib.vcproj +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/l_net/l_net.vcproj b/libs/l_net/l_net.vcproj deleted file mode 100644 index dd883685..00000000 --- a/libs/l_net/l_net.vcproj +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/mathlib/mathlib.vcproj b/libs/mathlib/mathlib.vcproj deleted file mode 100644 index 55ec5ee5..00000000 --- a/libs/mathlib/mathlib.vcproj +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/md5lib/md5lib.vcproj b/libs/md5lib/md5lib.vcproj deleted file mode 100644 index 8da037cb..00000000 --- a/libs/md5lib/md5lib.vcproj +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/picomodel/picomodel.vcproj b/libs/picomodel/picomodel.vcproj deleted file mode 100644 index 0ef3325f..00000000 --- a/libs/picomodel/picomodel.vcproj +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/splines/splines.vcproj b/libs/splines/splines.vcproj deleted file mode 100644 index 83cc0c3f..00000000 --- a/libs/splines/splines.vcproj +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/synapse/synapse.vcproj b/libs/synapse/synapse.vcproj deleted file mode 100644 index 95b4dbc2..00000000 --- a/libs/synapse/synapse.vcproj +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/eclassfgd/fgd.vcproj b/plugins/eclassfgd/fgd.vcproj deleted file mode 100644 index 9a42231c..00000000 --- a/plugins/eclassfgd/fgd.vcproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/entity/entity.vcproj b/plugins/entity/entity.vcproj deleted file mode 100644 index da817127..00000000 --- a/plugins/entity/entity.vcproj +++ /dev/null @@ -1,207 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/image/image.vcproj b/plugins/image/image.vcproj deleted file mode 100644 index f9cb3034..00000000 --- a/plugins/image/image.vcproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/imagehl/imagehl.vcproj b/plugins/imagehl/imagehl.vcproj deleted file mode 100644 index 53079916..00000000 --- a/plugins/imagehl/imagehl.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/imagem8/imagem8.vcproj b/plugins/imagem8/imagem8.vcproj deleted file mode 100644 index bbba695d..00000000 --- a/plugins/imagem8/imagem8.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/imagepng/imagepng.vcproj b/plugins/imagepng/imagepng.vcproj deleted file mode 100644 index a2a83e3b..00000000 --- a/plugins/imagepng/imagepng.vcproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/imagewal/imagewal.vcproj b/plugins/imagewal/imagewal.vcproj deleted file mode 100644 index 7cd92f5b..00000000 --- a/plugins/imagewal/imagewal.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/map/map.vcproj b/plugins/map/map.vcproj deleted file mode 100644 index c93a5d2d..00000000 --- a/plugins/map/map.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/mapxml/mapxml.vcproj b/plugins/mapxml/mapxml.vcproj deleted file mode 100644 index 978f16cb..00000000 --- a/plugins/mapxml/mapxml.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/model/model.vcproj b/plugins/model/model.vcproj deleted file mode 100644 index 8ed2f449..00000000 --- a/plugins/model/model.vcproj +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/shaders/shaders.vcproj b/plugins/shaders/shaders.vcproj deleted file mode 100644 index 7b55902d..00000000 --- a/plugins/shaders/shaders.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/spritemodel/spritemodel.vcproj b/plugins/spritemodel/spritemodel.vcproj deleted file mode 100644 index 1e18ddf3..00000000 --- a/plugins/spritemodel/spritemodel.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/surface/surface.vcproj b/plugins/surface/surface.vcproj deleted file mode 100644 index 9b775485..00000000 --- a/plugins/surface/surface.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/surface_idtech2/surface_idtech2.vcproj b/plugins/surface_idtech2/surface_idtech2.vcproj deleted file mode 100644 index f5d9e256..00000000 --- a/plugins/surface_idtech2/surface_idtech2.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/textool/textool.vcproj b/plugins/textool/textool.vcproj deleted file mode 100644 index 0c769bce..00000000 --- a/plugins/textool/textool.vcproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/vfspak/vfspak.vcproj b/plugins/vfspak/vfspak.vcproj deleted file mode 100644 index 51bc322b..00000000 --- a/plugins/vfspak/vfspak.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/vfspk3/vfspk3.vcproj b/plugins/vfspk3/vfspk3.vcproj deleted file mode 100644 index d8ccc438..00000000 --- a/plugins/vfspk3/vfspk3.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/vfsqlpk3/vfsqlpk3.vcproj b/plugins/vfsqlpk3/vfsqlpk3.vcproj deleted file mode 100644 index 152b6fed..00000000 --- a/plugins/vfsqlpk3/vfsqlpk3.vcproj +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/vfswad/vfswad.vcproj b/plugins/vfswad/vfswad.vcproj deleted file mode 100644 index e10730c6..00000000 --- a/plugins/vfswad/vfswad.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/radiant/radiant.vcproj b/radiant/radiant.vcproj deleted file mode 100644 index 81af2a28..00000000 --- a/radiant/radiant.vcproj +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/quake3/common/quake3-common.vcproj b/tools/quake3/common/quake3-common.vcproj deleted file mode 100644 index f6179cef..00000000 --- a/tools/quake3/common/quake3-common.vcproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/quake3/q3data/q3data.vcproj b/tools/quake3/q3data/q3data.vcproj deleted file mode 100644 index f09923a2..00000000 --- a/tools/quake3/q3data/q3data.vcproj +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/quake3/q3map2/q3map2.vcproj b/tools/quake3/q3map2/q3map2.vcproj deleted file mode 100644 index b71a4459..00000000 --- a/tools/quake3/q3map2/q3map2.vcproj +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj b/tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj deleted file mode 100644 index 3cdd42cf..00000000 --- a/tools/urt/tools/quake3/q3map2/q3map2_urt.vcproj +++ /dev/null @@ -1,1155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From c03075a737f65b6a29c9fad30747bb78752e636b Mon Sep 17 00:00:00 2001 From: Christophe Mateos Date: Fri, 5 May 2017 10:17:10 +0200 Subject: [PATCH 20/21] Rollback on alignments. --- radiant/brush.cpp | 438 +++++++++++++++++++++++----------------------- 1 file changed, 220 insertions(+), 218 deletions(-) diff --git a/radiant/brush.cpp b/radiant/brush.cpp index adab6acf..9ce1220a 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -73,18 +73,18 @@ void PrintVector( vec3_t v ){ /* - ============================================================================= + ============================================================================= - TEXTURE COORDINATES + TEXTURE COORDINATES - ============================================================================= + ============================================================================= */ /* - ================== - textureAxisFromPlane - ================== + ================== + textureAxisFromPlane + ================== */ vec3_t baseaxis[18] = { @@ -107,7 +107,7 @@ void TextureAxisFromPlane( plane_t *pln, vec3_t xv, vec3_t yv ) { for ( i = 0 ; i < 6 ; i++ ) { dot = DotProduct( pln->normal, baseaxis[i * 3] ); - // see q3map2 source - added () for clarity + // see q3map2 source - added () for clarity if ( ( g_PrefsDlg.m_bQ3Map2Texturing && dot > best + 0.0001f ) || dot > best ) { best = dot; bestaxis = i; @@ -602,18 +602,18 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz // find the STfromXYZ 4-vectors /* - SARRUS-SOLVE: - xyzst1[3] == xyzst1[sv] * STfromXYZ[0][sv] + xyzst1[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - xyzst2[3] == xyzst2[sv] * STfromXYZ[0][sv] + xyzst2[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - xyzst3[3] == xyzst3[sv] * STfromXYZ[0][sv] + xyzst3[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; - FOR: STfromXYZ[0] - GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) - SARRUS-SOLVE: - xyzst1[4] == xyzst1[sv] * STfromXYZ[1][sv] + xyzst1[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - xyzst2[4] == xyzst2[sv] * STfromXYZ[1][sv] + xyzst2[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - xyzst3[4] == xyzst3[sv] * STfromXYZ[1][sv] + xyzst3[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; - FOR: STfromXYZ[1] - GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) + SARRUS-SOLVE: + xyzst1[3] == xyzst1[sv] * STfromXYZ[0][sv] + xyzst1[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + xyzst2[3] == xyzst2[sv] * STfromXYZ[0][sv] + xyzst2[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + xyzst3[3] == xyzst3[sv] * STfromXYZ[0][sv] + xyzst3[tv] * STfromXYZ[0][tv] + STfromXYZ[0][3]; + FOR: STfromXYZ[0] + GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) + SARRUS-SOLVE: + xyzst1[4] == xyzst1[sv] * STfromXYZ[1][sv] + xyzst1[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + xyzst2[4] == xyzst2[sv] * STfromXYZ[1][sv] + xyzst2[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + xyzst3[4] == xyzst3[sv] * STfromXYZ[1][sv] + xyzst3[tv] * STfromXYZ[1][tv] + STfromXYZ[1][3]; + FOR: STfromXYZ[1] + GIVEN: one coord of them (uv) is empty (see Face_TextureVectors) */ STfromXYZ[0][uv] = 0; @@ -645,8 +645,8 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz float newSTfromXYZ[2][4]; printf("old: %Lf,%Lf,%Lf,%Lf %Lf,%Lf,%Lf,%Lf\n", - STfromXYZ[0][0], STfromXYZ[0][1], STfromXYZ[0][2], STfromXYZ[0][3], - STfromXYZ[1][0], STfromXYZ[1][1], STfromXYZ[1][2], STfromXYZ[1][3]); + STfromXYZ[0][0], STfromXYZ[0][1], STfromXYZ[0][2], STfromXYZ[0][3], + STfromXYZ[1][0], STfromXYZ[1][1], STfromXYZ[1][2], STfromXYZ[1][3]); */ Face_TexdefFromTextureVectors( f, STfromXYZ, pvecs, sv, tv ); @@ -655,8 +655,8 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz Face_TextureVectors(f, newSTfromXYZ); printf("new: %f,%f,%f,%f %f,%f,%f,%f\n", - newSTfromXYZ[0][0], newSTfromXYZ[0][1], newSTfromXYZ[0][2], newSTfromXYZ[0][3], - newSTfromXYZ[1][0], newSTfromXYZ[1][1], newSTfromXYZ[1][2], newSTfromXYZ[1][3]); + newSTfromXYZ[0][0], newSTfromXYZ[0][1], newSTfromXYZ[0][2], newSTfromXYZ[0][3], + newSTfromXYZ[1][0], newSTfromXYZ[1][1], newSTfromXYZ[1][2], newSTfromXYZ[1][3]); float newxyzst1[5]; float newxyzst2[5]; @@ -668,12 +668,12 @@ void Face_TexdefFromTextureCoordinates( float *xyzst1, float *xyzst2, float *xyz EmitTextureCoordinates (newxyzst2, q, f); EmitTextureCoordinates (newxyzst3, q, f); printf("Face_TexdefFromTextureCoordinates: %f,%f %f,%f %f,%f -> %f,%f %f,%f %f,%f\n", - xyzst1[3], xyzst1[4], - xyzst2[3], xyzst2[4], - xyzst3[3], xyzst3[4], - newxyzst1[3], newxyzst1[4], - newxyzst2[3], newxyzst2[4], - newxyzst3[3], newxyzst3[4]); + xyzst1[3], xyzst1[4], + xyzst2[3], xyzst2[4], + xyzst3[3], xyzst3[4], + newxyzst1[3], newxyzst1[4], + newxyzst2[3], newxyzst2[4], + newxyzst3[3], newxyzst3[4]); // TODO why do these differ, but not the previous ones? this makes no sense whatsoever */ } @@ -1038,16 +1038,16 @@ face_t *Brush_BestSplitFace( brush_t *b ){ } /* - ================= - Brush_MakeConvexBrushes + ================= + Brush_MakeConvexBrushes - MrE FIXME: this doesn't work because the old - Brush_SplitBrushByFace is used - Turns the brush into a minimal number of convex brushes. - If the input brush is convex then it will be returned. - Otherwise the input brush will be freed. - NOTE: the input brush should have windings for the faces. - ================= + MrE FIXME: this doesn't work because the old + Brush_SplitBrushByFace is used + Turns the brush into a minimal number of convex brushes. + If the input brush is convex then it will be returned. + Otherwise the input brush will be freed. + NOTE: the input brush should have windings for the faces. + ================= */ brush_t *Brush_MakeConvexBrushes( brush_t *b ){ brush_t *front, *back, *end; @@ -2076,130 +2076,130 @@ brush_t *Brush_FullClone( brush_t *b ){ // FIXME - spog - finish this later.. /* - bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) - { - int i; - vec3_t v1, v2, normal[3]; - float d; + bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3) + { + int i; + vec3_t v1, v2, normal[3]; + float d; - //Sys_Printf("p1: %f %f %f\n",p1[0],p1[1],p1[2]); - //Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]); - //Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]); - //Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]); + //Sys_Printf("p1: %f %f %f\n",p1[0],p1[1],p1[2]); + //Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]); + //Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]); + //Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]); - // test ray against triangle - // get triangle plane normal - //VectorSubtract(p1, p2, v1); - //VectorSubtract(p1, p3, v2); - //CrossProduct(v1, v2, v1); - // check normal against direction - //if (DotProduct(dir, v1) >= 0) - //{ - // generate cone normals - VectorSubtract(origin, p1, v1); - VectorSubtract(origin, p2, v2); - CrossProduct(v1, v2, normal[0]); - VectorSubtract(origin, p2, v1); - VectorSubtract(origin, p3, v2); - CrossProduct(v1, v2, normal[1]); - VectorSubtract(origin, p3, v1); - VectorSubtract(origin, p1, v2); - CrossProduct(v1, v2, normal[2]); - //} - //else - //{ - // flip normals if triangle faces away - // Sys_Printf("flipped\n"); - // VectorSubtract(origin, p1, v1); - // VectorSubtract(origin, p3, v2); - // CrossProduct(v1, v2, normal[0]); - // VectorSubtract(origin, p3, v1); - // VectorSubtract(origin, p2, v2); - // CrossProduct(v1, v2, normal[1]); - // VectorSubtract(origin, p2, v1); - // VectorSubtract(origin, p1, v2); - // CrossProduct(v1, v2, normal[2]); - //} + // test ray against triangle + // get triangle plane normal + //VectorSubtract(p1, p2, v1); + //VectorSubtract(p1, p3, v2); + //CrossProduct(v1, v2, v1); + // check normal against direction + //if (DotProduct(dir, v1) >= 0) + //{ + // generate cone normals + VectorSubtract(origin, p1, v1); + VectorSubtract(origin, p2, v2); + CrossProduct(v1, v2, normal[0]); + VectorSubtract(origin, p2, v1); + VectorSubtract(origin, p3, v2); + CrossProduct(v1, v2, normal[1]); + VectorSubtract(origin, p3, v1); + VectorSubtract(origin, p1, v2); + CrossProduct(v1, v2, normal[2]); + //} + //else + //{ + // flip normals if triangle faces away + // Sys_Printf("flipped\n"); + // VectorSubtract(origin, p1, v1); + // VectorSubtract(origin, p3, v2); + // CrossProduct(v1, v2, normal[0]); + // VectorSubtract(origin, p3, v1); + // VectorSubtract(origin, p2, v2); + // CrossProduct(v1, v2, normal[1]); + // VectorSubtract(origin, p2, v1); + // VectorSubtract(origin, p1, v2); + // CrossProduct(v1, v2, normal[2]); + //} - for (i=0; i<3; i++) - { - VectorNormalize(normal[i]); - //Sys_Printf("direction: %f %f %f\n",dir[0],dir[1],dir[2]); - //Sys_Printf("normal: %f %f %f\n",normal[i][0],normal[i][1],normal[i][2]); - d = DotProduct(dir, normal[i]); - //Sys_Printf("dotproduct: %f\n",d); - if (d < 0) - return false; - } - return true; - } + for (i=0; i<3; i++) + { + VectorNormalize(normal[i]); + //Sys_Printf("direction: %f %f %f\n",dir[0],dir[1],dir[2]); + //Sys_Printf("normal: %f %f %f\n",normal[i][0],normal[i][1],normal[i][2]); + d = DotProduct(dir, normal[i]); + //Sys_Printf("dotproduct: %f\n",d); + if (d < 0) + return false; + } + return true; + } */ /* - extern int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, - float vert0[3], float vert1[3], float vert2[3], - double *t, double *u, double *v); + extern int Triangle_Ray(float orig[3], float dir[3], bool bCullBack, + float vert0[3], float vert1[3], float vert2[3], + double *t, double *u, double *v); - bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, double *v) - { - bool bIntersect = false; - float tBest = FLT_MAX; - int i, j; - vec3_t xyz[3]; - vec3_t vRay[2]; + bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, double *v) + { + bool bIntersect = false; + float tBest = FLT_MAX; + int i, j; + vec3_t xyz[3]; + vec3_t vRay[2]; - float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set + float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set - VectorSubtract (origin, b->owner->origin, vRay[0]); - VectorCopy (dir, vRay[1]); + VectorSubtract (origin, b->owner->origin, vRay[0]); + VectorCopy (dir, vRay[1]); - if (angle > 0) - { - int i; - float s, c; - float x, y; + if (angle > 0) + { + int i; + float s, c; + float x, y; - s = sin (-angle/180*Q_PI); - c = cos (-angle/180*Q_PI); + s = sin (-angle/180*Q_PI); + c = cos (-angle/180*Q_PI); - for (i=0; i<2; i++) - { - x = vRay[i][0]; - y = vRay[i][1]; - vRay[i][0] = (x * c) - (y * s); - vRay[i][1] = (x * s) + (y * c); - } - } + for (i=0; i<2; i++) + { + x = vRay[i][0]; + y = vRay[i][1]; + vRay[i][0] = (x * c) - (y * s); + vRay[i][1] = (x * s) + (y * c); + } + } - entitymodel *model = b->owner->md3Class->model; + entitymodel *model = b->owner->md3Class->model; - while (model != NULL) - { - for (i = 0; i < model->nTriCount; i++) - { - for (j = 0; j < 3; j++) - VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]); + while (model != NULL) + { + for (i = 0; i < model->nTriCount; i++) + { + for (j = 0; j < 3; j++) + VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]); - if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v)) - { - bIntersect = true; - if (*t < tBest) - tBest = *t; - } - } - model = model->pNext; - } - if (bIntersect) - { - *t = tBest; - return true; - } - else - { - *t = 0; - return false; - } - } + if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v)) + { + bIntersect = true; + if (*t < tBest) + tBest = *t; + } + } + model = model->pNext; + } + if (bIntersect) + { + *t = tBest; + return true; + } + else + { + *t = 0; + return false; + } + } */ /* @@ -2365,23 +2365,23 @@ void Brush_RemoveFromList( brush_t *b ){ } /* - =============== - SetFaceTexdef + =============== + SetFaceTexdef - Doesn't set the curve flags + Doesn't set the curve flags - NOTE : ( TTimo ) - never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture - use Texture_ForName() to find the right shader - FIXME : send the right shader ( qtexture_t * ) in the parameters ? + NOTE : ( TTimo ) + never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture + use Texture_ForName() to find the right shader + FIXME : send the right shader ( qtexture_t * ) in the parameters ? - TTimo: surface plugin, added an IPluginTexdef* parameter - if not NULL, get ->Copy() of it into the face ( and remember to hook ) - if NULL, ask for a default + TTimo: surface plugin, added an IPluginTexdef* parameter + if not NULL, get ->Copy() of it into the face ( and remember to hook ) + if NULL, ask for a default - TTimo - shader code cleanup - added IShader* parameter - =============== + TTimo - shader code cleanup + added IShader* parameter + =============== */ void SetFaceTexdef2( brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef ) { int oldFlags; @@ -2433,20 +2433,20 @@ void SetFaceTexdef2( brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef, } /* - =============== - SetFaceTexdef + =============== + SetFaceTexdef - Doesn't set the curve flags + Doesn't set the curve flags - NOTE : ( TTimo ) - never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture - use Texture_ForName() to find the right shader - FIXME : send the right shader ( qtexture_t * ) in the parameters ? + NOTE : ( TTimo ) + never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture + use Texture_ForName() to find the right shader + FIXME : send the right shader ( qtexture_t * ) in the parameters ? - TTimo: surface plugin, added an IPluginTexdef* parameter - if not NULL, get ->Copy() of it into the face ( and remember to hook ) - if NULL, ask for a default - =============== + TTimo: surface plugin, added an IPluginTexdef* parameter + if not NULL, get ->Copy() of it into the face ( and remember to hook ) + if NULL, ask for a default + =============== */ void SetFaceTexdef( face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef ) { int oldFlags; @@ -2821,15 +2821,15 @@ void Brush_BuildWindings( brush_t *b, bool bSnap ){ if ( g_qeglobals.bNeedConvert ) { BrushPrimitFaceToFace( face ); /* - // we have parsed brush primitives and need conversion back to standard format - // NOTE: converting back is a quick hack, there's some information lost and we can't do anything about it - // FIXME: if we normalize the texture matrix to a standard 2x2 size, we end up with wrong scaling - // I tried various tweaks, no luck .. seems shifting is lost - brushprimit_texdef_t aux; - ConvertTexMatWithQTexture( &face->brushprimit_texdef, face->d_texture, &aux, NULL ); - TexMatToFakeTexCoords( aux.coords, face->texdef.shift, &face->texdef.rotate, face->texdef.scale ); - face->texdef.scale[0]/=2.0; - face->texdef.scale[1]/=2.0; + // we have parsed brush primitives and need conversion back to standard format + // NOTE: converting back is a quick hack, there's some information lost and we can't do anything about it + // FIXME: if we normalize the texture matrix to a standard 2x2 size, we end up with wrong scaling + // I tried various tweaks, no luck .. seems shifting is lost + brushprimit_texdef_t aux; + ConvertTexMatWithQTexture( &face->brushprimit_texdef, face->d_texture, &aux, NULL ); + TexMatToFakeTexCoords( aux.coords, face->texdef.shift, &face->texdef.rotate, face->texdef.scale ); + face->texdef.scale[0]/=2.0; + face->texdef.scale[1]/=2.0; */ } for ( i = 0 ; i < w->numpoints ; i++ ) @@ -3063,14 +3063,14 @@ void Brush_FaceDraw( face_t *face, int nGLState ){ qglNormal3fv( face->plane.normal ); } /* - if (mode & DRAW_GL_TEXTURE_2D) - qglTexCoordPointer(2, GL_FLOAT, 5, &w->points[3]); - qglVertexPointer(3, GL_FLOAT, 5, w->points); + if (mode & DRAW_GL_TEXTURE_2D) + qglTexCoordPointer(2, GL_FLOAT, 5, &w->points[3]); + qglVertexPointer(3, GL_FLOAT, 5, w->points); - if (mode & DRAW_GL_FILL) - qglDrawArrays(GL_TRIANGLE_FAN, 0, w->numpoints); - else - qglDrawArrays(GL_POLYGON, 0, w->numpoints); + if (mode & DRAW_GL_FILL) + qglDrawArrays(GL_TRIANGLE_FAN, 0, w->numpoints); + else + qglDrawArrays(GL_POLYGON, 0, w->numpoints); */ if ( nGLState & DRAW_GL_FILL ) { @@ -3790,44 +3790,46 @@ void aabb_draw( const aabb_t *aabb, int mode ){ qglEnd(); /* - vec3_t Coords[8]; - vec3_t vMin, vMax; - VectorSubtract(aabb->origin, aabb->extents, vMin); - VectorAdd(aabb->origin, aabb->extents, vMax); - VectorSet(Coords[0], vMin[0], vMax[1], vMax[2]); - VectorSet(Coords[1], vMax[0], vMax[1], vMax[2]); - VectorSet(Coords[2], vMax[0], vMin[1], vMax[2]); - VectorSet(Coords[3], vMin[0], vMin[1], vMax[2]); - VectorSet(Coords[4], vMin[0], vMax[1], vMin[2]); - VectorSet(Coords[5], vMax[0], vMax[1], vMin[2]); - VectorSet(Coords[6], vMax[0], vMin[1], vMin[2]); - VectorSet(Coords[7], vMin[0], vMin[1], vMin[2]); - vec3_t Normals[8] = { {-1, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 1 }, - { 0, 0,-1 }, - { 0, 1, 0 }, - { 1, 0, 0 }, - { 0,-1, 0 } }; + vec3_t Coords[8]; - unsigned short Indices[24] = { 2, 1, 5, 6, - 1, 0, 4, 5, - 0, 1, 2, 3, - 3, 7, 4, 0, - 3, 2, 6, 7, - 7, 6, 5, 4 }; + vec3_t vMin, vMax; + VectorSubtract(aabb->origin, aabb->extents, vMin); + VectorAdd(aabb->origin, aabb->extents, vMax); + VectorSet(Coords[0], vMin[0], vMax[1], vMax[2]); + VectorSet(Coords[1], vMax[0], vMax[1], vMax[2]); + VectorSet(Coords[2], vMax[0], vMin[1], vMax[2]); + VectorSet(Coords[3], vMin[0], vMin[1], vMax[2]); + VectorSet(Coords[4], vMin[0], vMax[1], vMin[2]); + VectorSet(Coords[5], vMax[0], vMax[1], vMin[2]); + VectorSet(Coords[6], vMax[0], vMin[1], vMin[2]); + VectorSet(Coords[7], vMin[0], vMin[1], vMin[2]); - qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays - qglNormalPointer(GL_FLOAT, 0, Normals); + vec3_t Normals[8] = { {-1, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 0 }, + { 0, 0, 1 }, + { 0, 0,-1 }, + { 0, 1, 0 }, + { 1, 0, 0 }, + { 0,-1, 0 } }; - //glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array + unsigned short Indices[24] = { 2, 1, 5, 6, + 1, 0, 4, 5, + 0, 1, 2, 3, + 3, 7, 4, 0, + 3, 2, 6, 7, + 7, 6, 5, 4 }; - qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices); + qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays + qglNormalPointer(GL_FLOAT, 0, Normals); - //glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array + //glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array + + qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices); + + //glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array */ } From 877f0b4c2f392a4dbc8fede785efbcd7cee3e12e Mon Sep 17 00:00:00 2001 From: Christophe Mateos Date: Fri, 5 May 2017 10:40:38 +0200 Subject: [PATCH 21/21] Finalizing alignments rollback. --- radiant/camwindow.cpp | 4 ++-- radiant/select.cpp | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 5419913f..6cf28584 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -961,8 +961,8 @@ void CamWnd::Cam_DrawBrush( brush_t *b, int mode ){ aabb_draw( b->owner->model.pRender->GetAABB(), DRAW_GL_WIRE ); } /* - if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) - DrawModelOrigin(b); + if(!(nModelMode & ENTITY_BOXED) && b->owner->eclass->nShowFlags & ECLASS_MISCMODEL) + DrawModelOrigin(b); */ } } diff --git a/radiant/select.cpp b/radiant/select.cpp index 768a717c..b0584136 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -485,8 +485,8 @@ void Select_Deselect( bool bDeselectFaces ){ ============ */ /*! Moves the currently selected brush/patch - \param delta How far to move the selection (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the selection (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_Move( vec3_t delta, bool bSnap ){ brush_t *b; @@ -510,8 +510,8 @@ void Select_Move( vec3_t delta, bool bSnap ){ ================= */ /*! Moves the currently selected brush/patch vertices - \param delta How far to move the vertices (x,y,z) - \param bSnap If the move should snap to grid points + \param delta How far to move the vertices (x,y,z) + \param bSnap If the move should snap to grid points */ void Select_NudgePoint( vec3_t delta, qboolean bSnap ){ if ( g_qeglobals.d_select_mode == sel_vertex ) { @@ -562,11 +562,11 @@ void Select_Clone( void ){ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default TTimo - shader code cleanup added IShader* parameter ============ @@ -608,11 +608,11 @@ void WINAPI Select_SetTexture2( IShader* pShader, texdef_t *texdef, brushprimit_ Select_SetTexture Timo : bFitScale to compute scale on the plane and counteract plane / axial plane snapping Timo : brush primitive texturing - the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) + the brushprimit_texdef given must be understood as a qtexture_t width=2 height=2 ( HiRes ) Timo : texture plugin, added an IPluginTexdef* parameter - must be casted to an IPluginTexdef! - if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) - if NULL, means we have no information, ask for a default + must be casted to an IPluginTexdef! + if not NULL, get ->Copy() of it into each face or brush ( and remember to hook ) + if NULL, means we have no information, ask for a default ============ */ void WINAPI Select_SetTexture( texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, void* pPlugTexdef ){ @@ -1110,8 +1110,8 @@ void Select_RotateAxis( int axis, float deg, bool bPaint, bool bMouse ){ vec3_t rotation; VectorSet(rotation, 0, 0, 360 - deg); for(brush_t *b = selected_brushes.next; b != &selected_brushes; b = b->next) - if(b->owner->model.pEdit) - b->owner->model.pEdit->Rotate(select_origin, rotation); + if(b->owner->model.pEdit) + b->owner->model.pEdit->Rotate(select_origin, rotation); } */