Ejemplo n.º 1
0
 public SamplingState(RectangleLightSource src, RandomJames _rnd)
 {
     source = src;
     rnd    = _rnd;
     permU  = new RandomJames.Permutation();
     permV  = new RandomJames.Permutation();
     rank   = total = 0;
 }
Ejemplo n.º 2
0
        public static void TestScene(IRayScene sc, string param)
        {
            Debug.Assert(sc != null);

            // CSG scene:
            CSGInnerNode root = new CSGInnerNode(SetOperation.Union);

            root.SetAttribute(PropertyName.REFLECTANCE_MODEL, new PhongModel());
            root.SetAttribute(PropertyName.MATERIAL, new PhongMaterial(new double[] { 1.0, 0.8, 0.1 }, 0.1, 0.7, 0.2, 128));
            sc.Intersectable = root;

            // Background color:
            sc.BackgroundColor = new double[] { 0.0, 0.05, 0.07 };

            // Camera:
            sc.Camera = new StaticCamera(new Vector3d(0.7, 0.5, -5.0),
                                         new Vector3d(0.0, -0.28, 1.0),
                                         50.0);

            // Light sources:
            sc.Sources = new LinkedList <ILightSource>();
            sc.Sources.Add(new AmbientLightSource(0.8));
            //sc.Sources.Add( new PointLightSource( new Vector3d( -5.0, 4.0, -3.0 ), 1.2 ) );

            /* */
            // horizontal stick source:
            //RectangleLightSource rls = new RectangleLightSource( new Vector3d( -5.0, 4.0, -6.0 ),
            //                                                     new Vector3d( 0.0, 0.0, 6.0 ),
            //                                                     new Vector3d( 0.0, 0.1, 0.0 ), 1.8 );
            // vertical stick source:
            RectangleLightSource rls = new RectangleLightSource(new Vector3d(-5.0, 1.0, -3.0),
                                                                new Vector3d(0.0, 0.0, 0.1),
                                                                new Vector3d(0.0, 6.0, 0.0), 1.8);

            // rectangle source:
            //RectangleLightSource rls = new RectangleLightSource( new Vector3d( -5.0, 1.0, -6.0 ),
            //                                                     new Vector3d( 0.0, 0.0, 6.0 ),
            //                                                     new Vector3d( 0.0, 6.0, 0.0 ), 1.8 );
            rls.Dim = new double[] { 1.0, 0.05, 0.0 };
            sc.Sources.Add(rls);
            /* */

            // --- NODE DEFINITIONS ----------------------------------------------------

            // Sphere:
            Sphere s = new Sphere();

            root.InsertChild(s, Matrix4d.Identity);

            // Infinite plane with checker:
            Plane pl = new Plane();

            pl.SetAttribute(PropertyName.COLOR, new double[] { 0.3, 0.0, 0.0 });
            pl.SetAttribute(PropertyName.TEXTURE, new CheckerTexture(0.6, 0.6, new double[] { 1.0, 1.0, 1.0 }));
            root.SetAttribute(PropertyName.MATERIAL, new PhongMaterial(new double[] { 1.0, 0.8, 0.1 }, 0.1, 0.3, 0.7, 16));
            root.InsertChild(pl, Matrix4d.RotateX(-MathHelper.PiOver2) * Matrix4d.CreateTranslation(0.0, -1.0, 0.0));
        }
Ejemplo n.º 3
0
 public SamplingState( RectangleLightSource src, RandomJames _rnd )
 {
     source = src;
     rnd = _rnd;
     permU = new RandomJames.Permutation();
     permV = new RandomJames.Permutation();
     rank = total = 0;
 }