예제 #1
0
파일: OpenGLControl.cs 프로젝트: GNZ/CG
        public OpenGLControl()
        {
            camera = new Camera(new Spherical(8f, (float)Math.PI / 4,(float) Math.PI / 2));
            //camera = new GhostCamera();

            //projMatrix = Matrix4.CreateOrthographicOffCenter(-10f, 10f, -10f, 10f, 0.0001f, 10000f);
            projMatrix = Matrix4.CreatePerspectiveFieldOfView(1f, this.Width / this.Height, 1f, 100f);
            zoomMatrix = camera.lookAt();
        }
예제 #2
0
        public OpenGLControl()
        {
            camera = new SphericalCamera(new Spherical(8, (float)Math.PI / 2, 0));

            projMatrix = Matrix4.CreatePerspectiveFieldOfView(0.7f, this.Width / this.Height, 0.15f, 100f);
            zoomMatrix = camera.lookAt();

            refreshTimer.Interval = 20;
            refreshTimer.Elapsed += new ElapsedEventHandler(refreshTimer_Elapsed);
        }
예제 #3
0
        public override void Process(Camera camera, GameTime gameTime)
        {
#if DEBUG
            stopwatch.Restart();
#endif

            Game.GraphicsDevice.SetRenderTarget(null);
            Game.GraphicsDevice.BlendState = BlendState.AlphaBlend;
            Game.GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
            foreach (KeyValuePair<string, Texture2D> kvp in Inputs)
                if (kvp.Value != null)
                    spriteBatch.Draw(kvp.Value, Vector2.Zero, Color.White);
            spriteBatch.End();

#if DEBUG
            processTimes.Enqueue((int)stopwatch.ElapsedTicks);
            while (processTimes.Count > 60)
                processTimes.Dequeue();
#endif
        }
예제 #4
0
        public void setSphericalCamera(SphericalCamera cam)
        {
            camera = cam;
            camera_mode = CAMERA_MODE.SPHERICAL_CAMERA;

            refreshView();
        }
예제 #5
0
        public void setCarCamera(CarCamera cam)
        {
            camera = cam;
            camera_mode = CAMERA_MODE.CAR_CAMERA;

            refreshView();
        }