• Create Account

2D Rotation

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

23 replies to this topic

#21Blake  Members

122
Like
Likes
Like

Posted 24 September 1999 - 08:21 PM

I now have a much much better example of rotating a 2D polygon - Download it here!.

It now includes direct surface manipulations for pixel and line drawing on DirectX surfaces (16bit surfaces). Even if you aren't interested in rotating polygons, you may want to look at the code just to see how direct surface manipulations are done. There is a good pixel plotting function and an interpretation of Bres's Line Drawing function.

Pasting a texture to the polygon at this point should be a walk in the park. I'll repost an example as soon as I sit down and work it out.

Blake

#22Seyedof  Members

123
Like
Likes
Like

Posted 28 September 1999 - 01:19 AM

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
(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

#23Cthulhu  Members

122
Like
Likes
Like

Posted 29 September 1999 - 10:21 AM

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!"

#24Khawk  Senior Staff

1811
Like
Likes
Like

Posted 30 September 1999 - 04:37 PM

From your friendly moderator:

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

Kevin

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.