Beispiel #1
0
        public static void readCameraSettings(XElement x3d_or_xenv_element)
        {
            CustomXMLDocumentOperations X = new CustomXMLDocumentOperations();

            Scientrace.Vector cameraviewpoint = Scientrace.TraceJournal.Instance.cameraviewpoint;
            Scientrace.Vector camrotationvec  = Scientrace.TraceJournal.Instance.camrotationvector;
            Scientrace.TraceJournal.Instance.labelaxes = X.getXBool(x3d_or_xenv_element, "DrawAxes", Scientrace.TraceJournal.Instance.labelaxes);
            double   camrotationangle = Scientrace.TraceJournal.Instance.camrotationangle;
            XElement camfrom          = (x3d_or_xenv_element == null? null:x3d_or_xenv_element.Element("CameraFrom"));
            XElement camrot           = (x3d_or_xenv_element == null? null:x3d_or_xenv_element.Element("CameraRotation"));

            if (camfrom != null)
            {
                cameraviewpoint = X.getXNzVector(camfrom);
                Scientrace.Vector        camdirvec = cameraviewpoint.negative();
                Scientrace.NonzeroVector defvec    = new Scientrace.NonzeroVector(0, 0, -1);
                camrotationangle = defvec.angleWith(camdirvec);
                camrotationvec   = defvec.crossProduct(camdirvec);
            }
            if (camrot != null)
            {
                camrotationvec   = X.getXVectorByName(camrot, "Vector");
                camrotationangle = X.getXAngleByName(camrot, "Angle");
            }
            Scientrace.TraceJournal.Instance.cameraviewpoint  = X.getXVectorByName(x3d_or_xenv_element, "CameraViewpoint", cameraviewpoint);
            Scientrace.TraceJournal.Instance.camrotationangle = camrotationangle;
            if (camrotationvec != null)
            {
                Scientrace.TraceJournal.Instance.camrotationvector = camrotationvec;
            }
        }
 public static void readCameraSettings(XElement x3d_or_xenv_element)
 {
     CustomXMLDocumentOperations X = new CustomXMLDocumentOperations();
     Scientrace.Vector cameraviewpoint = Scientrace.TraceJournal.Instance.cameraviewpoint;
     Scientrace.Vector camrotationvec = Scientrace.TraceJournal.Instance.camrotationvector;
     Scientrace.TraceJournal.Instance.labelaxes = X.getXBool(x3d_or_xenv_element, "DrawAxes", Scientrace.TraceJournal.Instance.labelaxes);
     double camrotationangle = Scientrace.TraceJournal.Instance.camrotationangle;
     XElement camfrom = (x3d_or_xenv_element == null? null:x3d_or_xenv_element.Element("CameraFrom"));
     XElement camrot = (x3d_or_xenv_element == null? null:x3d_or_xenv_element.Element("CameraRotation"));
     if (camfrom !=null) {
     cameraviewpoint = X.getXNzVector(camfrom);
     Scientrace.Vector camdirvec = cameraviewpoint.negative();
     Scientrace.NonzeroVector defvec = new Scientrace.NonzeroVector(0,0,-1);
     camrotationangle = defvec.angleWith(camdirvec);
     camrotationvec = defvec.crossProduct(camdirvec);
     }
     if (camrot != null) {
     camrotationvec = X.getXVectorByName(camrot, "Vector");
     camrotationangle = X.getXAngleByName(camrot, "Angle");
     }
     Scientrace.TraceJournal.Instance.cameraviewpoint = X.getXVectorByName(x3d_or_xenv_element, "CameraViewpoint", cameraviewpoint);
     Scientrace.TraceJournal.Instance.camrotationangle = camrotationangle;
     if (camrotationvec != null)
     Scientrace.TraceJournal.Instance.camrotationvector = camrotationvec;
 }