public void CreateMesh()
{
xFileName = carPath + "corrado" + xFile;
mesh = Mesh.FromFile(xFileName, 0, device, out materials);
meshParts = materials.Length;
int[] adjacency = new int[mesh.NumberFaces * 3];
mesh.GenerateAdjacency(0.01F, adjacency);
mesh.OptimizeInPlace(MeshFlags.OptimizeVertexCache, adjacency);
prepareTextures();
}
public void prepareTextures()
{
int count = mesh.NumberAttributes;
textures = new D3D.Texture[count];
materials = new D3D.ExtendedMaterial[count];
for ( int i=0; i<count; i++ )
{
if (materials.Length > 0)
{
string tex = materials[i].TextureFilename;
if (materials[i].TextureFilename != null)
{
texture = TextureLoader.FromFile(device, tex);
device.SetTexture(0, texture);
}
else
{
MessageBox.Show("błąd textur! \n" +tex+ "\n dziwny problem");
}
}
else
{
MessageBox.Show("błąd!");
}
}
}
Kod wygląda tak i wywala: błąd textur[...]...
nie wyświetla sie nazwa textury... ;/
Męcze się od rana i nic... a w necie jest pare rzeczy ale ja ich nie mam :|
między innymi:
Utility.GetMediaFile( file );
D3D.MaterialList materials = new D3D.MaterialList();
mesh.AttributeCount
Ktoś może pomóc?