public void ClipGeometry()
        {
            GMesh temp_gm = null;

            // Save the light data before it gets lost during clipping
            var light_storage = new List <GLight>();

            for (int i = 0, num_lights = this.m_light.Count; i < num_lights; ++i)
            {
                var light_copy = new GLight(this.m_light[i]);
                light_storage.Add(light_copy);
            }
            this.m_light.Clear();

            for (int i = 0; i < (int)EdgeOrder.NUM; i++)
            {
                if (m_clip_plane[i].visible)
                {
                    temp_gm = ClipGeometryToPlane(m_clip_plane[i]);
                    Copy(temp_gm);
                }
            }

            // Restore the light data
            // TODO(Jeff): What if the light should be clipped away?
            for (int i = 0, num_lights = light_storage.Count; i < num_lights; ++i)
            {
                this.m_light.Add(light_storage[i]);
            }
        }
 public GLight(GLight other)
 {
     if (other != null)
     {
         this.Copy(other);
     }
 }
 public void Copy(GLight other)
 {
     this.m_position    = other.m_position;
     this.m_orientation = other.m_orientation;
     this.m_style       = other.m_style;
     this.m_flare       = other.m_flare;
     this.m_color_index = other.m_color_index;
     this.m_intensity   = other.m_intensity;
     this.m_range       = other.m_range;
     this.m_spot_angle  = other.m_spot_angle;
 }
        public GLight AddPointLight(Vector3 pos, LightFlare flare, int color_index, float intensity, float range, bool shadow = true)
        {
            GLight l = new GLight();

            l.m_style       = (shadow ? LightStyle.POINT : LightStyle.POINT_NO_SHADOW);
            l.m_flare       = flare;
            l.m_color_index = color_index;
            l.m_intensity   = intensity;
            l.m_range       = range;
            l.m_position    = pos;
            this.m_light.Add(l);
            return(l);
        }
        public GLight AddSpotLight(Vector3 pos, Matrix4 orient, float spot_angle, LightFlare flare, int color_index, float intensity, float range, bool shadow = true)
        {
            GLight l = new GLight();

            l.m_style       = (shadow ? LightStyle.SPOT : LightStyle.SPOT_NO_SHADOW);
            l.m_flare       = flare;
            l.m_color_index = color_index;
            l.m_intensity   = intensity;
            l.m_range       = range;
            l.m_spot_angle  = spot_angle;
            l.m_position    = pos;
            l.m_orientation = orient;
            this.m_light.Add(l);
            return(l);
        }