Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Chocoboko

Mimicking mode 7 on a 2D API

This topic is 5342 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am trying to mimic SNES''s mode 7 to where I can have a map similar to the Falcon in Final Fantasy VI or the dragon in Secret of Mana(I am writing a SNES-style 2D game in SDL). I know about the rotation algorithms to rotate an image about the Z-axis. But I am not sure how to rotate an image across the X or Y axis in a 2D API. Would you happen to know what would be involved in rotating across the X or Y axis? Is there a foruma involved? Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Mode 7 isn''t done with any x or y axis rotation. Rotation through the Z axis is applied to the tile map. Next, as each scanline of the tilemap is drawn the scale factor increases, so the top of map is scaled in (and wrapped around the edges) and gets larger the lower you go.

You''ll have to blit your map per scanline and increase the scaling each time.

Alternatively, if you''re working with 3D hardware and/or a 3D API do it with a texture and quad and let perspective transformations and perspective corrected texturing do it for you.

------------
- outRider -

Share this post


Link to post
Share on other sites
Ummm... I get that, but... how can I figure out HOW MUCH to scale each line? and the Y-offset of the lines? I'm using a 2D API.

[edited by - Lord Alexion on March 5, 2004 8:46:25 PM]

Share this post


Link to post
Share on other sites
That depends on the ''lens'' of your camera - your horizontal field of view. If you have a narrow lens you''ll scale things down less than if you had a wide lens.

Share this post


Link to post
Share on other sites
This article will hook ya up:

http://www.pixelate.co.za/issues/5/articles/circle/sincos.htm

Share this post


Link to post
Share on other sites
I read that article already, and it didn''t help me out very well, because I''m not programming it directly, I''m using an engine called Sphere (http://sphere.sourceforge.net), and, altough I tried to port and use that code shown in the article, but I figured it''s just not possible, I dunno for sure why, maybe it doesn''t handle fixed-point math very well. But the engine can easily scale lines of the screen if I provide a zoom factor or the XY coordinates for the corners. So I need a solution that adapts to this.

Share this post


Link to post
Share on other sites
Scaling scanlines won''t help you with rotations.


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!