예제 #1
0
파일: Game1.cs 프로젝트: hendleyr/Altadoon
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            defaultRasterizerState = graphics.GraphicsDevice.RasterizerState;
            wireframeRasterizerState = new RasterizerState();
            wireframeRasterizerState.FillMode = FillMode.WireFrame;
            Viewport viewport = graphics.GraphicsDevice.Viewport;
            float aspectRatio = (float)viewport.Width / (float)viewport.Height;

            // View and projection matrices for when we want a "heads up display"
            //ScreenViewMatrix = Matrix.Identity;
            //ScreenProjectionMatrix = Matrix.CreateOrthographicOffCenter(0, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height, 0, 0.0f, 1.0f);

            // make quadTree
            quadTree = new QuadTree(this);
            Components.Add(quadTree);

            player = new Player(this) {Position = new Vector3(250, 500, 250)};
            player.PlayerCamera.Perspective(80f, aspectRatio, nearClip, farClip);
            player.PlayerCamera.LookAt(new Vector3(250, 500, 0), player.Position, Vector3.Up);
            quadTree.AddComponent(player);

            base.Initialize(); // this will call Initialize on components
        }
예제 #2
0
파일: Game1.cs 프로젝트: hendleyr/Altadoon
 /// <summary>
 /// Unload your graphics content.
 /// </summary>
 protected override void UnloadContent()
 {
     content.Unload();
     quadTree = null;
     nodesIndexBuf = null;
     nodesVertBuf = null;
 }
예제 #3
0
 public QuadTreeGameComponent(Game game)
     : base(game)
 {
     quadTree = null;
     qNode = null;
 }