Exemple #1
0
 public static AreaLight CreateAreaLight(Transform lightToWorld, ParameterSet paramSet, IShape shape)
 {
     Spectrum L = paramSet.FindOneSpectrum ("L", new Spectrum (1.0));
     Spectrum sc = paramSet.FindOneSpectrum ("scale", new Spectrum (1.0));
     int nSamples = paramSet.FindOneInt ("nsamples", 1);
     return new DiffuseAreaLight (lightToWorld, L * sc, nSamples, shape);
 }
Exemple #2
0
        public ShapeSet(IShape shape)
        {
            Areas = new List<double> ();
            Shapes = new List<IShape> ();
            List<IShape> todo = new List<IShape> ();
            todo.Add (shape);
            while (todo.Count > 0)
            {
                IShape sh = todo[todo.Count - 1];
                todo.RemoveAt (todo.Count - 1);
                if (sh.CanIntersect)
                    Shapes.Add (sh);
                else
                    sh.Refine (ref todo);
            }

            SumArea = 0.0;
            foreach (IShape s in Shapes)
            {
                double area = s.Area;
                Areas.Add (area);
                SumArea += area;
            }

            AreaDistribution = new Distribution1D (Areas, Areas.Count);
        }
Exemple #3
0
 public DiffuseAreaLight(Transform lightToWorld, Spectrum Le, int ns, IShape shape)
     : base(lightToWorld, ns)
 {
     Lemit = Le;
     ShapeSet = new ShapeSet (shape);
     area = ShapeSet.Area;
 }
 public DifferentialGeometry()
 {
     p = new Point ();
     n = new Normal ();
     dpdu = new Vector ();
     dpdv = new Vector ();
     dndu = new Normal ();
     dndv = new Normal ();
     dpdx = new Vector ();
     dpdy = new Vector ();
     u = v = 0.0;
     dudx = dudy = dvdx = dvdy = 0.0;
     Shape = null;
 }
 public DifferentialGeometry(DifferentialGeometry dg)
 {
     this.p = new Point (dg.p);
     this.dpdu = new Vector (dg.dpdu);
     this.dpdv = new Vector (dg.dpdv);
     this.dndu = new Normal (dg.dndu);
     this.dndv = new Normal (dg.dndv);
     this.n = new Normal (dg.n);
     this.u = dg.u;
     this.v = dg.v;
     this.dudx = dg.dudx;
     this.dvdx = dg.dvdx;
     this.dudy = dg.dudy;
     this.dvdy = dg.dvdy;
     this.Shape = dg.Shape;
 }
        public DifferentialGeometry(Point p, Vector dpdu, Vector dpdv, Normal dndu, Normal dndv, double u, double v, IShape shape)
        {
            this.p = new Point (p);
            this.dpdu = new Vector (dpdu);
            this.dpdv = new Vector (dpdv);
            this.dndu = new Normal (dndu);
            this.dndv = new Normal (dndv);
            this.n = new Normal ((dpdu % dpdv).Normalized);
            this.u = u;
            this.v = v;
            dudx = dvdx = dudy = dvdy = 0.0;
            this.Shape = shape;

            if (shape != null && (shape.ReverseOrientation ^ shape.TransformSwapsHandedness))
                n *= -1.0;
        }
Exemple #7
0
 public static AreaLight CreateAreaLight(string name, Transform objectToWorld, ParameterSet parameters, IShape shape)
 {
     AreaLightPlugin plugin = new AreaLightPlugin (name);
     return plugin.CreateAreaLight (objectToWorld, parameters, shape);
 }
 public GeometricPrimitive(IShape shape, IMaterial material, AreaLight areaLight)
 {
     this.Shape = shape;
     this.Material = material;
     this.areaLight = areaLight;
 }