418383/418587 ภาคปลาย 2553/การเขียนเกมสามมิติด้วย XNA 4.0
รุ่นแก้ไขเมื่อ 12:14, 27 มกราคม 2554 โดย Cardcaptor (คุย | มีส่วนร่วม) (หน้าที่ถูกสร้างด้วย '== Model == * ใน XNA มีีคลาส Model สำหรับโมเดลสามมิติพื้นฐาน * Content…')
Model
- ใน XNA มีีคลาส Model สำหรับโมเดลสามมิติพื้นฐาน
- Content pipeline ที่ติดมากับ XNA สามารถอ่านไฟล์ .x (ไฟล์ของ DirectX) และไฟล์ .fbx (ไฟล์ของ Adobe ที่สามารถ export ได้จาก Maya และ 3D Studio Max) ได้
- ตัวอย่างการอ่านไฟล์
<geshi lang="C#">
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Model model;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 512;
graphics.PreferredBackBufferWidth = 512;
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
model = Content.Load<Model>("teapot");
}
</geshi>