Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Help Me (perspective Projection), make a Mode7 projection
.hack//GU
post Jan 23 2008, 09:24 AM
Post #1


Premium Member
********

Group: Members
Posts: 190
Joined: 21-October 05
Member No.: 13,185



I made this code to test isometric projection:

CODE
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>

float matrix[4][4] =
{{1, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 1, 0},
{0, 0, 0, 1}};

void vertex( float x, float y, float z ){
float n[4],r[4]={0, 0, 0, 0};
n[0]=x; n[1]=y; n[2]=z; n[3]=1;

for(int i=0; i<4; i++)
for(int j=0; j<4; j++)
r[i]+=n[j]*matrix[j][i];

putpixel(r[0]+(getmaxx()/2),r[1]+(getmaxx()/2),YELLOW);
}

int main(void)
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "");
errorcode = graphresult();
if (errorcode != grOk) {
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}

int angle = 40;

do{

cleardevice();

//isometric projection
matrix[2][0] = -0.5 * sin( angle * M_PI / 180 );
matrix[2][1] = -0.5 * cos( angle * M_PI / 180 );


for(int i=-100; i< 100; i+=1)
for(int j=-100; j< 100; j+=1)
vertex(i,0,j);

angle+=10;
if(angle>=360) angle=0;

}while(!kbhit());

getch();
closegraph();
return 0;
}


this code is for isometric projection, can anyone help me to turn it to perspective projection?
or maybe ones called that Mode7.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Lazy People Can Make Money Too(6)
  2. Timer(5)
  3. How To Make Your Own Counter Strike Source Dedicated Server!(3)
  4. Make Your Own Mmog(6)
  5. Make Your Own Mmorpg(39)
  6. Make A Flat Based Shoutbox, With Auto Refresh.(6)
  7. Why Dont Have Burnout Games For Pc?(11)
  8. Is It Really Possible To Make Any Money Online?(12)
  9. Make An Online Game To Earn Money(2)
  10. Make Yourself Admin On A Computer(28)
  11. How Do I Make Gold Fast In Runescape/(116)
  12. Make Money Using Youtube And Adsense(10)
  13. Name 3 Things That Make You Real Mad(78)
  14. How Do I Make A Live Chat Using Php?(15)
  15. Can I Make Dynamic Menu In Php(7)
  1. Could Someone Make A Php Script For Me?(3)
  2. Here's Some Jokes To Make You Laugh A Little.(5)
  3. How Do I Make My Own Private Online Server Please Help Me Out.thank You For Your Time.(22)
  4. Runescape Private Server(51)
  5. How To Make Your Pc Work Faster(16)
  6. Key Logger.(34)
  7. Some Of The Biggest Questions In Life.(2)
  8. Make Money Online Blog(1)
  9. Best Way To Make Money From Your Website?(5)
  10. Post Your Favorite Easy To Make Meal.(16)
  11. How To Make A View New Post Script?(5)
  12. Selling My Mccodes License(3)
  13. Scrolling Images?(5)
  14. Make Money Using Chacha(1)
  15. Windows Vista Tranformation Pack(73)


 



- Lo-Fi Version Time is now: 24th July 2008 - 05:54 AM