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);
96 void GL_GetSkyTopColor(int texidx, byte *rgb);
98 void OGL_SetSprite(int pnum);
99 unsigned int OGL_PrepareSprite(int pnum);
100 void OGL_NewSplitTex(int lump, GLuint part2name);
101 GLuint OGL_GetOtherPart(int lump);
103 // Part is either 1 or 2. Part 0 means only the left side is loaded.
104 // No splittex is created in that case. Once a raw image is loaded
105 // as part 0 it must be deleted before the other part is loaded at the
107 void OGL_SetRawImage(int lump, int part);
108 void OGL_SetPatch(int lump); // No mipmaps are generated.
109 void OGL_SetNoTexture();
111 int OGL_GetLumpTexWidth(int lump);
112 int OGL_GetLumpTexHeight(int lump);
113 int OGL_ValidTexHeight2(int width, int height);
115 void OGL_UpdateTexParams(int mipmode);
116 void OGL_UpdateRawScreenParams(int smoothing);
122 typedef struct clipnode_s
124 int used; // 1 if the node is in use.
125 struct clipnode_s *prev, *next; // Previous and and nodes.
126 binangle start, end; // The start and end angles (start < end).
129 extern clipnode_t *clipnodes; // The list of clipnodes.
130 extern clipnode_t *cliphead; // The head node.
133 void C_ClearRanges();
135 void C_SafeAddRange(binangle startAngle, binangle endAngle);
137 // Add a segment relative to the current viewpoint.
138 void C_AddViewRelSeg(float x1, float y1, float x2, float y2);
140 // Check a segment relative to the current viewpoint.
141 int C_CheckViewRelSeg(float x1, float y1, float x2, float y2);
143 // Returns 1 if the specified angle is visible.
144 int C_IsAngleVisible(binangle bang);
146 clipnode_t *C_AngleClippedBy(binangle bang);
148 // Returns 1 if the subsector might be visible.
149 int C_CheckSubsector(subsector_t *ssec);
155 #define SKYHEMI_UPPER 0x1
156 #define SKYHEMI_LOWER 0x2
157 #define SKYHEMI_JUST_CAP 0x4 // Just draw the top or bottom cap.
158 #define SKYHEMI_FADEOUT_BG 0x8 // Draw the fadeout bg when drawing the cap.
162 float rgb[3]; // The RGB values.
163 short set, use; // Is this set? Should be used?
164 float limit; // .3 by default.
167 #define SLF_ENABLED 0x1 // Layer enabled.
168 #define SLF_MASKED 0x2 // Mask the layer texture.
173 int texture; // Not the OpenGL texture.
178 void R_RenderSky(int hemis);