MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / RenderSubmodelFaceFogged

Function RenderSubmodelFaceFogged

model/newstyle.cpp:510–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508}
509
510inline void RenderSubmodelFaceFogged(poly_model *pm, bsp_info *sm, int facenum) {
511 g3Point *pointlist[100];
512 polyface *fp = &sm->faces[facenum];
513 int modelnum = sm - pm->submodel;
514 int t;
515
516 for (t = 0; t < fp->nverts; t++) {
517 g3Point *p = &Robot_points[fp->vertnums[t]];
518 pointlist[t] = p;
519
520 float mag;
521
522 if (Polymodel_effect.fog_plane_check == 1) {
523 mag = vm_DotProduct(&Fog_plane, &sm->verts[fp->vertnums[t]]) + Fog_distance;
524 } else {
525 vector *vec = &sm->verts[fp->vertnums[t]];
526
527 // Now we must generate the split point. This is simply
528 // an equation in the form Origin + t*Direction
529
530 float dist = (*vec * Polymodel_fog_plane) + Fog_distance;
531
532 vector subvec = *vec - Fog_view_pos;
533
534 float t = Fog_eye_distance / (Fog_eye_distance - dist);
535 vector portal_point = Fog_view_pos + (t * subvec);
536
537 float eye_distance = -(vm_DotProduct(&Fog_plane, &portal_point));
538 mag = vm_DotProduct(&Fog_plane, vec) + eye_distance;
539 }
540
541 float scalar = mag / Polymodel_effect.fog_depth;
542
543 if (scalar > 1)
544 scalar = 1;
545 if (scalar < 0)
546 scalar = 0;
547 p->p3_a = scalar;
548
549 p->p3_flags |= PF_RGBA;
550 }
551
552 if (triangulated_faces[facenum])
553 g3_SetTriangulationTest(1);
554
555 g3_DrawPoly(fp->nverts, pointlist, 0);
556
557 if (triangulated_faces[facenum])
558 g3_SetTriangulationTest(0);
559}
560
561inline void RenderSubmodelFaceSpecular(poly_model *pm, bsp_info *sm, int facenum) {
562 g3Point *pointlist[100];

Callers 1

Calls 3

g3_SetTriangulationTestFunction · 0.85
g3_DrawPolyFunction · 0.85
vm_DotProductFunction · 0.50

Tested by

no test coverage detected