1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
public void creerEmplacementMesh(float l, float L, float prof)
{
mesh = new Mesh(12, 8, MeshFlags.Managed, VertexFormats.Position, DirectxManager.device3D);
float longueur = l;
float largeur = L;
float profondeur = prof;
// On attribut dans le Mesh les caractéristique du cube
mesh.SetVertexBufferData(new CustomVertex.PositionOnly[]{
new CustomVertex.PositionOnly(-longueur,-largeur,-profondeur),
new CustomVertex.PositionOnly(longueur,-largeur,-profondeur),
new CustomVertex.PositionOnly(-longueur,largeur,-profondeur),
new CustomVertex.PositionOnly(longueur,largeur,-profondeur),
new CustomVertex.PositionOnly(-longueur,-largeur,profondeur),
new CustomVertex.PositionOnly(longueur,-largeur,profondeur),
new CustomVertex.PositionOnly(-longueur,largeur,profondeur),
new CustomVertex.PositionOnly(longueur,largeur,profondeur)}, 0);
// Affectation des caractéristiques d'un emplacement.
mesh.SetIndexBufferData(new short[]{0,3,1,0,2,3,0,1,4,1,5,4,0,4,2,2,4,6,
1,7,5,1,3,7,4,5,6,5,7,6,2,6,3,3,6,7}, 0);
meshTab[NUMERO_EMPLACEMENT] = mesh; // save du mesh
NUMERO_EMPLACEMENT++; // incrementation de l'indice du tableau
} |
Partager