0

我正在尝试将 .fbx 模型导入我的 xna 项目。它工作正常,但纹理是黑色的。如果我尝试手动为其添加纹理,则该对象将变得不可见。我错过了什么吗?

using System;
using AR_Framework.Graphic.Camera;
using GoblinXNA;
using GoblinXNA.Graphics;
using GoblinXNA.SceneGraph;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using XNAModel = Microsoft.Xna.Framework.Graphics.Model;

namespace AR_Framework.Graphic.Model
{
    class Modelimporter
    {
        public TransformNode import(String Model, Vector3 coordinates, int scale)
        {

            try
            {
                XNAModel xnaModel = CameraWindow.ContentLoader.Load<XNAModel>(Model);
                GeometryNode node = new GeometryNode(Model);

                Matrix[] transforms = new Matrix[xnaModel.Bones.Count];
                xnaModel.CopyAbsoluteBoneTransformsTo(transforms);
                xnaModel.CopyBoneTransformsTo(transforms);

                IModel model = new GoblinXNA.Graphics.Model(transforms, xnaModel.Meshes);
                node.Model = model;


                TransformNode modelNode = new TransformNode();
                modelNode.Translation = coordinates;
                modelNode.Scale = new Vector3(scale, scale, scale);

                modelNode.AddChild(node);
                return modelNode;

            }
            catch (Exception e)
            {
                Console.Out.WriteLine("Model not found!");
            }

            return null;
        }

    }
}
4

0 回答 0