Click here to Skip to main content
12,449,762 members (22,753 online)
Click here to Skip to main content
Articles » Multimedia » DirectX » Games » Downloads

Stats

27.9K views
1.4K downloads
34 bookmarked
Posted

Game Engine

, 20 Nov 2009 CPL
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)

Share

About the Author

Member 3873633
Software Developer
Croatia Croatia
Programer

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 20 Nov 2009
Article Copyright 2009 by Member 3873633
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid