Inheritance: Axiom.Core.Camera
Example #1
0
        protected void dispose(bool disposeManagedResources)
        {
            if (!IsDisposed)
            {
                if (disposeManagedResources)
                {
                    if (root != null)
                    {
                        root.FrameStarted -= RootFrameRenderingQueued;
                    }
                    if (sceneManager != null)
                    {
                        sceneManager.RemoveAllCameras();
                    }
                    camera = null;
                    if (Root.Instance != null)
                    {
                        Root.Instance.RenderSystem.DetachRenderTarget(window);
                    }
                    if (window != null)
                    {
                        WindowEventMonitor.Instance.UnregisterWindow(window);
                        window.Dispose();
                    }
                    if (root != null)
                    {
                        root.Dispose();
                    }
                }

                // There are no unmanaged resources to release, but
                // if we add them, they need to be released here.
            }
            IsDisposed = true;
        }
Example #2
0
        public void InitializeScene()
        {
            // Start the Stopwatch.
            stopwatch = new Stopwatch();
            stopwatch.Start();
            physicsDelayTicks  = Stopwatch.Frequency / 35.0;            // 30 physics steps per second
            ticksToMilliFactor = 1.0 / (Stopwatch.Frequency / 1000.0);
            ticksToPhysicsStepPercentFactor = 1.0 / physicsDelayTicks;
            lastPhysicsStepTicks            = 0.0;

            // Create the World.
            World.Instance = new World(sceneManager);
            World.Instance.Initialize();
            World.Instance.Arena = new Arena(sceneManager, 500, 4);

            // Create a AI Ships.
            for (var i = 0; i < 36; i++)
            {
                World.Instance.AddShip(new Ship(sceneManager, new RandomController()));
            }

            // Camera.
            camera = new SmoothCamera("Camera", sceneManager, World.Instance.PlayerShip, 6);

            // Lighting.
            sunlight           = sceneManager.CreateLight("Sunlight");
            sunlight.Type      = LightType.Spotlight;
            sunlight.Specular  = ColorEx.White;
            sunlight.Diffuse   = new ColorEx(0.85f, 0.77f, 0.60f);
            sunlight.Position  = new Vector3(0, 0, 0);
            sunlight.Direction = Vector3.NegativeUnitZ;
            sunlight.SetSpotlightRange(15, 60);
            sceneManager.AmbientLight = ColorEx.Black;
            camera.Node.AttachObject(sunlight);

            // Viewport.
            viewport = window.AddViewport(camera, 0, 0, 1.0f, 1.0f, 100);
            viewport.BackgroundColor = ColorEx.Black;
        }
Example #3
0
        public void InitializeScene()
        {
            // Start the Stopwatch.
            stopwatch = new Stopwatch();
            stopwatch.Start();
            physicsDelayTicks = Stopwatch.Frequency / 35.0; // 30 physics steps per second
            ticksToMilliFactor = 1.0 / (Stopwatch.Frequency / 1000.0);
            ticksToPhysicsStepPercentFactor = 1.0 / physicsDelayTicks;
            lastPhysicsStepTicks = 0.0;

            // Create the World.
            World.Instance = new World(sceneManager);
            World.Instance.Initialize();
            World.Instance.Arena = new Arena(sceneManager, 500, 4);

            // Create a AI Ships.
            for (var i = 0; i < 36; i++)
            {
                World.Instance.AddShip(new Ship(sceneManager, new RandomController()));
            }

            // Camera.
            camera = new SmoothCamera("Camera", sceneManager, World.Instance.PlayerShip, 6);

            // Lighting.
            sunlight = sceneManager.CreateLight("Sunlight");
            sunlight.Type = LightType.Spotlight;
            sunlight.Specular = ColorEx.White;
            sunlight.Diffuse = new ColorEx(0.85f, 0.77f, 0.60f);
            sunlight.Position = new Vector3(0, 0, 0);
            sunlight.Direction = Vector3.NegativeUnitZ;
            sunlight.SetSpotlightRange(15, 60);
            sceneManager.AmbientLight = ColorEx.Black;
            camera.Node.AttachObject(sunlight);

            // Viewport.
            viewport = window.AddViewport(camera, 0, 0, 1.0f, 1.0f, 100);
            viewport.BackgroundColor = ColorEx.Black;
        }
Example #4
0
        protected void dispose(bool disposeManagedResources)
        {
            if (!IsDisposed)
            {
                if (disposeManagedResources)
                {
                    if (root != null)
                        root.FrameStarted -= RootFrameRenderingQueued;
                    if (sceneManager != null)
                        sceneManager.RemoveAllCameras();
                    camera = null;
                    if (Root.Instance != null)
                        Root.Instance.RenderSystem.DetachRenderTarget(window);
                    if (window != null)
                    {
                        WindowEventMonitor.Instance.UnregisterWindow(window);
                        window.Dispose();
                    }
                    if (root != null)
                        root.Dispose();
                }

                // There are no unmanaged resources to release, but
                // if we add them, they need to be released here.
            }
            IsDisposed = true;
        }