dev.gamez.lv Forum Index dev.gamez.lv
Latvian Game Developers Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 

D3DXCreate... modelis ar novirziitu centru

 
dev.gamez.lv Forum Index -> Microsoft DirectX
View previous topic :: View next topic  
Author Message
snake5
Indago dalībnieks
Indago dalībnieks


Joined: 27 Jun 2007
Posts: 2590

PostPosted: Sun Sep 23, 2007 1:29 pm    Post subject: D3DXCreate... modelis ar novirziitu centru

kaa? bez transformaacijaam? varbuut pasham buut jaataisa funkcija, kura uztaisa taadu?? pagaidaam mani interesee tikai kaste
_________________
"There are two choices here: "looks good" and "realism"." -- Paul Nettle
Back to top
View user's profile Visit poster's website
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Sun Sep 23, 2007 1:56 pm    Post subject:

Nezinu, ko dara D3DXCreate funkcija, bet kas vainas transformācijai? Ātrdarbību tas neietekmētu necik. Virsotnes tāpat tiek reizinātas ar matricu pie projicēšanas, tāpēc vēlviena matricas esamība neko neietekmē.
Vai arī uzrakstīt prastu ciklu, kas iziet cauri visām modeļa virsotnēm un pieskaita tev vajadzīgo nobīdi. Arī nekas neiespējams.
Back to top
View user's profile Send e-mail
snake5
Indago dalībnieks
Indago dalībnieks


Joined: 27 Jun 2007
Posts: 2590

PostPosted: Sun Sep 23, 2007 2:11 pm    Post subject:

taads cikls buutu tieshi tas, ko man vajag! vnk es paarrakstu GM kodu no defaultajaam komandaam uz externaalajaam..
un te nu es saduuros ar probleemu, ka es nezinu, kaadaa formaataa ir vertexi - kaadu struktuuru izmanto! un taapeec es nesaprotu, kaa varu tos vertexus pagruust uz kaadu pusi...
_________________
"There are two choices here: "looks good" and "realism"." -- Paul Nettle
Back to top
View user's profile Visit poster's website
snake5
Indago dalībnieks
Indago dalībnieks


Joined: 27 Jun 2007
Posts: 2590

PostPosted: Sun Sep 23, 2007 4:02 pm    Post subject:

nu labi, biju pats saacis rakstiit savu boxfunkciju, un te no es dabuuju nepareizus 3stuurus!
Code:
D3DXM_LastMesh+=1;
   D3DXCreateMeshFVF(4,8,D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED,D3DFVF_XYZ | D3DFVF_TEX1,d3ddev,&XMeshStorage[D3DXM_LastMesh]);
   XM_VTX vbox[8] =
   {
      //down
      {x2,y1,z1,0,0},
      {x1,y1,z1,1,0},
      {x1,y2,z1,1,1},
      {x2,y2,z1,0,1},
      //up
      {x1,y1,z2,0,0},
      {x2,y1,z2,1,0},
      {x2,y2,z2,1,1},
      {x1,y2,z2,0,1},
   };
   UINT16 ibox[12] =
   {
      //down
      1,2,3,1,3,4,
      //up
      5,6,7,5,7,8,
   };
   LPDIRECT3DVERTEXBUFFER9 vb;
   XMeshStorage[D3DXM_LastMesh]->GetVertexBuffer(&vb);
   XM_VTX* vp;
   vb->Lock(0,0,(void**)&vp,0);
   memcpy(vp,vbox,sizeof(vbox));
   vb->Unlock();
   LPDIRECT3DINDEXBUFFER9 ib;
   XMeshStorage[D3DXM_LastMesh]->GetIndexBuffer(&ib);
   UINT16* ip;
   ib->Lock(0,0,(void**)&ip,0);
   memcpy(ip,ibox,sizeof(ibox));
   ib->Unlock();
   return (double)D3DXM_LastMesh;

index'i tak pareizi, vai ne?
_________________
"There are two choices here: "looks good" and "realism"." -- Paul Nettle
Back to top
View user's profile Visit poster's website
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Sun Sep 23, 2007 4:13 pm    Post subject:

Masīvā indeksi tiek skaitīti no 0, nevis 1.
Back to top
View user's profile Send e-mail
snake5
Indago dalībnieks
Indago dalībnieks


Joined: 27 Jun 2007
Posts: 2590

PostPosted: Sun Sep 23, 2007 4:16 pm    Post subject:

pareizi, biju galiigi aizmirsis... tagad viss ok..
_________________
"There are two choices here: "looks good" and "realism"." -- Paul Nettle
Back to top
View user's profile Visit poster's website
Display posts from previous:   
dev.gamez.lv Forum Index -> Microsoft DirectX All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group