[Quake2world-dev] r636 - quake2world/trunk/src/tools/q2wmap
jdolan at jdolan.dyndns.org
jdolan at jdolan.dyndns.org
Sat Oct 3 13:14:45 UTC 2009
Author: jdolan
Date: 2009-10-03 13:14:44 +0000 (Sat, 03 Oct 2009)
New Revision: 636
Modified:
quake2world/trunk/src/tools/q2wmap/faces.c
quake2world/trunk/src/tools/q2wmap/lightmap.c
quake2world/trunk/src/tools/q2wmap/textures.c
Log:
Minor cleanups in q2wmap.
Modified: quake2world/trunk/src/tools/q2wmap/faces.c
===================================================================
--- quake2world/trunk/src/tools/q2wmap/faces.c 2009-10-03 10:39:16 UTC (rev 635)
+++ quake2world/trunk/src/tools/q2wmap/faces.c 2009-10-03 13:14:44 UTC (rev 636)
@@ -73,6 +73,10 @@
static int vertexchain[MAX_BSP_VERTS]; // the next vertex in a hash chain
static int hashverts[HASH_SIZE * HASH_SIZE]; // a vertex number, or 0 for no verts
+
+/*
+ * HashVec
+ */
static unsigned HashVec(const vec3_t vec){
const int x = (4096 + (int)(vec[0] + 0.5)) >> 7;
const int y = (4096 + (int)(vec[1] + 0.5)) >> 7;
@@ -397,6 +401,7 @@
FaceFromSuperverts(node, f, base);
}
+
/*
* FixEdges_r
*/
@@ -414,6 +419,7 @@
FixEdges_r(node->children[i]);
}
+
/*
* FixTjuncs
*/
@@ -442,11 +448,11 @@
Verbose("%5i bad start verts\n", c_badstartverts);
}
+
/*
- * GetEdge
+ * GetEdge2
*
- * Called by writebsp.
- * Don't allow four way edges
+ * Called by writebsp. Don't allow four way edges
*/
int GetEdge2(int v1, int v2, face_t * f){
dedge_t *edge;
@@ -478,12 +484,14 @@
return numedges - 1;
}
+
/*
*
* FACE MERGING
*
*/
+
#define CONTINUOUS_EPSILON 0.001
/*
@@ -578,6 +586,7 @@
return newf;
}
+
/*
* TryMerge
*
@@ -615,6 +624,7 @@
return newf;
}
+
/*
* MergeNodeFaces
*/
@@ -716,6 +726,10 @@
}
}
+
+/*
+ * SubdivideNodeFaces
+ */
static void SubdivideNodeFaces(node_t * node){
face_t *f;
Modified: quake2world/trunk/src/tools/q2wmap/lightmap.c
===================================================================
--- quake2world/trunk/src/tools/q2wmap/lightmap.c 2009-10-03 10:39:16 UTC (rev 635)
+++ quake2world/trunk/src/tools/q2wmap/lightmap.c 2009-10-03 13:14:44 UTC (rev 636)
@@ -759,7 +759,7 @@
float *center;
float *sdir, *tdir, scale;
vec3_t pos;
- vec3_t normal, binormal;
+ vec3_t normal, bitangent;
vec4_t tangent;
lightinfo_t l[MAX_SAMPLES];
facelight_t *fl;
@@ -857,10 +857,10 @@
VectorNormalize(direction);
// transform it into tangent space
- TangentVectors(normal, sdir, tdir, tangent, binormal);
+ TangentVectors(normal, sdir, tdir, tangent, bitangent);
dir[0] = DotProduct(direction, tangent);
- dir[1] = DotProduct(direction, binormal);
+ dir[1] = DotProduct(direction, bitangent);
dir[2] = DotProduct(direction, normal);
VectorCopy(dir, direction);
Modified: quake2world/trunk/src/tools/q2wmap/textures.c
===================================================================
--- quake2world/trunk/src/tools/q2wmap/textures.c 2009-10-03 10:39:16 UTC (rev 635)
+++ quake2world/trunk/src/tools/q2wmap/textures.c 2009-10-03 13:14:44 UTC (rev 636)
@@ -29,29 +29,30 @@
{0, 0, 1}
, {1, 0, 0}
, {0, -1, 0}
- , // floor
+ , // floor
{0, 0, -1}
, {1, 0, 0}
, {0, -1, 0}
- , // ceiling
+ , // ceiling
{1, 0, 0}
, {0, 1, 0}
, {0, 0, -1}
- , // west wall
+ , // west wall
{-1, 0, 0}
, {0, 1, 0}
, {0, 0, -1}
- , // east wall
+ , // east wall
{0, 1, 0}
, {1, 0, 0}
, {0, 0, -1}
- , // south wall
+ , // south wall
{0, -1, 0}
, {1, 0, 0}
- , {0, 0, -1} // north wall
+ , {0, 0, -1}
+ , // north wall
};
-static void TextureAxisFromPlane(plane_t * pln, vec3_t xv, vec3_t yv){
+static void TextureAxisFromPlane(plane_t *pln, vec3_t xv, vec3_t yv){
int bestaxis;
vec_t dot, best;
int i;
@@ -96,25 +97,25 @@
shift[1] = DotProduct(origin, vecs[1]);
if(!bt->scale[0])
- bt->scale[0] = 1;
+ bt->scale[0] = 1.0;
if(!bt->scale[1])
- bt->scale[1] = 1;
+ bt->scale[1] = 1.0;
// rotate axis
- if(bt->rotate == 0){
- sinv = 0;
- cosv = 1;
- } else if(bt->rotate == 90){
- sinv = 1;
- cosv = 0;
- } else if(bt->rotate == 180){
- sinv = 0;
- cosv = -1;
- } else if(bt->rotate == 270){
- sinv = -1;
- cosv = 0;
+ if(bt->rotate == 0.0){
+ sinv = 0.0;
+ cosv = 1.0;
+ } else if(bt->rotate == 90.0){
+ sinv = 1.0;
+ cosv = 0.0;
+ } else if(bt->rotate == 180.0){
+ sinv = 0.0;
+ cosv = -1.0;
+ } else if(bt->rotate == 270.0){
+ sinv = -1.0;
+ cosv = 0.0;
} else {
- ang = bt->rotate / 180 * M_PI;
+ ang = bt->rotate / 180.0 * M_PI;
sinv = sin(ang);
cosv = cos(ang);
}
More information about the Quake2World-dev
mailing list