|
|
private : void LoadMesh(String ^file)
{
array<ExtendedMaterial ^> ^ mtrl;
array<GraphicsStream ^> ^adj;
// Load our mesh
Mesh ^ mesh = Mesh::FromFile(file, MeshFlags::Managed, device);
// If we have any materials, store them
if (mtrl->Length > 0)
{
meshMaterials = gcnew array <Material ^> (mtrl->Length);
meshTextures = gcnew array <Texture ^> (mtrl->Length);
Store each material and texture
for (int i = 0; i < mtrl.Length; i++)
{
meshMaterials = mtrl->Material3D;
if ((mtrl->TextureFilename != null) && (mtrl->TextureFilename != String::Empty))
{
//We have a texture, try to load it
meshTextures = TextureLoader::FromFile(device, mtrl->TextureFilename);
}
}
}
不知道怎么回事,这段代码总是出错。(这是用managed vc++在vs2005.net 下写的)
|
|