Mimicking mode 7 on a 2D API
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.
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 -
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 -
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]
[edited by - Lord Alexion on March 5, 2004 8:46:25 PM]
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.
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.
Scaling scanlines won''t help you with rotations.
"Sneftel is correct, if rather vulgar." --Flarelocke
"Sneftel is correct, if rather vulgar." --Flarelocke
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement