Click here to Skip to main content
15,885,435 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.4K   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 Flor
    {
        TVMesh mFlor;
        TVLandscape Land;
        TVTextureFactory TextureFactory;
        int IDDiffuse;
        private TVTextureFactory TF;
        public Flor(ref gefxs GE,string Texture, ref TVPhysics TVP)
        {
            TextureFactory = new TVTextureFactory();
            TextureFactory.LoadTexture(Texture, "EngineFlorTexture", -1, -1);
            mFlor = (TVMesh)GE.Scene.CreateMeshBuilder("EngineFlor");
            mFlor.AddFloor(GE.Globals.GetTex("EngineFlorTexture"), -500.0f, -500 - 0f, 500.0f, 500.0f, 0.0f, 1, 1, true);
            TVP.CreateStaticMeshBody(mFlor);

            
        }

        public Flor(ref gefxs GE, string Texture, ref TVPhysics TVP, string Hmap, ref TVScene Scene)
        {
            TF = new TVTextureFactory();

            Land = new TVLandscape();
            IDDiffuse = TF.LoadTexture(Texture, "LandDiffuseTextureXYZ", -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_NO, true);

           Land = Scene.CreateLandscape("TerrainBasic");
           Land.SetAffineLevel(CONST_TV_LANDSCAPE_AFFINE.TV_AFFINE_HIGH);

           float x1 = Land.GetLandHeight() / 2;
           float z1 = Land.GetLandWidth() / 2;

           Land.GenerateTerrain(Hmap,
               CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_AVERAGE,
               4, 4, x1, 0, z1, true);
           Land.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_MANAGED);
           Land.SetTexture(IDDiffuse, -1);
           Land.SetTextureScale(4, 4, -1);

           TVP.CreateStaticTerrainBody(Land);


        }

        public void DrawFlor()
        {
            if (mFlor != null)
            {

                mFlor.Render();
            }

            if (Land != null)
            {

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