Ejemplo n.º 1
0
 public Scene(RGBColor iamb, NameableCollection<Light> lights, Camera defaultCamera, float refractIndice)
 {
     this.IAmb = iamb;
     this.RefractIndex = refractIndice;
     if (lights != null) {
         this.Lights = new NameableCollection<Light>(lights);
     } else {
         this.Lights = new NameableCollection<Light>();
     }
     this.primitives = new NameableCollection<Primitive>();
     this.AccelerationStructure = new KDTreePrimitiveManager(this.primitives as IList<Primitive>);
     this.materials = new NameableCollection<Material>();
     this.DefaultCamera = defaultCamera;
     this.Cameras = new NameableCollection<Camera>();
     if (defaultCamera != null) {
         this.Cameras.Add(defaultCamera);
     }
     this.sampler = new JitteredSampler();
     this.shader = new PhongShader(this);
     this.renderStrategy = new ScanlineRenderStrategy();
     this.isShadowActive = false;
     this.softShadowSamples = 8;
     this.glossySamples = 8;
     //this.cameras.CollectionChanged += new NotifyCollectionChangedEventHandler<Camera>(cameras_CollectionChanged);
 }
Ejemplo n.º 2
0
 public Scene(Scene toCopy)
 {
     if (toCopy != null) {
         this.defaultCamera = toCopy.defaultCamera;
         this.IAmb = toCopy.iAmb;
         this.refractIndex = toCopy.refractIndex;
         this.lights = new NameableCollection<Light>(toCopy.lights);
         this.primitives = new NameableCollection<Primitive>(toCopy.primitives);
         this.materials = new NameableCollection<Material>(toCopy.materials);
         this.cameras = new NameableCollection<Camera>(toCopy.cameras);
         this.isShadowActive = toCopy.isShadowActive;
         this.isSoftShadowActive = toCopy.isSoftShadowActive;
         this.softShadowSamples = toCopy.softShadowSamples;
         this.glossySamples = toCopy.glossySamples;
         this.IsEnvironmentMapped = toCopy.IsEnvironmentMapped;
         this.EnvironmentMap = toCopy.environmentMap;
         this.backgroundColor = toCopy.backgroundColor;
         if (toCopy.sampler != null) {
             this.sampler = new JitteredSampler(toCopy.sampler.NumberOfSamples, toCopy.sampler.NumberOfSets);
         }
     }
 }