Engine:
authorsmxx
Tue, 02 Mar 2010 15:04:31 +0000
changeset 2910 d5051cc8a313
parent 2909 f982208e7f21
child 2911 cd355befa683
Engine: * Fixed DrawTextureF und DrawTextureRotatedF for NPOT textures
hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Tue Mar 02 04:04:16 2010 +0000
+++ b/hedgewars/uStore.pas	Tue Mar 02 15:04:31 2010 +0000
@@ -542,13 +542,13 @@
 else
 	hw:= w div 2;
 
-nx:= round(Texture^.w * Texture^.rx / w);
-ny:= round(Texture^.h * Texture^.ry / h);
+nx:= round(Texture^.w / w); // number of horizontal frames
+ny:= round(Texture^.h / h); // number of vertical frames
 
-ft:= ((Frame mod ny) / ny);
-fb:= (((Frame mod ny) + 1) / ny);
-fl:= ((Frame div ny) / nx) * Texture^.rx;
-fr:= (((Frame div ny) + 1) / nx);
+ft:= (Frame mod ny) * Texture^.ry / ny;
+fb:= ((Frame mod ny) + 1) * Texture^.ry / ny;
+fl:= (Frame div ny) * Texture^.rx / nx;
+fr:= ((Frame div ny) + 1) * Texture^.rx / nx;
 
 glBindTexture(GL_TEXTURE_2D, Texture^.id);