• Welcome to Dark Bit Factory & Gravity.
 

Here's a rotozoomer...

Started by Dr_D, February 08, 2009

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr_D

I don't know if anyone needs it or not, but most of it's programmed inline x86 asm. There is a known bug when drawing to another fb.image, but we'll get that fixed asap. :)

rotozoom
The Dr. is INsane!!!

Shockwave

Thats nice and fast Dr.D :)

And it has source code too which could be helpful for people who want to load Bitmaps.

Thanks :)
Shockwave ^ Codigos
Challenge Trophies Won:

Dr_D

Thanks Shockwave. That previously mentioned bug has been removed as well. ;)
The Dr. is INsane!!!

benny!

Indeed. Well done, Dr_D
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

rdc

That's cool stuff, as always. Thanks!

Jim

Thanks Dr_D.  Would be interesting to compare what Freebasic compiler generates compared with hand optimised stuff.

Jim
Challenge Trophies Won:

Dr_D

Well, we did some stuff like leaving a few vars that get used a lot on the fpu stack. I can't be sure, but I don't think fb does that. I haven't looked at the asm fb generates for it normally, but that's an interesting idea! This one is quite a bit faster than one programmed directly in fb code though.
The Dr. is INsane!!!

hellfire

I had a quick look at your source, some points that can be improved:
Bubble-sort is not a particularly fast way to pick the minimum/maximum from 4 values.
You're much faster by using integer coordinates for interpolation, the fpu just requires permanent "fisting".
Don't test every texel if it's inside texture-boundaries:
You can test where the current scanline enters/leaves the valid range and skip the according amount of pixels (or use a polygon) which makes the innerloop end up in just a few instructions.
You don't need a multiplication to build a texel's address:
"my" always increasing by the integer-part of "tsdzx" or one more if the fractional part causes an overflow. So you can pick the value from a table according to the carry flag (see here).
Challenge Trophies Won:

matthew

Very nice & thanks for including the source.  :)

Clyde

Neat Dr_D, must of taken abit of doing.

Cheers And K++,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Shockwave

I can't seem to invoke the bug that you said was in the first version, where was it exactly?
It worked fine here.
Shockwave ^ Codigos
Challenge Trophies Won:

Dr_D

Well, the fb.image structure now has pitch. We weren't taking that into consideration before, which caused errors when drawing to odd sized windows/images. It should be all good now though. :)
The Dr. is INsane!!!

Shockwave

I see :)

Next things to do is add a scroller and a song ;)
Shockwave ^ Codigos
Challenge Trophies Won: