简体   繁体   English

在没有内容管道的XNA中加载模型

[英]Loading Models in XNA without the Content Pipeline

Now, I love XNA. 现在,我喜欢XNA。 It's an awesome framework, except for one thing. 这是一个很棒的框架,除了一件事。

The content pipeline. 内容管道。

It's a huge no-no for any game that encourages modding and user-created content, especially for a game like mine which practically depends on it. 对于任何鼓励修改和用户创建内容的游戏来说,这是一个巨大的禁忌,特别是对于像我这样实际依赖它的游戏。

How would one go about loading a skinned+animated .x file into a Model class? 如何将皮肤+动画.x文件加载到Model类中?

I assume that you have to load the file normally, parse it, and build up a Model out of ModelMeshes, but I don't have any clue how I would go about creating ModelMeshes from scratch. 我假设您必须正常加载文件,解析它,并从ModelMeshes中构建一个Model,但我不知道如何从头开始创建ModelMeshes。

I don't even need you to tell me how to do it, pointing to some good articles or tutorials would be perfect. 我甚至不需要你告诉我该怎么做,指向一些好的文章或教程将是完美的。

Thanks in advance! 提前致谢!

EDIT: I have searched around for this, a lot, but everything I see just tells me to use the content pipeline. 编辑:我已经搜索了很多,但我看到的一切只是告诉我使用内容管道。

If you're looking for loading .x files only, I don't have any answers except to refer you to the .X file format reference . 如果您正在寻找仅加载.x文件,除了将您推荐给.X文件格式参考之外,我没有任何答案。 But since you mention that user-created content is very important - I will point out that COLLADA is a great option. 但是既然你提到用户创建的内容非常重要 - 我会指出COLLADA是一个很好的选择。 Open Model Implementation for XNA is a good library that can get you started loading COLLADA files, but it is still upto you to render them - or use the OMI renderer. XNA的开放模型实现是一个很好的库,可以让您开始加载COLLADA文件,但仍然需要渲染它们 - 或者使用OMI渲染器。

Hope this helps some! 希望这有助于一些!

You can compile the models at runtime if you so desire. 如果您愿意,可以在运行时编译模型。 This will lead to long loading times of you have a lot of files so I suggest saving the results from the compilation and only recompiling if necessary (new file or changes since last compilation). 这会导致你有很多文件的加载时间很长,所以我建议保存编译结果,只在必要时重新编译(新文件或自上次编译后的更改)。

There is a sample that does thin somewhere on the AppHub but I suggest you check out this project it should be very easy to modify to do exactly what you need. 有一个样本在AppHub的某个地方很薄,但我建议你查看这个项目它应该很容易修改,以完全满足你的需要。

Also check out the gamedev stackexchange if you have more gamedev related questions. 还检查了gamedev stackexchange如果你有更多gamedev相关的问题。

Edit: Also huge thumbs up on supporting the modding community that inevitably pops up around any good game which I'm sure your will be. 编辑:对于支持modding社区的巨大赞许,不可避免地出现在任何好的游戏周围,我相信你会的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM