Exemplo n.º 1
0
 public void SetWriter(MoCapFileWriter _writer)
 {
     writer = _writer;
 }
Exemplo n.º 2
0
        private void OpenLogfile()
        {
            // save pure data
            string filename = OutputFilename.Replace("{TIMESTAMP}", System.DateTime.Now.ToString("yyyyMMdd_HHmmss"));

            writer = new MoCapFileWriter(new StreamWriter(filename));
            Debug.Log("Opened MoCap logfile '" + filename + "'");

            foreach (IMoCapWriter w in writers)
            {
                w.SetWriter(writer);
            }

            // write MOT file header
            writer
            .WriteTag(MOT_FILE_IDENTIFIER)               // header
            .Write(MOT_FILE_VERSION)                     // version
            .Write(MoCapManager.Instance.Framerate)      // framerate
            .EndLine();

            // write description section
            writer
            .WriteTag(MOT_SECTION_DESCRIPTIONS)                     // keyword
            .Write((numberOfActors * 2) + numberOfDevices)          // number of descriptions (actors *2: markerset + rigidbbody)
            .EndLine();
            int index = 0;

            foreach (IMoCapWriter w in writers)
            {
                w.WriteMarkersetDescription(ref index);
            }
            foreach (IMoCapWriter w in writers)
            {
                w.WriteRigidBodyDescription(ref index);
            }
            foreach (IMoCapWriter w in writers)
            {
                w.WriteDeviceDescription(ref index);
            }

            // start data section
            writer.WriteTag(MOT_SECTION_FRAMES).EndLine();

            // write data headers
            writer.WriteTag("#frame").WriteTag("timestamp").WriteTag("latency");
            writer.WriteTag("markersetTag").WriteTag("markersetCount");
            foreach (IMoCapWriter w in writers)
            {
                w.WriteMarkersetHeader();
            }
            writer.WriteTag("rigidbodyTag").WriteTag("rigidbodyCount");
            foreach (IMoCapWriter w in writers)
            {
                w.WriteRigidBodyHeader();
            }
            writer.WriteTag("skeletonTag").WriteTag("skeletonCount");
            writer.WriteTag("forceplateTag").WriteTag("forceplateCount");
            foreach (IMoCapWriter w in writers)
            {
                w.WriteDeviceHeader();
            }
            writer.EndLine();
        }