Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

glfile.c File Reference

#include "qbsp.h"

Include dependency graph for glfile.c:

Include dependency graph

Go to the source code of this file.

Functions

void OutputPortal (portal_t *p, FILE *glview)
void OutputWinding (winding_t *w, FILE *glview)
int PortalVisibleSides (portal_t *p)
void WriteGLView (tree_t *tree, char *source)
void WriteGLView_r (node_t *node, FILE *glview)

Variables

int c_glfaces


Function Documentation

void OutputPortal portal_t p,
FILE glview
 

Definition at line 75 of file glfile.c.

References c_glfaces, FreeWinding(), glview, OutputWinding(), p, portal_t, PortalVisibleSides(), ReverseWinding(), w, and portal_s::winding.

Referenced by WriteGLView_r().

00076 {
00077     winding_t   *w;
00078     int     sides;
00079 
00080     sides = PortalVisibleSides (p);
00081     if (!sides)
00082         return;
00083 
00084     c_glfaces++;
00085 
00086     w = p->winding;
00087 
00088     if (sides == 2)     // back side
00089         w = ReverseWinding (w);
00090 
00091     OutputWinding (w, glview);
00092 
00093     if (sides == 2)
00094         FreeWinding(w);
00095 }

Here is the call graph for this function:

void OutputWinding winding_t w,
FILE glview
 

Definition at line 48 of file glfile.c.

References fprintf(), glview, i, level, winding_t::numpoints, winding_t::p, vec_t, and w.

Referenced by OutputPortal(), and WriteBrushList().

00049 {
00050     static  int level = 128;
00051     vec_t       light;
00052     int         i;
00053 
00054     fprintf (glview, "%i\n", w->numpoints);
00055     level+=28;
00056     light = (level&255)/255.0;
00057     for (i=0 ; i<w->numpoints ; i++)
00058     {
00059         fprintf (glview, "%6.3f %6.3f %6.3f %6.3f %6.3f %6.3f\n",
00060             w->p[i][0],
00061             w->p[i][1],
00062             w->p[i][2],
00063             light,
00064             light,
00065             light);
00066     }
00067     fprintf (glview, "\n");
00068 }

Here is the call graph for this function:

int PortalVisibleSides portal_t p  ) 
 

Definition at line 27 of file glfile.c.

References portal_s::nodes, portal_s::onnode, node_s::opaque, p, and portal_t.

Referenced by OutputPortal().

00028 {
00029     int     fcon, bcon;
00030 
00031     if (!p->onnode)
00032         return 0;       // outside
00033 
00034     fcon = p->nodes[0]->opaque;
00035     bcon = p->nodes[1]->opaque;
00036 
00037     // same contents never create a face
00038     if (fcon == bcon)
00039         return 0;
00040 
00041     if (!fcon)
00042         return 1;
00043     if (!bcon)
00044         return 2;
00045     return 0;
00046 }

void WriteGLView tree_t tree,
char *  source
 

Definition at line 131 of file glfile.c.

References _printf(), c_glfaces, Error(), fclose(), fopen(), glview, name, outbase, printf(), source, sprintf(), tree(), and WriteGLView_r().

Referenced by ProcessWorldModel().

00132 {
00133     char    name[1024];
00134     FILE    *glview;
00135 
00136     c_glfaces = 0;
00137     sprintf (name, "%s%s.gl",outbase, source);
00138     _printf ("Writing %s\n", name);
00139 
00140     glview = fopen (name, "w");
00141     if (!glview)
00142         Error ("Couldn't open %s", name);
00143     WriteGLView_r (tree->headnode, glview);
00144     fclose (glview);
00145 
00146     _printf ("%5i c_glfaces\n", c_glfaces);
00147 }

Here is the call graph for this function:

void WriteGLView_r node_t node,
FILE glview
 

Definition at line 102 of file glfile.c.

References node_s::children, glview, portal_s::next, node_t, portal_s::nodes, OutputPortal(), p, node_s::planenum, portal_t, and node_s::portals.

Referenced by WriteGLView(), and WriteGLView_r().

00103 {
00104     portal_t    *p, *nextp;
00105 
00106     if (node->planenum != PLANENUM_LEAF)
00107     {
00108         WriteGLView_r (node->children[0], glview);
00109         WriteGLView_r (node->children[1], glview);
00110         return;
00111     }
00112 
00113     // write all the portals
00114     for (p=node->portals ; p ; p=nextp)
00115     {
00116         if (p->nodes[0] == node)
00117         {
00118             OutputPortal (p, glview);
00119             nextp = p->next[0];
00120         }
00121         else
00122             nextp = p->next[1];
00123     }
00124 }

Here is the call graph for this function:


Variable Documentation

int c_glfaces
 

Definition at line 25 of file glfile.c.


Generated on Thu Aug 25 12:52:54 2005 for Quake III Arena by  doxygen 1.3.9.1