MCPcopy Create free account
hub / github.com/demoth/jake2 / R_SetupFrame

Method R_SetupFrame

client/src/main/java/jake2/client/render/fast/Main.java:639–691  ·  view source on GitHub ↗

R_SetupFrame

()

Source from the content-addressed store, hash-verified

637 * R_SetupFrame
638 */
639 void R_SetupFrame() {
640 r_framecount++;
641
642 // build the transformation matrix for the given view angles
643 Math3D.VectorCopy(r_newrefdef.vieworg, r_origin);
644
645 Math3D.AngleVectors(r_newrefdef.viewangles, vpn, vright, vup);
646
647 // current viewcluster
648 mleaf_t leaf;
649 if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) {
650 r_oldviewcluster = r_viewcluster;
651 r_oldviewcluster2 = r_viewcluster2;
652 leaf = Mod_PointInLeaf(r_origin, r_worldmodel);
653 r_viewcluster = r_viewcluster2 = leaf.cluster;
654
655 // check above and below so crossing solid water doesn't draw wrong
656 if (leaf.contents == 0) { // look down a bit
657 Math3D.VectorCopy(r_origin, temp);
658 temp[2] -= 16;
659 leaf = Mod_PointInLeaf(temp, r_worldmodel);
660 if ((leaf.contents & Defines.CONTENTS_SOLID) == 0 && (leaf.cluster != r_viewcluster2))
661 r_viewcluster2 = leaf.cluster;
662 }
663 else { // look up a bit
664 Math3D.VectorCopy(r_origin, temp);
665 temp[2] += 16;
666 leaf = Mod_PointInLeaf(temp, r_worldmodel);
667 if ((leaf.contents & Defines.CONTENTS_SOLID) == 0 && (leaf.cluster != r_viewcluster2))
668 r_viewcluster2 = leaf.cluster;
669 }
670 }
671
672 for (int i = 0; i < 4; i++)
673 v_blend[i] = r_newrefdef.blend[i];
674
675 c_brush_polys = 0;
676 c_alias_polys = 0;
677
678 // clear out the portion of the screen that the NOWORLDMODEL defines
679 if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) {
680 gl.glEnable(GL_SCISSOR_TEST);
681 gl.glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
682 gl.glScissor(
683 r_newrefdef.x,
684 vid.getHeight() - r_newrefdef.height - r_newrefdef.y,
685 r_newrefdef.width,
686 r_newrefdef.height);
687 gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
688 gl.glClearColor(1.0f, 0.0f, 0.5f, 0.5f);
689 gl.glDisable(GL_SCISSOR_TEST);
690 }
691 }
692
693 /**
694 * MYgluPerspective

Callers 1

R_RenderViewMethod · 0.95

Calls 9

VectorCopyMethod · 0.95
AngleVectorsMethod · 0.95
Mod_PointInLeafMethod · 0.95
getHeightMethod · 0.80
glEnableMethod · 0.65
glClearColorMethod · 0.65
glScissorMethod · 0.65
glClearMethod · 0.65
glDisableMethod · 0.65

Tested by

no test coverage detected