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