bizzard4
Messages postés
155
Date d'inscription
vendredi 12 décembre 2003
Statut
Membre
Dernière intervention
15 février 2009
17 mars 2007 à 14:35
Bonjour
Je veux seulement faire un cube opaque. Parce que la comme tu le voie sur le screen shot le carré délémiter en rouge on le voie pas mais sa couleur est sur la face du fond et sur la face du côté.
Voici le code pour mon cube :
CUSTOMVERTEX g_Vertices[3600];
// Création de Vertices Manuelle
int k = 0;
// Fond :: Rouge
g_Vertices[0].position = D3DXVECTOR3(-5.0f, -5.0f, 0.0f);
g_Vertices[1].position = D3DXVECTOR3(5.0f, -5.0f, 0.0f);
g_Vertices[2].position = D3DXVECTOR3(-5.0f, 5.0f, 0.0f);
g_Vertices[3].position = D3DXVECTOR3(5.0f, -5.0f, 0.0f);
g_Vertices[4].position = D3DXVECTOR3(5.0f, 5.0f, 0.0f);
g_Vertices[5].position = D3DXVECTOR3(-5.0f, 5.0f, 0.0f);
for (k = 0; k < 6; k++)
{
g_Vertices[k].color = D3DCOLOR_XRGB(255, 0, 0);
}
// Top :: Vert
g_Vertices[6].position = D3DXVECTOR3(-5.0f, -5.0f, -10.0f);
g_Vertices[7].position = D3DXVECTOR3(5.0f, -5.0f, -10.0f);
g_Vertices[8].position = D3DXVECTOR3(-5.0f, 5.0f, -10.0f);
g_Vertices[9].position = D3DXVECTOR3(5.0f, -5.0f, -10.0f);
g_Vertices[10].position = D3DXVECTOR3(5.0f, 5.0f, -10.0f);
g_Vertices[11].position = D3DXVECTOR3(-5.0f, 5.0f, -10.0f);
for (k = 6; k < 12; k++)
{
g_Vertices[k].color = D3DCOLOR_XRGB(0, 255, 0);
}
// Face Devant :: Bleu
g_Vertices[12].position = D3DXVECTOR3(-5.0f, -5.0f, 0.0f);
g_Vertices[13].position = D3DXVECTOR3(5.0f, -5.0f, 0.0f);
g_Vertices[14].position = D3DXVECTOR3(-5.0f, -5.0f, -10.0f);
g_Vertices[15].position = D3DXVECTOR3(5.0f, -5.0f, 0.0f);
g_Vertices[16].position = D3DXVECTOR3(5.0f, -5.0f, -10.0f);
g_Vertices[17].position = D3DXVECTOR3(-5.0f, -5.0f, -10.0f);
for (k = 12; k < 18; k++)
{
g_Vertices[k].color = D3DCOLOR_XRGB(0, 0, 255);
}
// Face derrìère :: Rose
g_Vertices[18].position = D3DXVECTOR3(-5.0f, 5.0f, 0.0f);
g_Vertices[19].position = D3DXVECTOR3(5.0f, 5.0f, 0.0f);
g_Vertices[20].position = D3DXVECTOR3(-5.0f, 5.0f, -10.0f);
g_Vertices[21].position = D3DXVECTOR3(5.0f, 5.0f, 0.0f);
g_Vertices[22].position = D3DXVECTOR3(5.0f, 5.0f, -10.0f);
g_Vertices[23].position = D3DXVECTOR3(-5.0f, 5.0f, -10.0f);
for (k = 18; k < 24; k++)
{
g_Vertices[k].color = D3DCOLOR_XRGB(255, 0, 255);
}
// Face Gauche :: Cyan
g_Vertices[24].position = D3DXVECTOR3(-5.0f, 5.0f, 0.0f);
g_Vertices[25].position = D3DXVECTOR3(-5.0f, -5.0f, 0.0f);
g_Vertices[26].position = D3DXVECTOR3(-5.0f, 5.0f, -10.0f);
g_Vertices[27].position = D3DXVECTOR3(-5.0f, -5.0f, 0.0f);
g_Vertices[28].position = D3DXVECTOR3(-5.0f, -5.0f, -10.0f);
g_Vertices[29].position = D3DXVECTOR3(-5.0f, 5.0f, -10.0f);
for (k = 24; k < 30; k++)
{
g_Vertices[k].color = D3DCOLOR_XRGB(0, 255, 255);
}
// Face Droite
g_Vertices[30].position = D3DXVECTOR3(5.0f, 5.0f, -10.0f);
g_Vertices[31].position = D3DXVECTOR3(5.0f, -5.0f, 0.0f);
g_Vertices[32].position = D3DXVECTOR3(5.0f, -5.0f, -10.0f);
g_Vertices[33].position = D3DXVECTOR3(5.0f, -5.0f, 0.0f);
g_Vertices[34].position = D3DXVECTOR3(5.0f, 5.0f, 0.0f);
g_Vertices[35].position = D3DXVECTOR3(5.0f, 5.0f, -10.0f);
for (k = 30; k < 36; k++)
{
g_Vertices[k].color = D3DCOLOR_XRGB(255, 255, 0);
}
// Create the vertex buffer.
if( FAILED( g_pd3dDevice->CreateVertexBuffer( 3600*sizeof(CUSTOMVERTEX),
0, D3DFVF_CUSTOMVERTEX,
D3DPOOL_DEFAULT, &g_pVB, NULL ) ) )
{
return E_FAIL;
}
~~ Cordialement Francois Gingras