开发者

how can i use content manager in console aplication to load a new Model?

开发者 https://www.devze.com 2023-02-07 13:24 出处:网络
how can i use content manager i开发者_运维知识库n console application to load a new Model? I want to load mesh data without any display ?Check out my answer to this question. It contains code for get

how can i use content manager i开发者_运维知识库n console application to load a new Model?

I want to load mesh data without any display ?


Check out my answer to this question. It contains code for getting a ContentManager working in a console application.

To duplicate it here briefly:

You need the ServiceContainer and GraphicsDeviceService classes from the WinForms sample. Then just use this code:

Form form = new Form(); // Dummy form for creating a graphics device
GraphicsDeviceService gds = GraphicsDeviceService.AddRef(form.Handle,
        form.ClientSize.Width, form.ClientSize.Height);

ServiceContainer services = new ServiceContainer();
services.AddService<IGraphicsDeviceService>(gds);
content = new ContentManager(services, "Content");

And, of course, include the necessary references (System.Windows.Forms.dll).

0

精彩评论

暂无评论...
验证码 换一张
取 消