Click here to Skip to main content
15,881,424 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 Watter
    {
        private TV_PLANE Plane;             
        private int IDDUDV;                 
        //private TVRenderSurface Reflect;    
        //private TVRenderSurface Refract;
        private TVGraphicEffect FX;


        private float fTime;                
        private bool bLoop;                 
        private int IDLight;               
        private int IDMat;
        public  TVMesh Water; 

        private TVTextureFactory TF;        //This is for basic texturing functionality
        private TVMaterialFactory Mats;     //Lit meshes need a material.

        public TV_3DVECTOR PlaneNormal = new TV_3DVECTOR(0, 1, 0);

        public  string TTexture = "no";

        public Watter()
        {
            TF = new TVTextureFactory();
            Mats = new TVMaterialFactory();
            FX = new TVGraphicEffect();
        }

        public Watter(String TextureWatter)
        {
            TF = new TVTextureFactory();
            Mats = new TVMaterialFactory();
            FX = new TVGraphicEffect();
        }

        public void AddWatter(ref TVScene Scene, ref  TVRenderSurface s1,ref  TVRenderSurface s2,string Texture,TVLandscape Land,ref TVGlobals Globals)
        {

            TF.LoadDUDVTexture(Texture, "WaterDUDV", -1, -1, 50, false);
            TTexture = Texture;
            //IDDUDV = TF.LoadTexture(Texture, "Wtter");
            Water = Scene.CreateMeshBuilder("WaterMesh");
            int wi =(int)(Land.GetHeight(0, 0) + 5);
            Water.AddFloor(Globals.GetTex("WaterDUDV"), -2500, -2500, 2500, 2500, wi, -150, -150);

            s1 = Scene.CreateRenderSurface(512, 512, true);
            s2 = Scene.CreateRenderSurface(512, 512, false   );

            Plane.Normal = PlaneNormal;
            Plane.Dist = -wi;
            //s1.SetBackgroundColor(355);
            FX.SetWaterReflection(Water, s1, s2, 0, Plane);
            //FX.SetWaterReflectionColor(Water, new TV_COLOR(0.6f, 0.1f, 1, 1), new TV_COLOR(0.6f, 0.8f, 1, 1), 0.25f);
            Water.SetPosition(2000, 0, 2000);


        }

       

        public void DrawWatter()
        {

            Water.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