]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/surface_meta.c
q3map2: dds/ prefix, print log at the right time, when image is found
[xonotic/netradiant.git] / tools / quake3 / q3map2 / surface_meta.c
index f3afa1a6caf036b4dc759b596a4f58d77fc1715e..2cd6f0374e8b2aea6189facca07a1dcaf7ae7e7b 100644 (file)
@@ -341,6 +341,7 @@ void TriangulatePatchSurface( entity_t *e, mapDrawSurface_t *ds ){
        if ( ds->numVerts == 0 || ds->type != SURFACE_PATCH || ( patchMeta == qfalse && !forcePatchMeta ) ) {
                return;
        }
+
        /* make a mesh from the drawsurf */
        src.width = ds->patchWidth;
        src.height = ds->patchHeight;
@@ -419,6 +420,8 @@ void TriangulatePatchSurface( entity_t *e, mapDrawSurface_t *ds ){
        ClassifySurfaces( 1, ds );
 }
 
+
+
 #define TINY_AREA 1.0f
 #define MAXAREA_MAXTRIES 8
 int MaxAreaIndexes( bspDrawVert_t *vert, int cnt, int *indexes ){
@@ -589,6 +592,8 @@ int MaxAreaIndexes( bspDrawVert_t *vert, int cnt, int *indexes ){
        return -1;
 }
 
+
+
 /*
    MaxAreaFaceSurface() - divVerent
    creates a triangle list using max area indexes
@@ -631,6 +636,7 @@ void MaxAreaFaceSurface( mapDrawSurface_t *ds ){
 }
 
 
+
 /*
    FanFaceSurface() - ydnar
    creates a tri-fan from a brush face winding
@@ -650,6 +656,7 @@ void FanFaceSurface( mapDrawSurface_t *ds ){
 
        /* add a new vertex at the beginning of the surface */
        verts = safe_malloc( ( ds->numVerts + 1 ) * sizeof( bspDrawVert_t ) );
+       /* beware to only zero the new vertexi at the beginning, nor more! */
        memset( verts, 0, sizeof( bspDrawVert_t ) );
        memcpy( &verts[ 1 ], ds->verts, ds->numVerts * sizeof( bspDrawVert_t ) );
        free( ds->verts );
@@ -835,6 +842,7 @@ void StripFaceSurface( mapDrawSurface_t *ds ){
 }
 
 
+
 /*
    EmitMetaStatictics
    vortex: prints meta statistics in general output
@@ -851,6 +859,8 @@ void EmitMetaStats(){
        Sys_Printf( "%9d meta triangles\n", numMetaTriangles );
 }
 
+
+
 /*
    MakeEntityMetaTriangles()
    builds meta triangles from brush faces (tristrips and fans)
@@ -1192,13 +1202,11 @@ void SmoothMetaTriangles( void ){
        Sys_FPrintf( SYS_VRB, "--- SmoothMetaTriangles ---\n" );
 
        /* allocate shade angle table */
-       shadeAngles = safe_malloc( numMetaVerts * sizeof( float ) );
-       memset( shadeAngles, 0, numMetaVerts * sizeof( float ) );
+       shadeAngles = safe_malloc0( numMetaVerts * sizeof( float ) );
 
        /* allocate smoothed table */
        cs = ( numMetaVerts / 8 ) + 1;
-       smoothed = safe_malloc( cs );
-       memset( smoothed, 0, cs );
+       smoothed = safe_malloc0( cs );
 
        /* set default shade angle */
        defaultShadeAngle = DEG2RAD( npDegrees );
@@ -1468,8 +1476,6 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri,
                }
        }
 
-
-
        if ( metaMaxBBoxDistance >= 0 ) {
                if ( ds->numIndexes > 0 ) {
                        VectorCopy( ds->mins, mins );
@@ -1594,7 +1600,7 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri,
                         ( bi == ds->indexes[ i ] && ci == ds->indexes[ i + 2 ] && ai == ds->indexes[ i + 1 ] ) ||
                         ( ci == ds->indexes[ i ] && ai == ds->indexes[ i + 2 ] && bi == ds->indexes[ i + 1 ] ) ) {
                        /* warn about it */
-                       Sys_Printf( "WARNING: Flipped triangle: (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f)\n",
+                       Sys_FPrintf( SYS_WRN, "WARNING: Flipped triangle: (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f)\n",
                                                ds->verts[ ai ].xyz[ 0 ], ds->verts[ ai ].xyz[ 1 ], ds->verts[ ai ].xyz[ 2 ],
                                                ds->verts[ bi ].xyz[ 0 ], ds->verts[ bi ].xyz[ 1 ], ds->verts[ bi ].xyz[ 2 ],
                                                ds->verts[ ci ].xyz[ 0 ], ds->verts[ ci ].xyz[ 1 ], ds->verts[ ci ].xyz[ 2 ] );