贴图啊,永远的痛。XNA导入成功~
2009 十二月 16
弄了很久终于把3ds max上的model导入到了XNA中,使用了FBX中介,不过效果一般,只是最终加上了贴图。
图中那个很突兀的白色球体是下面的东西:
但是部分的贴图因为路径问题仍然有些纠结。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); audioEngine = new AudioEngine("Content\\Audio\\TutorialAudio.xgs"); waveBank = new WaveBank(audioEngine, "Content\\Audio\\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, "Content\\Audio\\Sound Bank.xsb"); //建立Camera mainCamera = new Camera(this, cameraPosition, cameraLookAt, Vector3.Up); terrain.model = Content.Load( "Models\\terrain"); //载入坦克模型 tank.model = Content.Load( "Models\\kl"); tank.scale = 0.08f; tank.position.Y += 50; tank.position.Z -= 500; missileLauncherBase.model = Content.Load( "Models\\launcher_base"); missileLauncherBase.scale = 0.2f; missileLauncherHead.model = Content.Load( "Models\\launcher_head"); missileLauncherHead.scale = 0.2f; missileLauncherHead.position = missileLauncherBase.position + new Vector3(0.0f, 20.0f, 0.0f); missiles = new GameObject[numMissiles]; for (int i = 0; i < numMissiles; i++) { missiles[i] = new GameObject(); missiles[i].model = Content.Load("Models\\missile"); missiles[i].scale = 3.0f; } enemyShips = new GameObject[numEnemyShips]; for (int i = 0; i < numEnemyShips; i++) { enemyShips[i] = new GameObject(); enemyShips[i].model = Content.Load( "Models\\enemy"); enemyShips[i].scale = 0.1f; enemyShips[i].rotation = new Vector3( 0.0f, MathHelper.Pi, 0.0f); } // TODO: use this.Content to load your game content here } |
不过很欣喜的写出了一个camera类~
相关日志
2 Responses
leave one →


沙发沙发~~
不错啊,但是有一点小问题。。。
那就是,那不是可爱的头骨,是恐怖的头骨。。。。。
P.S.原来C#+XNA的代码长这样啊,OMG。。。
代码挺好看的啊~