|
Data Structures |
| struct | lFacet_s |
| struct | lightvolume_s |
| struct | lleaf_s |
| struct | lportal_t |
| struct | lsurfaceTest_s |
| struct | plane_t |
| struct | vsound_s |
| struct | winding_t |
Defines |
| #define | DIST_EPSILON 0.02 |
| #define | LAAT_DOUBLEQUADRATIC 2 |
| #define | LAAT_NORMAL 0 |
| #define | LAAT_QUADRATIC 1 |
| #define | LDAT_LINEAR 1 |
| #define | LDAT_NOSCALE 2 |
| #define | LDAT_QUADRATIC 0 |
| #define | LIGHT_POINTFAKESURFACE 3 |
| #define | LIGHT_POINTRADIAL 1 |
| #define | LIGHT_POINTSPOT 2 |
| #define | LIGHT_SURFACEDIRECTED 4 |
| #define | LIGHT_SURFACERADIAL 5 |
| #define | LIGHT_SURFACESPOT 6 |
| #define | LIGHTMAP_PIXELSHIFT 0.5 |
| #define | LIGHTMAP_SIZE 128 |
| #define | MAX_CLUSTERS 16384 |
| #define | MAX_FACETS 65536 |
| #define | MAX_LIGHTS 16384 |
| #define | MAX_POINTS_ON_FIXED_WINDING 48 |
| #define | MAX_POINTS_ON_WINDING 64 |
| #define | MAX_PORTALS 32768 |
| #define | MAX_PORTALS_ON_LEAF 128 |
| #define | MAX_TRANSLUCENTFACETS 32 |
| #define | NORMAL_EPSILON 0.0001 |
| #define | ON_EPSILON 0.1 |
| #define | PLANAR_EPSILON 0.1 |
| #define | PORTALFILE "PRT1" |
| #define | VectorSet(v, x, y, z) v[0] = x;v[1] = y;v[2] = z; |
| #define | VOLUME_DIRECTED 1 |
| #define | VOLUME_NORMAL 0 |
Typedefs |
| typedef lFacet_s | lFacet_t |
| typedef lightvolume_s | lightvolume_t |
| typedef lleaf_s | lleaf_t |
| typedef lsurfaceTest_s | lsurfaceTest_t |
| typedef vsound_s | vsound_t |
Functions |
| winding_t * | AllocWinding (int points) |
| winding_t * | BaseWindingForPlane (vec3_t normal, vec_t dist) |
| void | ClipWindingEpsilon (winding_t *in, vec3_t normal, vec_t dist, vec_t epsilon, winding_t **front, winding_t **back) |
| void | ColorToBytes (const float *color, byte *colorBytes) |
| void | CountLightmaps (void) |
| entity_t * | FindTargetEntity (const char *target) |
| void | FreeWinding (winding_t *w) |
| void | GridAndVertexLighting (void) |
| int | Plane_Equal (plane_t *a, plane_t *b, int flip) |
| int | PointInLeafnum (vec3_t point) |
| float | PointToPolygonFormFactor (const vec3_t point, const vec3_t normal, const winding_t *w) |
| winding_t * | ReverseWinding (winding_t *w) |
| void | SetEntityOrigins (void) |
| void | TraceLtm (int num) |
| winding_t * | VS_AllocWinding (int points) |
| void | VS_CalcVisibleLightmapPixelArea (void) |
| int | VS_ChopWinding (winding_t *in, plane_t *split, float epsilon) |
| int | VS_ChopWindingWithBrush (winding_t *w, dbrush_t *brush, winding_t *outwindings, int maxout) |
| float | VS_ChopWindingWithFacet (winding_t *w, lFacet_t *facet) |
| void | VS_CreateEntitySpeakers (void) |
| void | VS_CreateFakeSurfaceLights (void) |
| void | VS_CreateSkyLights (void) |
| void | VS_DoForcedTraceLight (int num) |
| void | VS_DoForcedTraceLightSurfaces (void) |
| void | VS_FacetsForPatch (dsurface_t *dsurf, int surfaceNum, shaderInfo_t *si, lsurfaceTest_t *test) |
| void | VS_FacetsForTriangleSurface (dsurface_t *dsurf, shaderInfo_t *si, lsurfaceTest_t *test) |
| int | VS_FindAdjacentSurface (int surfaceNum, int facetNum, vec3_t p1, vec3_t p2, int *sNum, int *fNum, int *point) |
| void | VS_FixLightmapEdges (void) |
| void | VS_FloodAreaSpotLight (vsound_t *light, winding_t *w, int leafnum) |
| void | VS_FloodDirectedLight (vsound_t *light, winding_t *w, int leafnum) |
| void | VS_FloodLight (vsound_t *light) |
| void | VS_FloodLightThread (int num) |
| void | VS_FloodRadialAreaLight (vsound_t *light, winding_t *w, int leafnum) |
| void | VS_GenerateBoundaryForPoints (plane_t *boundary, plane_t *plane, vec3_t a, vec3_t b) |
| qboolean | VS_GenerateFacetFor3Points (dsurface_t *dsurf, shaderInfo_t *si, lFacet_t *f, drawVert_t *a, drawVert_t *b, drawVert_t *c) |
| qboolean | VS_GenerateFacetFor4Points (dsurface_t *dsurf, shaderInfo_t *si, lFacet_t *f, drawVert_t *a, drawVert_t *b, drawVert_t *c, drawVert_t *d) |
| void | VS_GetFilter (vsound_t *light, lightvolume_t *volume, vec3_t lmp, vec3_t filter) |
| void | VS_InitSurfacesForTesting (void) |
| int | VS_LightLeafnum (vec3_t point) |
| void | VS_LightmapMatrixFromPoints (dsurface_t *dsurf, shaderInfo_t *si, lFacet_t *f, drawVert_t *a, drawVert_t *b, drawVert_t *c) |
| void | VS_LightSurfaceWithVolume (int surfaceNum, int facetNum, vsound_t *light, lightvolume_t *volume) |
| void | VS_LightWorld (void) |
| void | VS_LinkSurfaceIntoCluster (int cluster, int surfaceNum) |
| void | VS_LinkSurfaces (void) |
| void | VS_LoadPortals (char *name) |
| void | VS_PlaneForEdgeToWinding (vec3_t p1, vec3_t p2, winding_t *w, int windingonfront, plane_t *plane) |
| qboolean | VS_PlaneFromPoints (plane_t *plane, const vec3_t a, const vec3_t b, const vec3_t c) |
| void | VS_PlaneFromWinding (winding_t *w, plane_t *plane) |
| int | VS_PointInLeafnum (vec3_t point) |
| int | VS_PointInLeafnum_r (vec3_t point, int nodenum) |
| void | VS_R_CastLightAtSurface (vsound_t *light, lightvolume_t *volume) |
| void | VS_R_FloodLight (vsound_t *light, lightvolume_t *volume, int cluster, int firstportal) |
| void | VS_R_LinkSurface (int nodenum, int surfaceNum, winding_t *w) |
| int | VS_R_SplitLightVolume (vsound_t *light, lightvolume_t *volume, plane_t *split, int cluster, int firstportal) |
| void | VS_R_SubdivideAreaSpotLight (vsound_t *light, int nodenum, winding_t *w) |
| void | VS_R_SubdivideDirectedAreaLight (vsound_t *light, int nodenum, winding_t *w) |
| void | VS_R_SubdivideRadialAreaLight (vsound_t *light, int nodenum, winding_t *w) |
| float | VS_R_WindingAreaOutsideSolid (winding_t *w, vec3_t normal, int nodenum) |
| void | VS_Radiosity (void) |
| void | VS_SetPortalSphere (lportal_t *p) |
| void | VS_ShiftPatchLightmaps (void) |
| void | VS_SmoothenLightmapEdges (void) |
| void | VS_SphereFromBounds (vec3_t mins, vec3_t maxs, vec3_t origin, float *radius) |
| int | VS_SplitLightVolume (lightvolume_t *volume, lightvolume_t *back, plane_t *split, float epsilon) |
| int | VS_SplitWinding (winding_t *in, winding_t *back, plane_t *split, float epsilon) |
| void | VS_StoreLightmap (void) |
| void | VS_SubdivideAreaLight (shaderInfo_t *ls, winding_t *w, vec3_t normal, float areaSubdivide, qboolean backsplash) |
| void | VS_SurfaceRadiosity (int num) |
| void | VS_TestLightLeafs (void) |
| void | VS_TextureMatrixFromPoints (lFacet_t *f, drawVert_t *a, drawVert_t *b, drawVert_t *c) |
| float | VS_WindingAreaOutsideBrushes (winding_t *w, int *brushnums, int numbrushes) |
| float | VS_WindingAreaOutsideSolid (winding_t *w, vec3_t normal) |
| winding_t * | VS_WindingForBrushSide (dbrush_t *brush, int side, winding_t *w) |
| int | VSoundMain (int argc, char **argv) |
| vec_t | WindingArea (winding_t *w) |
| void | WindingBounds (winding_t *w, vec3_t mins, vec3_t maxs) |
| void | WindingCenter (winding_t *w, vec3_t center) |
Variables |
| int | clustersurfaces [MAX_MAP_LEAFFACES] |
| int | defaulttracelight = 0 |
| int | entitySurface [MAX_MAP_DRAW_SURFS] |
| vec3_t | gridSize |
| lleaf_t * | leafs |
| vec3_t | lightAmbientColor |
| float | lightAreaScale = 0.25 |
| int | lightDefaultSubdivide = 999 |
| float * | lightFloats |
| float | lightFormFactorValueScale = 3 |
| float | lightLinearScale = 1.0 / 8000 |
| float | lightmappixelarea [MAX_MAP_LIGHTING/3] |
| float | lightPointScale = 7500 |
| lsurfaceTest_t * | lsurfaceTest [MAX_MAP_DRAW_SURFS] |
| int | noalphashading = 0 |
| int | nobackfaceculling = 0 |
| int | nocolorshading = 0 |
| int | nostitching = 0 |
| int | numclustersurfaces = 0 |
| int | numfaces |
| int | numfacets |
| int | numportals |
| int | numvolumes = 0 |
| int | numvsounds = 0 |
| float * | oldLightFloats |
| qboolean | patchshadows |
| int | portalclusters |
| lportal_t * | portals |
| int | radiosity = 0 |
| int | radiosity_scale |
| int | samplesize |
| char | source [1024] |
| vec3_t | surfaceOrigin [MAX_MAP_DRAW_SURFS] |
| vsound_t * | vsounds [MAX_LIGHTS] |
|
|
Definition at line 251 of file l_poly.c.
References AllocWinding(), BOGUS_RANGE, CrossProduct(), DotProduct, Error(), fabs(), i, max, MAX_WORLD_COORD, winding_t::numpoints, winding_t::p, v, vec3_origin, vec3_t, vec_t, VectorAdd, VectorCopy, VectorMA, VectorNormalize(), VectorScale, VectorSubtract, vright, vup, w, and x.
Referenced by AAS_CreateCurveBrushes(), AAS_FixMapBrush(), AAS_MakeBrushWindings(), AAS_SplitWinding(), BaseWindingForNode(), BSPBrushWindings(), CM_AddFacetBevels(), CM_DrawDebugSurface(), CM_ValidateFacet(), CreateBrushWindings(), HL_SplitBrush(), MakeBrushWindings(), MakeHeadnodePortals(), Q1_SplitBrush(), Q2_BrushSideWinding(), Q3_BrushSideWinding(), Sin_BrushSideWinding(), SplitBrush(), TestExpandBrushes(), VL_WindingForBrushSide(), VS_WindingForBrushSide(), WriteBspBrushMap(), WriteMapBrush(), and WriteOriginBrush(). 00252 {
00253 int i, x;
00254 vec_t max, v;
00255 vec3_t org, vright, vup;
00256 winding_t *w;
00257
00258
00259
00260 max = -BOGUS_RANGE;
00261 x = -1;
00262 for (i=0 ; i<3; i++)
00263 {
00264 v = fabs(normal[i]);
00265 if (v > max)
00266 {
00267 x = i;
00268 max = v;
00269 }
00270 }
00271 if (x==-1)
00272 Error ("BaseWindingForPlane: no axis found");
00273
00274 VectorCopy (vec3_origin, vup);
00275 switch (x)
00276 {
00277 case 0:
00278 case 1:
00279 vup[2] = 1;
00280 break;
00281 case 2:
00282 vup[0] = 1;
00283 break;
00284 }
00285
00286 v = DotProduct (vup, normal);
00287 VectorMA (vup, -v, normal, vup);
00288 VectorNormalize (vup);
00289
00290 VectorScale (normal, dist, org);
00291
00292 CrossProduct (vup, normal, vright);
00293
00294 VectorScale (vup, BOGUS_RANGE, vup);
00295 VectorScale (vright, BOGUS_RANGE, vright);
00296
00297
00298 w = AllocWinding (4);
00299
00300 VectorSubtract (org, vright, w->p[0]);
00301 VectorAdd (w->p[0], vup, w->p[0]);
00302
00303 VectorAdd (org, vright, w->p[1]);
00304 VectorAdd (w->p[1], vup, w->p[1]);
00305
00306 VectorAdd (org, vright, w->p[2]);
00307 VectorSubtract (w->p[2], vup, w->p[2]);
00308
00309 VectorSubtract (org, vright, w->p[3]);
00310 VectorSubtract (w->p[3], vup, w->p[3]);
00311
00312 w->numpoints = 4;
00313
00314 return w;
00315 }
|
|
|
Definition at line 358 of file l_poly.c.
References AllocWinding(), b, CopyWinding(), DotProduct, Error(), f, i, in, j, MAX_POINTS_ON_WINDING, winding_t::numpoints, winding_t::p, p2, SIDE_ON, vec3_t, vec_t, and VectorCopy.
Referenced by AAS_SplitFace(), BuildFaceTree_r(), ChopFaceByBrush(), ChopWinding(), ClipSideIntoTree_r(), FilterMapDrawSurfIntoTree_r(), FilterSideIntoTree_r(), HL_SplitBrush(), Q1_SplitBrush(), SplitBrush(), SplitNodePortals(), SubdivideAreaLight(), SubdivideDrawSurf(), SubdivideFace(), VL_SubdivideAreaLight(), and VS_SubdivideAreaLight(). 00360 {
00361 vec_t dists[MAX_POINTS_ON_WINDING+4];
00362 int sides[MAX_POINTS_ON_WINDING+4];
00363 int counts[3];
00364
00365 vec_t dot;
00366 int i, j;
00367 vec_t *p1, *p2;
00368 vec3_t mid;
00369 winding_t *f, *b;
00370 int maxpts;
00371
00372 counts[0] = counts[1] = counts[2] = 0;
00373
00374
00375 for (i=0 ; i<in->numpoints ; i++)
00376 {
00377 dot = DotProduct (in->p[i], normal);
00378 dot -= dist;
00379 dists[i] = dot;
00380 if (dot > epsilon)
00381 sides[i] = SIDE_FRONT;
00382 else if (dot < -epsilon)
00383 sides[i] = SIDE_BACK;
00384 else
00385 {
00386 sides[i] = SIDE_ON;
00387 }
00388 counts[sides[i]]++;
00389 }
00390 sides[i] = sides[0];
00391 dists[i] = dists[0];
00392
00393 *front = *back = NULL;
00394
00395 if (!counts[0])
00396 {
00397 *back = CopyWinding (in);
00398 return;
00399 }
00400 if (!counts[1])
00401 {
00402 *front = CopyWinding (in);
00403 return;
00404 }
00405
00406 maxpts = in->numpoints+4;
00407
00408
00409 *front = f = AllocWinding (maxpts);
00410 *back = b = AllocWinding (maxpts);
00411
00412 for (i=0 ; i<in->numpoints ; i++)
00413 {
00414 p1 = in->p[i];
00415
00416 if (sides[i] == SIDE_ON)
00417 {
00418 VectorCopy (p1, f->p[f->numpoints]);
00419 f->numpoints++;
00420 VectorCopy (p1, b->p[b->numpoints]);
00421 b->numpoints++;
00422 continue;
00423 }
00424
00425 if (sides[i] == SIDE_FRONT)
00426 {
00427 VectorCopy (p1, f->p[f->numpoints]);
00428 f->numpoints++;
00429 }
00430 if (sides[i] == SIDE_BACK)
00431 {
00432 VectorCopy (p1, b->p[b->numpoints]);
00433 b->numpoints++;
00434 }
00435
00436 if (sides[i+1] == SIDE_ON || sides[i+1] == sides[i])
00437 continue;
00438
00439
00440 p2 = in->p[(i+1)%in->numpoints];
00441
00442 dot = dists[i] / (dists[i]-dists[i+1]);
00443 for (j=0 ; j<3 ; j++)
00444 {
00445 if (normal[j] == 1)
00446 mid[j] = dist;
00447 else if (normal[j] == -1)
00448 mid[j] = -dist;
00449 else
00450 mid[j] = p1[j] + dot*(p2[j]-p1[j]);
00451 }
00452
00453 VectorCopy (mid, f->p[f->numpoints]);
00454 f->numpoints++;
00455 VectorCopy (mid, b->p[b->numpoints]);
00456 b->numpoints++;
00457 }
00458
00459 if (f->numpoints > maxpts || b->numpoints > maxpts)
00460 Error ("ClipWinding: points exceeded estimate");
00461 if (f->numpoints > MAX_POINTS_ON_WINDING || b->numpoints > MAX_POINTS_ON_WINDING)
00462 Error ("ClipWinding: MAX_POINTS_ON_WINDING");
00463 }
|