在 Monogame 中加载没有内容管道的 .FBX 文件

Loading .FBX file without Content Pipeline in Monogame

我想知道是否有一种方法可以在不使用 monogame 内容管道的情况下将只有一个立方体的简单 .fbx 文件加载到我的游戏中。这是我目前拥有的代码,但我基本上只想摆脱文件为 .xnb

的要求
    public static Model LoadModel(string model)
    {
        Model outModel = null;
        // If model is already in memory, reference that instead of having to load it again
        if (Loaded3DModels.ContainsKey(model))
        {
            Loaded3DModels.TryGetValue(model, out outModel);
        }
        else
        {
            if (File.Exists(Game.gameWindow.Content.RootDirectory + "/" + model + ".fbx"))
            {
                outModel = Game.gameWindow.Content.Load<Model>(model + ".fbx");
                Loaded3DModels.Add(model, outModel);
            }
            else
            {
                Debug.LogError("The Model \"" + model + ".fbx\" does not exist!", true, 2);
            }
        }

        return outModel;
    }

所以我设法使用 AssImp 加载网格,然后将其“转换”为 Monogame 可以渲染的内容

    public Renderer3DComponent(Mesh mesh)
    {
        // Set up material
        Material = new BasicEffect(Game.graphics.GraphicsDevice);
        Material.Alpha = 1;
        Material.VertexColorEnabled = true;
        Material.LightingEnabled = false;

        // Tris
        for (int i = mesh.VertexCount - 1; i >= 0; i--)
        {
            var Vert = mesh.Vertices[i];
            Verts.Add(new VertexPositionColor(new Vector3(Vert.X, Vert.Y, Vert.Z), Color.White));
        }

        // Buffer
        Buffer = new VertexBuffer(Game.graphics.GraphicsDevice, typeof(VertexPositionColor), Verts.Count, BufferUsage.WriteOnly);
        Buffer.SetData(Verts.ToArray());
    }