View Single Post
  #1 (permalink)  
Old 09-14-2007, 07:16 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,118
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Icon13 Drawing Mesh Please Help!!!

PHP Code:
        #region Variables

        
Model shipModel;
        
Vector3 cameraPosition = new Vector3(0.0f5000.0f0.0f);
        
Vector3 shipPosition Vector3.Zero;

        
#endregion

/// <summary>
        /// Draws the gameplay screen.
        /// </summary>
        
public override void Draw(GameTime gameTime)
        {
            
// This game has a blue background. Why? Because!
            
ScreenManager.GraphicsDevice.Clear(ClearOptions.TargetColor.CornflowerBlue00);

            
Matrix[] transforms = new Matrix[shipModel.Bones.Count];
            
shipModel.CopyAbsoluteBoneTransformsTo(transforms);

            foreach (
ModelMesh mesh in shipModel.Meshes)
            {
                foreach (
BasicEffect effect in mesh.Effects)
                {
                    
effect.EnableDefaultLighting();
                    
effect.World transforms[mesh.ParentBone.Index] * Matrix.CreateTranslation(shipPosition);
                    
effect.View Matrix.CreateLookAt(cameraPositionVector3.ZeroVector3.Up);
                    
Matrix projection Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45f), (800.0f 600.0f), 10.0f10000.0f);
                }
                
mesh.Draw();
            }

            
// If the game is transitioning on or off, fade it out to black.
            
if (TransitionPosition 0)
                
ScreenManager.FadeBackBufferToBlack(255 TransitionAlpha);
        } 
I need help on drawing mesh, I just want to make sure if this Draw() code will work...??? I used this code to just draw the model rotation, however, it doesn't appear on my game for some reason... I got some edits on it... I want it to be seen from the top instead, not really close as the sample.. Thanx if anybody could help...

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote