Sirus-v کاربر اخراج شده
تاريخ عضويت: شنبه 1 مرداد 1384 تعداد ارسالها: 325
4 شنبه 20 ارديبهشت 1385 - 08:40 |
|
|
می تونی یک تابع به این صورت تعریف کنی :
كد: |
private void LoadMesh(string file)
{
ExtendedMaterial[] mtrl;
// Load our mesh
mesh = Mesh.FromFile(file, MeshFlags.Managed, device, out mtrl);
// If we have any materials, store them
if ((mtrl != null) && (mtrl.Length > 0))
{
meshMaterials = new Material[mtrl.Length];
meshTextures = new Texture[mtrl.Length];
// Store each material and texture
for (int i = 0; i < mtrl.Length; i++)
{
meshMaterials[i] = mtrl[i].Material3D;
if ((mtrl[i].TextureFilename != null) && (mtrl[i].TextureFilename !=
string.Empty))
{
// We have a texture, try to load it
meshTextures[i] = TextureLoader.FromFile(device, @"..\..\" +
mtrl[i].TextureFilename);
}
}
}
}
|
و برای لود کردن مش :
كد: |
LoadMesh(@"..\..\tiny.x");
|
|
|
|