2012-12-18 4 views
0

이 튜토리얼을 시도했지만 여러 오류 메시지가 표시됩니다.2D 아바타로 인한 어려움

http://what-when-how.com/xna-game-studio-4-0-programmingdeveloping-for-windows-phone-7-and-xbox-360/2d-avatars-using-render-targets-xna-game-studio-4-0-programming/

는 그냥 2D 아바타를 그리려.

'세계가'현재 컨텍스트에 존재하지 않는 이름은
는 '보기'는 현재 컨텍스트에 존재하지 않는 이름은
이름 '투사'현재 컨텍스트 이름에 존재하지 않는

'avatarRenderer' 현재 컨텍스트에 존재하지 않습니다. 'avatarAnimation'이름이 현재 컨텍스트에 없습니다.
오류를 수정하려면 어떻게해야합니까?

public class Game1 : Microsoft.Xna.Framework.Game 
{ 
    GraphicsDeviceManager graphics; 
    SpriteBatch spriteBatch; 
    RenderTarget2D renderTarget; 

    public Game1() 
    { 
     graphics = new GraphicsDeviceManager(this); 
     Content.RootDirectory = "Content"; 
    } 

    protected override void Initialize() 
    { 
     base.Initialize(); 
    } 

    protected override void LoadContent() 
    { 
     spriteBatch = new SpriteBatch(GraphicsDevice); 
     renderTarget = new RenderTarget2D(GraphicsDevice, 512, 512, false, SurfaceFormat.Color, DepthFormat.Depth16); 
     projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 1, 0.01f, 200.0f); 

    } 

    protected override void Update(GameTime gameTime) 
    { 

     base.Update(gameTime); 
    } 

    protected override void Draw(GameTime gameTime) 
    { 
     GraphicsDevice.SetRenderTarget(renderTarget); 
     GraphicsDevice.Clear(Color.Transparent); 
     avatarRenderer.World = world; 
     avatarRenderer.View = view; 
     avatarRenderer.Projection = projection; 
     avatarRenderer.Draw(avatarAnimation); 
     GraphicsDevice.SetRenderTarget(null); 
     GraphicsDevice.Clear(Color.CornflowerBlue); 

     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); 
     spriteBatch.Draw(renderTarget, Vector2.Zero, Color.White); 
     spriteBatch.End(); 

     base.Draw(gameTime); 
    } 
} 

답변

3

이 자습서는 이미 아바타를 그리는 기본 자습서에 추가되어야합니다. 예 : this one.

world, viewprojection은 사용될 변환 매트릭스입니다. avatarRendererAvatarDescription에서 검색 할 수있는 렌더러입니다.