Message Board
Message Board > Fenix / Bennu / Gemix / DIV > My waterripples effect... |
November 2, 2006, 15:23 | |
Quiest
now with more happynes 142 posts |
...is slow as hell Anybody know if there is a way to make it faster? Like, a faster way to switch arrays? Or is Fenix just not good enough for such kind of effects? You can find the source here. (SPACE to start a random ripple) Note: it on such a small screen because it runs faster The bigger the screen, the bigger the array... Just change the x_dim and y_dim consts to change the resolution and see for yourself. [Edited on November 2, 2006 by Quiest] ____________ Roundhousekick to the face, baby! |
# |
November 2, 2006, 16:35 | |
Eckolin
Quite Whiskered 388 posts |
This program makes SGL look fast. For the swappring you may want to use memcopy. You could even dynamically allocate memory and just swap the pointers. Code: if(x_diff!=0) x_angle=atan(x_diff)*1000; x_refract=asin(sin(x_angle)/r_index); x_displace=tan(x_refract)*x_diff; else x_displace=0; end; These values ONLY depend on the value of x_diff/y_diff. You can use lookuptables. You can also replace: Code: next[cx][cy]=tmp; x_diff=(next[cx+1][cy]-next[cx][cy])/3; ... y_diff=(next[cx][cy+1]-next[cx][cy])/3; By Code: next[cx][cy]=tmp; x_diff=(next[cx+1][cy]-tmp)/3; ... y_diff=(next[cx][cy+1]-tmp)/3; And if you feel really lucky you can use mapbuffer and write directly to memory instead of the map_put_pixels. [Edited on November 2, 2006 by Eckolin] ____________ Maker of Games... Wisdom is supreme; therefore get wisdom. Need help with coding? I probably wrote something similar. |
# |
November 2, 2006, 17:06 | |
Rincewind
programmer 1546 posts |
PEader programmed a rather fast ripple effect in DIV in the past, maybe he still has it. The WIP went down together with DIV-Arena.
____________ Personal website: http://www.loijson.com |
# |
November 2, 2006, 19:20 | |
Quiest
now with more happynes 142 posts |
Okay, thx so far... could you please explain the usage of memcopy to me? How do I have to use this for swapping the arrays? And can you explain a little about the mapbuffer thingie? Making the lookup table now... ____________ Roundhousekick to the face, baby! |
# |
Message Board > Fenix / Bennu / Gemix / DIV > My waterripples effect...