Example #1
0
 public LightEmitter(string name, GameComponent parent, Matrix localTransform, Vector3 boundingBoxExtents, Vector3 boundingBoxPos, float intensity, float range) :
     base(parent.Manager, name, parent, localTransform, boundingBoxExtents, boundingBoxPos)
 {
     Light = new DynamicLight(intensity, range);
 }
Example #2
0
        public byte GetIntensity(DynamicLight light, byte lightIntensity, Voxel voxel)
        {
            Vector3 vertexPos = voxel.Position;
            Vector3 diff = vertexPos - (light.Position + new Vector3(0.5f, 0.5f, 0.5f));
            float dist = diff.LengthSquared() * 2;

            return (byte) (int) ((Math.Min(1.0f / (dist + 0.0001f), 1.0f)) * (float) light.Intensity);
        }
Example #3
0
 public LightEmitter(string name, GameComponent parent, Matrix localTransform, Vector3 boundingBoxExtents, Vector3 boundingBoxPos, float intensity, float range)
     : base(name, parent, localTransform, boundingBoxExtents, boundingBoxPos)
 {
     Light = new DynamicLight(intensity, range);
 }