13 enum {VX, VY}; // Vertex indices.
15 typedef struct // For dynamic lighting.
22 // ScreenBits is currently unused.
23 extern int screenWidth, screenHeight, screenBits;
25 void I_InitGraphics(void);
26 void I_ShutdownGraphics(void);
28 void OGL_InitRenderer(void);
29 void OGL_InitData(void);
30 void OGL_ResetData(void);
32 void OGL_SwitchTo3DState();
33 void OGL_Restore2DState(int step); // Step 1: matrices, 2: attributes.
34 void OGL_UseWhiteFog(int yes);
36 float PointDist2D(float c[2]);
38 void R_RenderSprite(vissprite_t *spr);
40 // 2D drawing routines.
41 void OGL_DrawPatch_CS(int x, int y, int lumpnum);
42 void OGL_DrawPatch(int x, int y, int lumpnum);
43 void OGL_DrawFuzzPatch(int x, int y, int lumpnum);
44 void OGL_DrawAltFuzzPatch(int x, int y, int lumpnum);
45 void OGL_DrawShadowedPatch(int x, int y, int lumpnum);
46 void OGL_DrawRawScreen(int lump); // Raw screens are 320 x 200.
47 void OGL_DrawLine(float x1, float y1, float x2, float y2,
48 float r, float g, float b, float a);
49 void OGL_DrawRect(float x, float y, float w, float h, float r, float g, float b, float a);
50 void OGL_DrawRectTiled(int x, int y, int w, int h, int tw, int th);
51 void OGL_DrawCutRectTiled(int x, int y, int w, int h, int tw, int th,
52 int cx, int cy, int cw, int ch);
53 void OGL_SetColor(int palidx);
54 void OGL_SetColorAndAlpha(float r, float g, float b, float a);
55 void OGL_DrawPSprite(int x, int y, float scale, int flip, int lump);
58 void OGL_SetFilter(int filter);
67 unsigned short w2; // For split textures, width of the other part.
70 extern texsize_t *lumptexsizes; // Sizes for all the lumps.
71 extern unsigned short *spriteheights;
73 extern float texw, texh;
75 extern unsigned int curtex;
78 int FindNextPower2(int num);
79 float NextPower2Ratio(int num);
82 void OGL_ResetLumpTexData();
83 void PalToRGB(byte *palidx, byte *rgb);
84 void PalIdxToRGB(byte *pal, int idx, byte *rgb);
85 unsigned int OGL_BindTexFlat(int lump);
86 void OGL_SetFlat(int idx);
87 void OGL_BindTexture(GLuint texname);
89 // Returns the OpenGL texture name.
90 GLuint OGL_PrepareTexture(int idx);
91 GLuint OGL_PrepareFlat(int idx);// Returns the OpenGL name of the texture.
92 GLuint OGL_PrepareLightTexture(); // The dynamic light map.
94 void OGL_SetTexture(int idx);
95 unsigned int OGL_PrepareSky(int idx, boolean zeroMask);
97 void OGL_SetSprite(int pnum);
98 unsigned int OGL_PrepareSprite(int pnum);
99 void OGL_NewSplitTex(int lump, GLuint part2name);
100 GLuint OGL_GetOtherPart(int lump);
102 // Part is either 1 or 2. Part 0 means only the left side is loaded.
103 // No splittex is created in that case. Once a raw image is loaded
104 // as part 0 it must be deleted before the other part is loaded at the
106 void OGL_SetRawImage(int lump, int part);
107 void OGL_SetPatch(int lump); // No mipmaps are generated.
108 void OGL_SetNoTexture();
110 int OGL_GetLumpTexWidth(int lump);
111 int OGL_GetLumpTexHeight(int lump);
112 int OGL_ValidTexHeight2(int width, int height);
114 void OGL_UpdateTexParams(int mipmode);
115 void OGL_UpdateRawScreenParams(int smoothing);
121 typedef struct clipnode_s
123 int used; // 1 if the node is in use.
124 struct clipnode_s *prev, *next; // Previous and and nodes.
125 binangle start, end; // The start and end angles (start < end).
128 extern clipnode_t *clipnodes; // The list of clipnodes.
129 extern clipnode_t *cliphead; // The head node.
132 void C_ClearRanges();
134 void C_SafeAddRange(binangle startAngle, binangle endAngle);
136 // Add a segment relative to the current viewpoint.
137 void C_AddViewRelSeg(float x1, float y1, float x2, float y2);
139 // Check a segment relative to the current viewpoint.
140 int C_CheckViewRelSeg(float x1, float y1, float x2, float y2);
142 // Returns 1 if the specified angle is visible.
143 int C_IsAngleVisible(binangle bang);
145 clipnode_t *C_AngleClippedBy(binangle bang);
147 // Returns 1 if the subsector might be visible.
148 int C_CheckSubsector(subsector_t *ssec);
154 #define SKYHEMI_UPPER 0x1
155 #define SKYHEMI_LOWER 0x2
156 #define SKYHEMI_JUST_CAP 0x4 // Just draw the top or bottom cap.
160 float rgb[3]; // The RGB values.
161 short set, use; // Is this set? Should be used?
164 void R_RenderSkyHemispheres(int hemis);