2013年1月25日星期五

GameGraphics 2



This time we talked how we can render out a 2D image from the 3D shade.

we start form Model space change it to the World space where the object really are.

Then get it to the view space which means the camera view. It always facing forward, if we want to move it,We just change all the objects to the negative direction.


At last we change the view space to the project space.  The project is a piece of paper which we put in front of our camera (wherever we want). 

When we want to move our object we usually change the rotation first and then do the translation 


To finish the assignment 

First Add the Index Buffer into code  just like the vertex Buffer, I just change  the vertex Buffer code to Index Buffer's

Add  Mesh and Camera files 

Add transform_modelToWorld, transform_worldToView,transform_viewToProjected

        
This is screen-cut 

updata



Code




2013年1月18日星期五

GameGraphicsYang Assignment1

This is Blogger just for showing what I have done on the GameGraphics Class,Maybe very boring.Just for recording

The mesh data from the text-file

this part confused me a lot

I think the way to load the data from a file is using this part of code, but every time I build I can not find out my Meshes folder from my Data folder.

I think I need to change this part of the AssetList.lua file, but it did not work well



I still work on this.I want to say it is my fault I thought this will be easy to do.

Update of The Assignment-1

I know this took a lot of time but worked it out by myself and learned somethings is good.


This is a sample which help me to read the txt file give the idea how to do our assignment


#include <iostream>
#include <string>
#include <fstream>
using namespace std;
const int Money = 10000;
struct Patrons
{
 string name;
 double money;
};
int main()
{ ifstream inFile;
 inFile.open("demo6_9.txt");
 if(!inFile.is_open())
 {
  cout<<"could not open the file \"demo6_9\"\n";
  cout<<"program terminating!\n";
  exit(EXIT_FAILURE);
 }

 int num;
 inFile>>num;
 cout<<"the number of Patrons is :"<<num<<"."<<endl;
 inFile.get();  .
// string name;
// int money;
 Patrons *pt = new Patrons[num];
 if(inFile.is_open())
 {
  int i;
  for(i=0;i<num;i++)
  {
 //  inFile>>name;
 //  inFile>>money;
 //  pt[i].name = name;
 //  pt[i].money = money;
   getline(inFile,pt[i].name);  //读取一行输入
   (inFile>>pt[i].money).get();
  }

  int k=0;
  cout<<"Grand Patrons:"<<endl;
  for(i=0;i<num;i++)
   if(pt[i].money >= Money)
   {
    cout<<pt[i].name<<" "<<pt[i].money<<endl;
    k++;
   }
   if(k==0)
   cout<<"none.\n";

  cout<<"Patrons:"<<endl;
  if(k==num)
   cout<<"none.\n";
  else
  {
   for(i=0;i<num;i++)
    if(pt[i].money < Money)
     cout<<pt[i].name<<" "<<pt[i].money<<endl;
  }
 }

 inFile.close();
 delete [] pt;
 system("pause");
 return 0;
}
              This is what it looks like 





Here are screenshots of debugging the vertex shader and pixel shader in Pix.