fprintf( f, "\t*PROP_RECVSHADOW\t1\r\n" );
if(lightmapsAsTexcoord)
{
- if(ds->lightmapNum[0] >= 0 && ds->lightmapNum[0] + deluxemap < numLightmapsASE)
+ if(ds->lightmapNum[0] >= 0 && ds->lightmapNum[0] + (int)deluxemap < numLightmapsASE)
fprintf( f, "\t*MATERIAL_REF\t%d\r\n", ds->lightmapNum[0] + deluxemap );
else
Sys_Printf( "WARNING: lightmap %d out of range, not exporting\n", ds->lightmapNum[0] + deluxemap );
side_t *buildSide;
bspShader_t *shader;
char *texture;
- bspPlane_t *plane;
plane_t *buildPlane;
vec3_t pts[ 3 ];
bspDrawVert_t *vert[3];
- int valid;
/* start brush */
//if( !Q_stricmp( shader->shader, "default" ) || !Q_stricmp( shader->shader, "noshader" ) )
// continue;
- /* get plane */
- plane = &bspPlanes[ side->planeNum ];
-
/* add build side */
buildSide = &buildBrush->sides[ buildBrush->numsides ];
buildBrush->numsides++;
// - (triangles)
// - find the triangle that has most in common with our side
GetBestSurfaceTriangleMatchForBrushside(buildSide, vert);
- valid = 0;
/* get texture name */
if( !Q_strncasecmp( buildSide->shaderInfo->shader, "textures/", 9 ) )
);
VectorSet(buildSide->texMat[i], D0 / D, D1 / D, D2 / D);
}
- valid = 1;
}
else
fprintf(stderr, "degenerate triangle found when solving texMat equations for\n(%f %f %f) (%f %f %f) (%f %f %f)\n( %f %f %f )\n( %f %f %f ) -> ( %f %f )\n( %f %f %f ) -> ( %f %f )\n( %f %f %f ) -> ( %f %f )\n",
buildSide->texMat[0][0], buildSide->texMat[0][1], FRAC(buildSide->texMat[0][2]),
buildSide->texMat[1][0], buildSide->texMat[1][1], FRAC(buildSide->texMat[1][2]),
texture,
- // DEBUG: valid ? 0 : C_DETAIL
0
);
}
);
VectorSet(sts[i], D0 / D, D1 / D, D2 / D);
}
- valid = 1;
}
else
fprintf(stderr, "degenerate triangle found when solving texDef equations\n"); // FIXME add stuff here
pts[ 2 ][ 0 ], pts[ 2 ][ 1 ], pts[ 2 ][ 2 ],
texture,
shift[0], shift[1], rotate, scale[0], scale[1],
- // DEBUG: valid ? 0 : C_DETAIL
0
);
}
1.0f/16.0f, 0.0f, 0.0f,
0.0f, 1.0f/16.0f, 0.0f,
texture,
- // DEBUG: valid ? 0 : C_DETAIL
0
);
}
pts[ 2 ][ 0 ], pts[ 2 ][ 1 ], pts[ 2 ][ 2 ],
texture,
0.0f, 0.0f, 0.0f, 0.25f, 0.25f,
- // DEBUG: valid ? 0 : C_DETAIL
0
);
}
int objLastShaderNum = -1;
static void ConvertSurfaceToOBJ( FILE *f, bspModel_t *model, int modelNum, bspDrawSurface_t *ds, int surfaceNum, vec3_t origin )
{
- int i, v, face, a, b, c;
+ int i, v, a, b, c;
bspDrawVert_t *dv;
/* ignore patches for now */
fprintf(f, "usemtl lm_%04d\r\n", ds->lightmapNum[0] + deluxemap);
objLastShaderNum = ds->lightmapNum[0] + deluxemap;
}
- if(ds->lightmapNum[0] + deluxemap < firstLightmap)
+ if(ds->lightmapNum[0] + (int)deluxemap < firstLightmap)
{
Sys_Printf( "WARNING: lightmap %d out of range (exporting anyway)\n", ds->lightmapNum[0] + deluxemap );
firstLightmap = ds->lightmapNum[0] + deluxemap;
/* export faces */
for( i = 0; i < ds->numIndexes; i += 3 )
{
- face = (i / 3);
a = bspDrawIndexes[ i + ds->firstIndex ];
c = bspDrawIndexes[ i + ds->firstIndex + 1 ];
b = bspDrawIndexes[ i + ds->firstIndex + 2 ];
static void ConvertShaderToMTL( FILE *f, bspShader_t *shader, int shaderNum )
{
shaderInfo_t *si;
- char *c, filename[ 1024 ];
+ char filename[ 1024 ];
/* get shader */
{
int i, j, k, v;
bspDrawSurface_t *ds;
- surfaceInfo_t *info;
float *radVertexLuxel;
radWinding_t rw;
/* get surface */
ds = &bspDrawSurfaces[ num ];
- info = &surfaceInfos[ num ];
/* each triangle is a potential emitter */
rw.numVerts = 3;
vec3_t deluxel[ 3 ];
vec3_t origin[ 4 ], normal[ 4 ];
float biasDirs[ 4 ][ 2 ] = { { -1.0f, -1.0f }, { 1.0f, -1.0f }, { -1.0f, 1.0f }, { 1.0f, 1.0f } };
- vec3_t color, direction, total;
+ vec3_t color, direction = { 0, 0, 0 }, total;
/* limit check */
qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm )
{
bspDrawSurface_t *ds, *ds2;
- surfaceInfo_t *info, *info2;
+ surfaceInfo_t *info;
int num2, n, i, axisNum;
float s, t, d, len, sampleSize;
- vec3_t mins, maxs, origin, faxis, size, exactSize, delta, normalized, vecs[ 2 ];
+ vec3_t mins, maxs, origin, faxis, size, delta, normalized, vecs[ 2 ];
vec4_t plane;
bspDrawVert_t *verts;
/* round to the lightmap resolution */
for( i = 0; i < 3; i++ )
{
- exactSize[ i ] = lm->maxs[ i ] - lm->mins[ i ];
mins[ i ] = sampleSize * floor( lm->mins[ i ] / sampleSize );
maxs[ i ] = sampleSize * ceil( lm->maxs[ i ] / sampleSize );
size[ i ] = (maxs[ i ] - mins[ i ]) / sampleSize + 1.0f;
/* get surface */
num2 = lightSurfaces[ lm->firstLightSurface + n ];
ds2 = &bspDrawSurfaces[ num2 ];
- info2 = &surfaceInfos[ num2 ];
verts = &yDrawVerts[ ds2->firstVert ];
/* set the lightmap texture coordinates in yDrawVerts in [0, superSample * lm->customWidth] space */
/* get first drawsurface */
num2 = lightSurfaces[ lm->firstLightSurface ];
ds2 = &bspDrawSurfaces[ num2 ];
- info2 = &surfaceInfos[ num2 ];
verts = &yDrawVerts[ ds2->firstVert ];
/* calculate lightmap origin */
int i, j, k, s,num, num2;
bspModel_t *model;
bspLeaf_t *leaf;
- bspDrawSurface_t *ds, *ds2;
+ bspDrawSurface_t *ds;
surfaceInfo_t *info, *info2;
rawLightmap_t *lm;
qboolean added;
{
/* get info and attempt early out */
num2 = sortSurfaces[ j ];
- ds2 = &bspDrawSurfaces[ num2 ];
info2 = &surfaceInfos[ num2 ];
if( info2->hasLightmap == qfalse || info2->lm != NULL )
continue;
numStitched, numCandidates, numLuxels, f, fOld, start;
rawLightmap_t *lm, *a, *b, *c[ MAX_STITCH_CANDIDATES ];
float *luxel, *luxel2, *origin, *origin2, *normal, *normal2,
- sampleSize, average[ 3 ], totalColor, ootc, *luxels[ MAX_STITCH_LUXELS ];
+ sampleSize, average[ 3 ], totalColor, ootc;
/* disabled for now */
/* add luxel */
//% VectorSet( luxel2, 255, 0, 255 );
- luxels[ numLuxels++ ] = luxel2;
VectorAdd( average, luxel2, average );
totalColor += luxel2[ 3 ];
}
#define LIGHTMAP_RESERVE_COUNT 1
static void FindOutLightmaps( rawLightmap_t *lm )
{
- int i, j, k, lightmapNum, xMax, yMax, x, y, sx, sy, ox, oy, offset;
+ int i, j, k, lightmapNum, xMax, yMax, x = -1, y = -1, sx, sy, ox, oy, offset;
outLightmap_t *olm;
surfaceInfo_t *info;
float *luxel, *deluxel;
lump = (byte*) header + offset;
lumpInt = LittleLong( (int) *((int*) lump) );
lumpFloat = LittleFloat( (float) *((float*) lump) );
- memcpy( lumpString, (char*) lump, (length < sizeof(lumpString) ? length : sizeof(lumpString)-1) );
+ memcpy( lumpString, (char*) lump, ((size_t)length < sizeof(lumpString) ? (size_t)length : sizeof(lumpString)-1) );
lumpString[ sizeof(lumpString)-1 ] = '\0';
/* print basic lump info */
int i, j, k;
edgeLine_t *e;
edgePoint_t *p;
- int originalVerts;
int counts[MAX_SURFACE_VERTS];
int originals[MAX_SURFACE_VERTS];
- int firstVert[MAX_SURFACE_VERTS];
bspDrawVert_t verts[MAX_SURFACE_VERTS], *v1, *v2;
int numVerts;
float start, end, frac, c;
vec3_t delta;
- originalVerts = ds->numVerts;
-
numVerts = 0;
for ( i = 0 ; i < ds->numVerts ; i++ )
{
counts[i] = 0;
- firstVert[i] = numVerts;
// copy first vert
if ( numVerts == MAX_SURFACE_VERTS ) {