Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 2.01 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class Transformations;
  2. class TransData;
  3.  
  4.  
  5.  
  6. class Transformations //CE045C
  7. {
  8. public:
  9.                 char unknown0[144]; //0x0000
  10.         TransData* pTran; //0x0090  
  11.                
  12. };
  13.  
  14. class TransData
  15. {
  16. public:
  17.         char unknown0[4]; //0x0000
  18.         D3DXVECTOR3 InvView_right; //0x0004  
  19.         D3DXVECTOR3 InvView_up; //0x0010  
  20.         D3DXVECTOR3 InvView_forward; //0x001C  
  21.         D3DXVECTOR3 InvView_Translation; //0x0028  
  22.        
  23.         D3DXVECTOR2 pad; //0x0034   (x = 1,y = -1)
  24.    
  25.  
  26.         //http://msdn.microsoft.com/en-us/library/aa915188.aspx    
  27.         D3DXVECTOR3 ViewPortMatrix1; //0x003C  (x= viewPort.Width/2)
  28.         D3DXVECTOR3 ViewPortMatrix2; //0x0048 -(y= viewPort.Height/2)
  29.         D3DXVECTOR3 ViewPortMatrix3; //0x0054(x=viewPort.X + CenterScreenX,y=viewPort.Y + CenterScreenY,z=viewPort.MinZ)
  30.         D3DXVECTOR3 ViewPortMatrix_unk; //not sure
  31.        
  32.         D3DXVECTOR3 ProjO1;//proj1.x  0x006C
  33.         D3DXVECTOR3 ProjO2;//proj2.y  0x0078
  34.         D3DXVECTOR3 ProjO3;//proj3.z  0x0084     =1.0001
  35.         D3DXVECTOR3 ProjO4;//proj4.z  0x0090
  36.  
  37.         D3DXVECTOR3 Proj1;//proj1.x  0x009C
  38.         D3DXVECTOR3 Proj2;//proj2.y  0x00A8
  39.         D3DXVECTOR3 Proj3;//proj3.z  0x00B4     = 1.0
  40.         D3DXVECTOR3 Proj4;//proj4.z  0x00C0
  41.        
  42.         D3DXVECTOR3 ProjD1;//   0x00CC     x = 1/Proj._11
  43.         D3DXVECTOR3 ProjD2;//   0x00D8     y = 1/Proj._22
  44.         D3DXVECTOR3 ProjD3;//   0x00E4     z=  1
  45.         D3DXVECTOR3 ProjD4;//   0x00F0
  46.        
  47.         D3DXVECTOR2 pad1; //.x bigass float  0x00FC
  48.        
  49.         D3DXVECTOR3 View_right; //0x0104    not the view
  50.         D3DXVECTOR3 View_up; //0x0110  
  51.         D3DXVECTOR3 View_forward; //0x011C  
  52.         D3DXVECTOR3 View_Translation; //0x0128  
  53.        
  54.                
  55. };
  56.  
  57.  
  58. D3DXVECTOR3 W2SN(TransData* p, D3DXVECTOR3 in)
  59. {
  60.         D3DXVECTOR3 out,temp;
  61.        
  62.         ::D3DXVec3Subtract(&temp,&in,&p->InvView_Translation);
  63.         float x = ::D3DXVec3Dot(&temp,&p->InvView_right);
  64.         float y = ::D3DXVec3Dot(&temp,&p->InvView_up);
  65.         float z = ::D3DXVec3Dot(&temp,&p->InvView_forward);
  66.  
  67.  
  68.         out.x =  p->ViewPortMatrix3.x * (1+(x / p->ProjD1.x / z));
  69.         out.y =  p->ViewPortMatrix3.y * (1-(y / p->ProjD2.y / z));
  70.         out.z =  z;
  71.  
  72.         return out;
  73. }