Click here to Skip to main content
12,350,134 members (26,848 online)
Click here to Skip to main content
Articles » Multimedia » DirectX » Games » Downloads

Stats

27.6K 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 Light
    {
       TVMesh LightNode;
       TV_3DVECTOR LightDirection= new TV_3DVECTOR(0,0,0);

       public float LightRadius = 360.0f;

       public struct LightRGB
       {
           public float Red;
           public float Green;
           public float Blue;


       }
       public enum LightType
       {
           pointlight


       };
        private TVMaterialFactory Mats; 
        private TVLightEngine Lights;
        private int IDLight;


        public Light(ref TVScene Scene, LightType Type,TV_3DVECTOR LightPointPosition)
        {

            Lights = new TVLightEngine();
            LightNode = new TVMesh();
            LightNode = Scene.CreateMeshBuilder("light mark");
            LightNode.CreateSphere(0.25f, 4, 4);
            LightNode.SetPosition(LightPointPosition.x, LightPointPosition.y, LightPointPosition.z );

            if (Type == LightType.pointlight)
            {
                IDLight = Lights.CreatePointLight(LightPointPosition , 1, 1, 1, LightRadius , "simple_point_lightKonstruktor", 1);
                

            }


        }

        public void SetLightPosition(TV_3DVECTOR LightPointPosition)
        {
            LightNode.SetPosition(LightPointPosition.x, LightPointPosition.y, LightPointPosition.z);
            Lights.SetLightPosition(IDLight, LightPointPosition.x,
                LightPointPosition.y, LightPointPosition.z);


        }

        public TV_3DVECTOR GetLightPosition()
        {

            return LightNode.GetPosition();
        }

        public void SetLightDirection(TV_3DVECTOR LightPointDirection)
        {
            Lights.SetLightDirection(IDLight, LightPointDirection.x, LightPointDirection.y, LightPointDirection.z);
            LightDirection = LightPointDirection;
        }
        public TV_3DVECTOR GetLightDirection()
        {
            return LightDirection;

        }

        public void RenderLight()
        {

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

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