Ejemplo n.º 1
0
        // Methods --------------------------------------------------------------------
        /// <summary>
        /// Creates the element in the world. It automatically
        /// sets up the mesh and the node with the infos in <paramref name="Item"/></summary>.
        /// <param name="item">Describes the element and all necessary infos</param>
        public CaelumClouds(CaelumItem item)
        {
            Initialise(RenderQueueGroupID.Queue2, item.Mesh, item.Scale, item.Rotation);

            Pass pass = MainMaterial.GetBestTechnique().Passes[0];
            mShadersEnabled = !(string.IsNullOrEmpty(pass.FragmentProgramName) ||
                                string.IsNullOrEmpty(pass.VertexProgramName));

            SetCloudMassOffset(Vec2.Zero);
            SetCloudDetailOffset(Vec2.Zero);
            SetCloudMassBlend(0.5f);

            mInstance = this;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates all Caelum's components needed,
        /// register them in <c>mChildren</c> and sets up them.
        /// </summary>
        protected override void OnPostCreate(bool loaded)
        {
            base.OnPostCreate(loaded);

            Log.Info("Initialising Caelum system...");

            // Avoid undo bug
            if(mChildren == null)
                mChildren = new List<CaelumBase>();

            // Creates and sets up a new UniversalClock
            UniversalClock clock = new UniversalClock();
            clock.SetGregorianDateTime(mStartYear, mStartMonth, mStartDay, mStartHour, 0, 0);

            // Sets up Sky color's calculation model
            SkyColorModel.GradientImage = _type.GradientImage;
            SkyColorModel.SkyGradientImage = _type.SkyGradientImage;

            /* Creates all Caelum's element
             * TODO: Find a better way to do that and clean up this code */
            CaelumItem item = getItembyType(CaelumComponent.Sun);
            if (item != null)
                if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Sun))
                {
                    CaelumSun sun = new CaelumSun(item);
                    sun.FarDistance = _type.FarDistance;
                    mChildren.Add(sun);
                }

            item = getItembyType(CaelumComponent.Moon);
            if (item != null)
                if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Moon))
                {
                    CaelumMoon moon = new CaelumMoon(item);
                    moon.FarDistance = _type.FarDistance;
                    mChildren.Add(moon);
                }

            item = getItembyType(CaelumComponent.Starfield);
            if (item != null)
            {
                if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Starfield))
                    mChildren.Add(new CaelumStarfield(item));
            }

            item = getItembyType(CaelumComponent.Skydome);
            if (item != null)
            {
                if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Skydome))
                    mChildren.Add(new CaelumSkydome(item));
            }

            item = getItembyType(CaelumComponent.Clouds);
            if (item != null)
            {
                if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Clouds))
                {
                    CaelumClouds clouds = new CaelumClouds(item);
                    clouds.SetCoverImage( _type.CoverLookupImage );
                    mChildren.Add(clouds);
                }
            }

            if (CaelumUtils.IsContainType(_type.ComponentsToCreate, CaelumComponent.Fog))
                mManageFog = true;

            Log.Info("Done: Initialising Caelum system");
        }
Ejemplo n.º 3
0
        public override void Dispose()
        {
            base.Dispose();
            mInstance = null;

            if (mCoverLookupImage != null)
                mCoverLookupImage.Dispose();

            mCoverLookupImage = null;
        }