24 |
24 |
25 function NewTexture(width, height: Longword; buf: Pointer): PTexture; |
25 function NewTexture(width, height: Longword; buf: Pointer): PTexture; |
26 procedure Surface2GrayScale(surf: PSDL_Surface); |
26 procedure Surface2GrayScale(surf: PSDL_Surface); |
27 function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; |
27 function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; |
28 procedure PrettifySurfaceAlpha(surf: PSDL_Surface; pixels: PLongwordArray); |
28 procedure PrettifySurfaceAlpha(surf: PSDL_Surface; pixels: PLongwordArray); |
29 procedure PrettifyAlpha2D(pixels: TLandArray; height, width: LongWord); |
29 procedure PrettifyAlpha2D(height, width: LongWord); |
30 procedure FreeAndNilTexture(var tex: PTexture); |
30 procedure FreeAndNilTexture(var tex: PTexture); |
31 |
31 |
32 procedure initModule; |
32 procedure initModule; |
33 procedure freeModule; |
33 procedure freeModule; |
34 |
34 |
35 implementation |
35 implementation |
36 uses GLunit, uUtils, uVariables, uConsts, uDebug, uConsole; |
36 uses GLunit, uUtils, uVariables, uConsts, uDebug, uConsole, uLandUtils; |
37 |
37 |
38 var TextureList: PTexture; |
38 var TextureList: PTexture; |
39 |
39 |
40 |
40 |
41 procedure SetTextureParameters(enableClamp: Boolean); |
41 procedure SetTextureParameters(enableClamp: Boolean); |
192 end; |
192 end; |
193 // don't forget last row |
193 // don't forget last row |
194 PrettifyAlpha(pixels, nil, si, li, w); |
194 PrettifyAlpha(pixels, nil, si, li, w); |
195 end; |
195 end; |
196 |
196 |
197 procedure PrettifyAlpha2D(pixels: TLandArray; height, width: LongWord); |
197 procedure PrettifyAlpha2D(height, width: LongWord); |
198 var |
198 var |
199 // current y; last x, second last y of array; |
199 // current y; last x, second last y of array; |
200 y, lx, sly: LongWord; |
200 y, lx, sly: LongWord; |
201 begin |
201 begin |
202 sly:= height - 2; |
202 sly:= height - 2; |
203 lx:= width - 1; |
203 lx:= width - 1; |
204 for y:= 0 to sly do |
204 for y:= 0 to sly do |
205 begin |
205 begin |
206 PrettifyAlpha(PLongWordArray(pixels[y]), PLongWordArray(pixels[y+1]), 0, lx, 0); |
206 PrettifyAlpha(LandPixelRow(y), LandPixelRow(y+1), 0, lx, 0); |
207 end; |
207 end; |
208 // don't forget last row |
208 // don't forget last row |
209 PrettifyAlpha(PLongWordArray(pixels[sly+1]), nil, 0, lx, 0); |
209 PrettifyAlpha(LandPixelRow(sly+1), nil, 0, lx, 0); |
210 end; |
210 end; |
211 |
211 |
212 function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; |
212 function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; |
213 var tw, th, x, y: Longword; |
213 var tw, th, x, y: Longword; |
214 tmpp: pointer; |
214 tmpp: pointer; |