Ejemplo n.º 1
0
        /// <summary>
        /// Remove SkyX, you can call this method to remove SkyX from the scene
        /// or release (secondary) SkyX memory, call <see cref="Create"/> to return SkyX to the scene.
        /// </summary>
        public void Remove()
        {
            if (IsCreated)
            {
                return;
            }

            CloudsManager.RemoveAll();
            MeshManager.Remove();
            MoonManager.Remove();
            VCloudsManager.Remove();

            IsCreated = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Call every frame to update SkyX
        /// </summary>
        /// <param name="timeSinceLastFrame">time elapsed since last frame</param>
        public void Update(float timeSinceLastFrame)
        {
            if (!IsCreated)
            {
                return;
            }
            if (TimeMultiplier != 0)
            {
                AtmosphereManager.AtmosphereOptions opt = AtmosphereManager.Options;

                float timemultiplied = timeSinceLastFrame * TimeMultiplier;
                opt.Time.x += timemultiplied;
                TimeOffset += timemultiplied;
                if (opt.Time.x > 24)
                {
                    opt.Time.x -= 24;
                }
                else if (opt.Time.x < 0)
                {
                    opt.Time.x += 24;
                }

                AtmosphereManager.Options = opt;
            }

            if (_lastCameraPosition != Camera.DerivedPosition)
            {
                MeshManager.SceneNode.Position     = Camera.DerivedPosition;
                MoonManager.MoonSceneNode.Position = Camera.DerivedPosition;

                _lastCameraPosition = Camera.DerivedPosition;
            }

            if (_lastCameraFarClipDistance != Camera.FarClipDistance)
            {
                MeshManager.UpdateGeometry();
                MoonManager.Update();

                _lastCameraFarClipDistance = Camera.FarClipDistance;
            }

            VCloudsManager.Update(timeSinceLastFrame);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create SkyX and add to the scene
        /// </summary>
        public void Create()
        {
            if (IsCreated)
            {
                return;
            }

            MeshManager.Create();

            MeshManager.MaterialName = GpuManager.SkydomeMaterialName;

            AtmosphereManager.Update(AtmosphereManager.Options, true);

            _lastCameraPosition        = Camera.DerivedPosition;
            _lastCameraFarClipDistance = Camera.FarClipDistance;

            MoonManager.Create();

            IsCreated = true;
        }