Click here to Skip to main content
15,881,882 members
Articles / Multimedia / DirectX

Game Engine

Rate me:
Please Sign up or sign in to vote.
3.78/5 (6 votes)
20 Nov 2009CPL2 min read 47.3K   1.5K   34  
A game engine first prototype
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MTV3D65;

namespace gefx
{
    public  class Clouds
    {

        private TVTextureFactory TF;
        private TVMaterialFactory Mats;
        public TVAtmosphere Atmos;
        private int cloudsIntTex;
        public float Speed=0;
        public string CloudsTextureEX="no texture select";
        public float Altitude = 0f;
        public int CloudsLayers=-1;

        public int Width;
        public int Height;

        public Clouds()
        {
            TF = new TVTextureFactory();
            Atmos = new TVAtmosphere();


        }

        public void AddClouds(string CloudsText)
        {
            if (Atmos != null)
            {

                CloudsTextureEX = CloudsText;
                cloudsIntTex = TF.LoadTexture(CloudsText, "CloudsDDSPic", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_BLACK);
                Atmos.Clouds_Create(1, 1024, 1024);
                Atmos.Clouds_SetLayerParameters(0, 500, cloudsIntTex);
                Altitude = 500;
                Atmos.Clouds_SetLayerAnimation(0, true, 0.01f * Speed , 0.01f * Speed );
                CloudsLayers++;
                Width = 1024;
                Height = 1024;

            }

        }

        public void AddSpeed(float pSpeed, int Layer)
        {
            if (Atmos != null)
            {
                Speed = pSpeed;

                Atmos.Clouds_SetLayerAnimation(Layer, true, 0.01f * Speed, 0.01f * Speed);


            }

        }

        public void AddClouds(string CloudsText, int layernumber,float Visina,float W, float H)
        {
            if (Atmos != null)
            {

                if (layernumber < CloudsLayers)
                {

                    CloudsTextureEX = CloudsText;

                    cloudsIntTex = TF.LoadTexture(CloudsText, "CloudsDDSPic" + layernumber.ToString(), -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_BLACK, true);
                    Atmos.Clouds_Create(layernumber, W, H);
                    Atmos.Clouds_SetLayerParameters(layernumber, Visina, cloudsIntTex);
                    Altitude = Visina;
                    Atmos.Clouds_SetLayerAnimation(layernumber, true, 0.01f * Speed , 0.01f * Speed );
                    CloudsLayers++;
                    Width = (int )W;
                    Height = (int )H;
                }



            }

        }

        public void AddClouds(string CloudsText, float Visina, float W, float H, float Speeds)
        {
            if (Atmos != null)
            {

               

                    CloudsTextureEX = CloudsText;

                    cloudsIntTex = TF.LoadTexture(CloudsText, "CloudsDDSPic" , -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_BLACK, true);
                    Atmos.Clouds_Create(1, W, H);
                    Atmos.Clouds_SetLayerParameters(0, Visina, cloudsIntTex);
                    Altitude = Visina;
                    Atmos.Clouds_SetLayerAnimation(0, true, 0.01f * Speeds, 0.01f * Speeds);
                    CloudsLayers++;
                    Speed = Speeds;
                    Width = (int)W;
                    Height = (int)H;
                



            }

        }

        public void AddClouds(string CloudsText, int layernumber, float Visina, TVLandscape Land)
        {
            if (Atmos != null)
            {

                if (layernumber < CloudsLayers)
                {

                    CloudsTextureEX = CloudsText;

                    cloudsIntTex = TF.LoadTexture(CloudsText, "CloudsDDSPic" + layernumber.ToString(), -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_BLACK, true);
                    Atmos.Clouds_Create(layernumber, (float )Land.GetLandWidth() , (float )Land.GetLandHeight() );
                    Atmos.Clouds_SetLayerParameters(layernumber, Visina, cloudsIntTex);
                    Atmos.Clouds_SetLayerAnimation(layernumber, true, 0.01f * Speed , 0.01f * Speed );
                    Altitude = Visina;
                    Width = Land.GetLandWidth();
                    Height = Land.GetLandHeight();

                    CloudsLayers++;
                }



            }

        }


        public void DrawClouds()
        {

            Atmos.Atmosphere_Render();

        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Public License Version 1.0 (CPL)


Written By
Software Developer
Croatia Croatia
Programer

Comments and Discussions