1b1c6262bdf17196cfabf8e88714e664c512d54b
1 (* Copyright (C) Doom 2D: Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *)
15 {$INCLUDE ../../../shared/a_modes.inc}
18 interface
20 uses
21 g_animations,
22 r_textures
23 ;
25 procedure r_Draw_Texture (img: TGLTexture; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean);
26 procedure r_Draw_TextureRepeat (img: TGLTexture; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean);
27 procedure r_Draw_TextureRepeatRotate (img: TGLTexture; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean; rx, ry, angle: Integer);
29 procedure r_Draw_MultiTextureRepeat (m: TGLMultiTexture; const anim: TAnimState; backanim: Boolean; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean);
30 procedure r_Draw_MultiTextureRepeatRotate (m: TGLMultiTexture; const anim: TAnimState; backanim: Boolean; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean; rx, ry, angle: Integer);
44 implementation
46 uses
47 {$IFDEF USE_GLES1}
48 GLES11,
49 {$ELSE}
51 {$ENDIF}
53 e_log, utils
54 ;
56 const
62 var
67 begin
75 glLoadIdentity;
78 glLoadIdentity;
84 begin
93 procedure DrawTile (tile: TGLAtlasNode; x, y, w, h: Integer; flip: Boolean; rr, gg, bb, aa: Byte; blend: Boolean);
95 begin
97 begin
99 if blend then glBlendFunc(GL_SRC_ALPHA, GL_ONE) else glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
103 end
104 else
105 begin
115 if blend then glBlendFunc(GL_SRC_ALPHA, GL_ONE) else glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
126 end
129 procedure r_Draw_Texture (img: TGLTexture; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean);
131 begin
136 else
137 begin
140 glPushMatrix;
144 begin
146 begin
157 glPopMatrix;
158 end
161 procedure r_Draw_TextureRepeat (img: TGLTexture; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean);
163 begin
168 else
171 r_Draw_Texture(img, x + i * img.width, y + j * img.height, img.width, img.height, flip, r, g, b, a, blend);
174 procedure r_Draw_TextureRepeatRotate (img: TGLTexture; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean; rx, ry, angle: Integer);
175 begin
179 begin
180 glPushMatrix;
185 glPopMatrix;
186 end
187 else
191 procedure r_Draw_MultiTextureRepeat (m: TGLMultiTexture; const anim: TAnimState; backanim: Boolean; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean);
193 begin
197 else
198 begin
204 end
207 procedure r_Draw_MultiTextureRepeatRotate (m: TGLMultiTexture; const anim: TAnimState; backanim: Boolean; x, y, w, h: Integer; flip: Boolean; r, g, b, a: Byte; blend: Boolean; rx, ry, angle: Integer);
208 begin
212 begin
213 glPushMatrix;
218 glPopMatrix;
219 end
220 else
225 begin
237 glEnd;
241 begin
249 {
250 glVertex2i(l, t);
251 glVertex2i(r, t);
252 glVertex2i(r, b);
253 glVertex2i(l, b);
254 }
259 glEnd;
263 begin
271 {
272 glVertex2i(l, t);
273 glVertex2i(r, t);
274 glVertex2i(r, b);
275 glVertex2i(l, b);
276 }
277 {
278 glVertex2f(l + 0.5, t + 0.5);
279 glVertex2f(r - 0.5, t + 0.5);
280 glVertex2f(r - 0.5, b - 0.5);
281 glVertex2f(l + 0.5, b - 0.5);
282 }
287 glEnd;
291 begin
303 glEnd;
308 begin
311 begin
322 begin
327 begin
337 begin
347 begin