Beispiel #1
0
        public DirectionalLight(Vector3 direction, RealColor colour, WorldBounds bounds, float _power)
        {
            this.Direction = direction;
            this.color     = colour.Copy();

            this.bounds = bounds;

            power = _power;
        }
Beispiel #2
0
        public DiffuseLight(Vertex[] triangle, RealColor color, float power)
        {
            a = triangle[0]; b = triangle[1]; c = triangle[2];

            this.color = color.Copy();

            this.power = power;
            Normal     = RadiosityHelper.ComputeTriangleNormal(a, b, c);
            Center     = Vector3.BaryCentric(a.position, b.position, c.position, 0.333333f, 0.333333f);
        }
Beispiel #3
0
        /// <summary>
        /// Constructs a diffuse light.
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="colour"></param>
        public RadiosityLight(Vector3 direction, RealColor colour, WorldBounds bounds, int pointCount)
        {
            this.m_randomNumberGen = new Random();
            this.m_direction       = direction;
            this.m_colour          = colour.Copy();

            // Create DX3D version:
            this.m_light      = new Light();
            this.m_light.Type = LightType.Directional;

            /*this.m_light.Diffuse = Color.FromArgb((int)(m_colour[0] * 255),
             *  (int)(m_colour[1] * 255),
             *  (int)(m_colour[2] * 255));*/
            this.m_light.Direction = this.m_direction;

            this.bounds     = bounds;
            this.pointCount = pointCount;
            width           = bounds.X.Upper - bounds.X.Lower;
            height          = bounds.Y.Upper - bounds.Y.Lower;
        }
Beispiel #4
0
        /// <summary>
        /// Constructs a spot light.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="direction"></param>
        /// <param name="colour"></param>
        /// <param name="power"></param>
        public RadiosityLight(Vector3 position, Vector3 direction, RealColor colour, float power)
        {
            this.m_randomNumberGen = new Random();
            this.m_position        = position;
            this.m_direction       = direction;
            m_colour = colour.Copy();
            //this.m_colour = colour;
            this.m_power = power;

            // Create DX version.
            this.m_light         = new Light();
            this.m_light.Type    = LightType.Spot;
            this.m_light.Diffuse = System.Drawing.Color.FromArgb((int)m_colour[0],
                                                                 (int)m_colour[1],
                                                                 (int)m_colour[2]);
            this.m_light.Position       = m_position;
            this.m_light.Direction      = m_direction;
            this.m_light.Range          = 1.0f;
            this.m_light.InnerConeAngle = 0.5f;
            this.m_light.OuterConeAngle = 1.0f;
            this.m_light.Falloff        = 1.0f;
            this.m_light.Attenuation0   = m_power;
        }
Beispiel #5
0
 /// <summary>
 /// Creates a photon, usually created by a light source.
 /// </summary>
 /// <param name="position">Position of photon.</param>
 /// <param name="direction">Initial direction of photon.</param>
 /// <param name="color">Colour of photon</param>
 public Photon(Vector3 position, Vector3 direction, RealColor color)
 {
     this.m_position  = position;
     this.m_direction = direction;
     this.m_colour    = color.Copy();
 }