Ejemplo n.º 1
0
 public static Camera CreateCameraFromElement(this RElement ele)
 {
     string n = ele.Name;
     if (n == P.Cam.Pin)
     {
         Pinhole p = new Pinhole();
         p.Position = ele.Attributes[P.Pos].ToVector3();
         p.Target = ele.Attributes[P.Tar].ToVector3();
         p.Distance = ele.Attributes[P.Dist].ToFloat();
         p.Zoom = ele.Attributes[P.Zoom].ToFloat();
         p.ExposureTime = 1;
         p.SetRollAngle(ele.Attributes["RollAngle"].ToFloat());
         return p;
     }
     throw new Exception(); //create notfound excep
 }
Ejemplo n.º 2
0
 static Camera getCamera(XElement ele)
 {
     string typ = ele.Name.LocalName;
     if (typ == "Pinhole")
     {
         Pinhole hole = new Pinhole();
         hole.Position = getVector(getAttribute("Position", ele));
         hole.Target = getVector(getAttribute("Target", ele));
         hole.Distance = float.Parse(getAttribute("Distance", ele));
         hole.Zoom = float.Parse(getAttribute("Zoom", ele));
         hole.ExposureTime = float.Parse(getAttribute("ExposureTime", ele));
         hole.SetRollAngle(float.Parse(getAttribute("RollAngle", ele)));
         return hole;
     }
     throw new ElementNotFound("Camera");
 }