Skip to main content
GameDev.net gamedev.net
🔒 Locked

Mimicking mode 7 on a 2D API

Started by Chocoboko Feb 7, 2004 at 9:19 PM 6 replies 3.4k views
Original Post
Chocoboko
Chocoboko
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.
outRider
outRider
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 -
Lord Alexion
Lord Alexion
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]
superpig
superpig
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.
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
M3d10n
M3d10n
This article will hook ya up:

http://www.pixelate.co.za/issues/5/articles/circle/sincos.htm
Lord Alexion
Lord Alexion
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.
Sneftel
Sneftel
Scaling scanlines won''t help you with rotations.


"Sneftel is correct, if rather vulgar." --Flarelocke
Lord Alexion
Lord Alexion
no, but they could be scaled THEN rotated, or the contrary... right?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.