示例#1
0
 public Shaders( DirectlyLitMaterialBase Direct,
                 IndirectlyLitMaterialBase Indirect,
                 EmissiveMaterialBase Emissive,
                 TranslucentMaterialBase Translucent,
                 NormalBase Normal )
 {
     this.Direct = Direct;
     this.Indirect = Indirect;
     this.Emissive = Emissive;
     this.Translucent = Translucent;
     this.Normal = Normal;
 }
示例#2
0
        public void TestMirrorPhongSphere()
        {
            Sphere s1 = new Sphere( new Point( 1.0f, 0.0f, 3.0f ), 1.0f );
            Sphere s2 = new Sphere( new Point( -1.0f, 0.0f, 3.0f ), 1.0f );

            ConstantEmissiveMaterial es = new ConstantEmissiveMaterial( new Color3( 1.0f, 0.0f, 0.0f ) );
            IndirectlyLitMaterialBase Mirror = new PerfectSpecularIndirectMaterial( Color3.White );

            EmissiveMaterialBase[] array1 = new EmissiveMaterialBase[] { es, null };
            IndirectlyLitMaterialBase[] array2 = new IndirectlyLitMaterialBase[] { Mirror, null };

            SimpleObject so1 = new SimpleObject( s1, null, array1, null, null, null );
            SimpleObject so2 = new SimpleObject( s2, s2.CreateNormals(), null, null, array2, null );

            ListScene scene = new ListScene();
            scene.Add( so1 );
            scene.Add( so2 );

            Framebuffer fb = new Framebuffer( Color3.Black, 500, 500 );

            Cameras.Pinhole( scene, RenderMethod.RecursiveRayTrace,
                             fb, 1, 0.0001f, 0, 1.0f, true,
                             1.0f, 1.0f, 1.0f,
                             new Point( 0.0f, 0.0f, -2.0f ),
                             new Vector( 0.0f, 0.0f, 1.0f ),
                             new Vector( 0.0f, 1.0f, 0.0f ),
                             1, 1, false );

            Assert.IsTrue( Pfm.Compare( fb, 0.01f, 0.02f, "..\\..\\TestImages\\TestMirrorPhongSphere.pfm" ) );
        }