Jump to content
Posted 30 September 1999 - 04:37 PM
Posted 19 September 1999 - 09:04 AM
Did you already check the resources of GameDev? Look at the section Programming-General/Graphics, where you will find an aricle titled "Texture Mapping". It explains the principle of linear texture mapping, wich is exactly what you need for 2d. http://www.gamedev.net/reference/programming/graphics/article366.asp
Posted 19 September 1999 - 12:53 PM
[This message has been edited by Blake (edited September 19, 1999).]
Posted 19 September 1999 - 10:42 PM
Abrash: Black book of graphics programming (a must-have)
The bible: Computer graphics, principles and practice
And the less theory, more code series: Graphics Gems 1-(whatever)...
You will be amazed by the knowledge compiled into these books ..
Posted 20 September 1999 - 12:35 PM
Posted 20 September 1999 - 02:18 PM
Posted 20 September 1999 - 03:56 PM
Posted 20 September 1999 - 06:40 PM
1) Setup a rectangular polygon (4 vectors)
2) rotate vectors clockwise or counterclockwise
3) Blit pixels line by line onto polygon
Simple simple simple but I don't know enough trigonometry to be able to rotate points. That's all I need to know how to do.
I went and bought a cheap trig book today and I can already tell the book explains exactly what it is I'm trying to do. I will post the fruits of my labor in the form of a tutorial when I am successful. However, I still welcome any examples. My e-mail is email@example.com.
Thanks to all that replied!
Posted 20 September 1999 - 10:01 PM
Posted 21 September 1999 - 12:19 AM
The calculation I use for finding an angle is:
x = Sin((90 + ang) * pi / 180) * rad
y = Sin(ang * pi / 180) * rad
This may or may not be what you're looking for. You feed it pi, rad(the radius) and ang(the angle) and it gives you the x,y relative to 0,0.
Oh, and that was in VB. I don't know exactly what it would be in C, sorry. Should be a staright-forward conversion though.
Hope this helps.
BTW- does anyone know how to do the blitting on an angle, but in DirectX? Or do you just read each pixel and rotate it yourself?
Posted 21 September 1999 - 08:22 AM
Posted 21 September 1999 - 12:11 PM
new_x = x * cos(n) - y * sin(n);
new_y = y * cos(n) + x * sin(n);
Taken from Andre Lamothe's "Tricks of the Game Programming Gurus", so don't bitch at me if you think it's wrong
Posted 21 September 1999 - 12:26 PM
Posted 21 September 1999 - 07:46 PM
Posted 23 September 1999 - 01:23 AM
and BTW: lets say one sprite is 40*40 * 40directions * 16 frames * 2bytes =2.048 mb!?
Posted 23 September 1999 - 02:19 AM
(Check it out at http://www.image.dk/~noshit/scrshots.html if you like)
Posted 23 September 1999 - 08:26 AM
Posted 23 September 1999 - 10:31 AM
Posted 23 September 1999 - 12:23 PM
I mean i am working on a isometric/action type game and you well be having 8-way movement.
As far as not being able to shoot any direction just move the ship ect over a pixel and your on a new angle for your shots.
Posted 23 September 1999 - 06:06 PM
Now, I've put together some of the things that you have all posted and now I have a simple polygon rotation demo. What nobody mentioned was that you have to draw your rectangle's vertices in each of the 4 quadrants:
II | I
III | IV
Also, the formula(s) posted expect RADIANS instead of DEGREES. Other than that, my question has been pretty much answered. If you want to see the little demo I put together, download it here. Hopefully this weekend I will have some code to render a texture to the polygon.
Thanks to all that have posted.
[This message has been edited by Blake (edited September 24, 1999).]