Probleme affichage de mesh directx

manipulat Messages postés 1 Date d'inscription mercredi 5 octobre 2005 Statut Membre Dernière intervention 3 mai 2010 - 1 mars 2010 à 11:23
JUSTLOVE1 Messages postés 5 Date d'inscription dimanche 6 novembre 2011 Statut Membre Dernière intervention 14 mai 2012 - 8 mars 2012 à 17:05
Bonjour tout le monde je me permet de poser une question car je ne comprend pas bien l'origine du probleme, c'est une partie de mon code servant a afficher un mesh, ce code bug au niveau du chargement du fichier .X
Je pense qu'il y a une erreur sur le lien ver le fichier
using System;
using System.Drawing;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows.Forms;
using System.Data;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;


namespace rush_1
{
    class Mesh_aff
    {
        Engine engine;
        Device device;
        Mesh mesh;
        Material[] meshmat; 
        Texture[] meshtext; 

        public void init(ref Engine engine)
        {
            this.engine = engine;
   
            
            
            ExtendedMaterial[] materials;
            
            mesh = Mesh.FromFile(Application.StartupPath + "\\sphere.X", MeshFlags.SystemMemory, device, out materials);
            meshtext = new Texture[materials.Length];
            meshmat = new Material[materials.Length];

            for (int i = 0 ; i < materials.Length; i++)
            {
                meshmat[i] = materials[i].Material3D;
                meshtext[i] = TextureLoader.FromFile(device, Application.StartupPath + "\\earth.bmp");
            }

        }
        public void rendu()
        {
            for (int i = 0; i < meshmat.Length; i++)
            {
                device.Material = meshmat[i];
                device.SetTexture(0, meshtext[i]);
                mesh.DrawSubset(i);
            }
        }
    }
}



Le debuggeur me dit que "l'exeption Direct3DXExeption n'a pas été gérée"
a la ligne
 mesh = Mesh.FromFile(Application.StartupPath + "\\sphere.X", MeshFlags.SystemMemory, device, out materials);

Quelqu'un pourrait-il m'éclairer???
Merci d'avance.

2 réponses

cs_zanzan Messages postés 32 Date d'inscription lundi 3 février 2003 Statut Membre Dernière intervention 25 juillet 2012
15 mars 2010 à 05:55
salut
rapidement

mesh = Mesh.FromFile(Application.StartupPath + @"\sphere.X"

c'est pas mieux comme cela avec le @
et un seul \


Zan
0
JUSTLOVE1 Messages postés 5 Date d'inscription dimanche 6 novembre 2011 Statut Membre Dernière intervention 14 mai 2012
8 mars 2012 à 17:05
Salut,

Mr pouvez-vous m'aider par l'application code mesh, car je peut charger un fichier .X (directX) pour import un modélé 3D au niveau de code c#(Visual studio)

MERCI BEAUCOUP BEAUCOUP Parce que je suis dans le besoin urgent
0
Rejoignez-nous