public void addLightSourceTag(Scientrace.LightSource anObject, XElement xel) { XAttribute tag = xel.Attribute("Tag"); if (tag != null) { anObject.tag = tag.Value; } }
public Scientrace.LightSource parseXLight(XElement xlight, Scientrace.Object3dEnvironment env) { Scientrace.LightSource retlight = null; string lightclass; try { lightclass = xlight.Attribute("Class").Value; } catch { throw new XMLException("Light class type not specified"); } // XMLTraceModifierParser xtmp = new XMLTraceModifierParser(xlight, this.X); XMLTraceModifierParser xtmp = new XMLTraceModifierParser(); ShadowLightSourceConstruct slsc = new ShadowLightSourceConstruct(); switch (lightclass) { case "SingleRay": List <Scientrace.UniformTraceModifier> utms = xtmp.getModifiers(xlight); retlight = this.setSingleRayFromXData(xlight, utms, env); break; //case "CustomTraces": //retlight = this.setCustomTracesLightFromXData(xlight, env); //break; case "TestLight": //Console.WriteLine("TESTLightsource"); retlight = this.setTestLightFromXData(xlight, env); break; case "RandomCylinder": Console.WriteLine("Random Cylinder Lightsource"); retlight = this.setRandomCylinderLightFromXData(xlight, env); break; // case "Spiral": // case "RandomSquare": default: // No old style LightSource parsing class found? Good, let's hope there's a prettier ShadowClass constructor to do this. if (slsc.getClass(lightclass) != null) { retlight = slsc.constructLightSource(xlight, env); break; } else //damnit, there wasn't a ShadowClass constructor either. { throw new XMLException("unknown light class type"); } } this.addLightSourceTag(retlight, xlight); /* Generic (not lightsource-subclass specific) behaviour */ retlight.max_interactions = this.X.getXInt(xlight.Attribute("MaxInteractions"), 15); //this.lightsource.minimum_intensity = this.X.getXDouble(xlight.Attribute("MinIntensity"), 0.10); //line above fails for sources with < 1 intensities. return(retlight); }
public new Scientrace.LightSource factory() { /* NO LONGER TRUE DUE TO ADDITION OF CUSTOMTRACES * //Special property removed at 20151021 * if (this.spectrum==null) { * throw new ArgumentNullException("A ShadowLightSource cannot be factorized when spectrum==null for Shadowtype "+this.typeString()); * } */ Scientrace.LightSource a = (Scientrace.LightSource)base.factory(); return(a); }
public void writeLightsourceDumpXML(Scientrace.LightSource aLightsource) { DateTime start_time = DateTime.Now; XElement xlight = aLightsource.exportCustomTracesXML(); string filename = this.xml_export_filename.Replace("%o", aLightsource.tag); if (this.xml_export_lightsources) { this.writeExportDataToFile(xlight.ToString(), filename, aLightsource.tag + "-custromtraces-XML", start_time); } if (this.xml_display_lightsource) { Console.WriteLine(xlight.ToString()); } }
public void registerLightSource(Scientrace.LightSource lightsource) { this.registeredLightSources.Add(lightsource); }
public void setLightSource(Scientrace.LightSource light) { this.lightsource = light; }