2D Rotation

Started by
22 comments, last by Blake 24 years, 6 months ago
hi,
It depends on which type of texture
mapping you wanna do, there are several
ways and optimizations. if you want to
texture map a quadrangle i offer you
to download the ABUSE source code
(it's a side scrolling game), i have
got this source from x2ftp.oulu.fi
There's a nice texture mapper function
among too many other useful functions.

If you want just to rotate a texture
map, for example a tile based game in
which the tile mapped ground rotates
there are some optimizations to do,
Have you ever seen the Seek 'n Destroy
game from Safari? they have done such
thing, the rotate the tile mapped
ground, the method they used was to
divide a whole 360 degrees of rotation
into some steps, for example each
10 degrees, then they have precalced
and saved the result so there is no
texture calculations done in runtime,
it's all precalced

I'm a game developer, we have developed
a game like Seek 'n Destroy but with
too much better quality and features,
it supports not only rotations but scaling
as the chop moves up or down there
are some tricks to do in such engines.

Some ideas are :

First notice that if you want to
texture map a quadrangle, which is
symetric around it's center ,you can
only calculate the pixels for half
of your quad the other half can be
calced using the first half.

If you do just rotate a bitmap
(no scaling) the best way is to
precalculate the pixel offsets and
save them as your game data.

And a really big optimization is :
if you want to texture map several
quads with the same rotation angle and
the same size (like a tiled ground)
you can texture map only one tile in
a buffer and use the same pixel offsets
for all other quads (tiles).

Our game uses the last method and
runs fast in 640x480x256 mode under
windows (with Direct X). if you want
some screen shots from the game please
email me.

Hope you are making a great game

--MFC (The Matrix Foundation Crew)
Advertisement
You don't need to have 360 precalced pictures to have rotation in accuracy of 1 angles. You can have only 90 because 90 degree rotations are fast to do. And of course it would propably be enough to have accuracy of 5 angles to have smooth animation, that would be total of 18 precalced pictures.

------------------
"Tank, I need an exit. Fast!"

I am working on a 2D shooter with 16bit color and I want to rotate my ship. I know I need to draw a polygon and map a texture to it, but where do I begin? Can anyone reference some good documentation?
From your friendly moderator:

I'm gonna lock this thread now. It's straying off of its original topic.

Kevin

Admin for GameDev.net.

This topic is closed to new replies.

Advertisement