コード例 #1
0
            protected static XElement GetTAGLEntry(SubStream data, int index, string name)
            {
                int     ofs       = index * 84;
                string  tagname   = data.GetString(ofs + 0, 48);
                Vector4 attachpos = RootTransform * new Vector4(data.GetSingle(ofs + 48), data.GetSingle(ofs + 52), data.GetSingle(ofs + 56), 1.0);
                Vector4 fwdvector = RootTransform * new Vector4(data.GetSingle(ofs + 60), data.GetSingle(ofs + 64), data.GetSingle(ofs + 68), 0.0);
                Vector4 upvector  = RootTransform * new Vector4(data.GetSingle(ofs + 72), data.GetSingle(ofs + 76), data.GetSingle(ofs + 80), 0.0);

                return(new XElement("IMDL_TAG",
                                    new XAttribute("name", tagname),
                                    new XElement("Position", String.Format("{0,12:F6} {1,12:F6} {2,12:F6}", attachpos.X, attachpos.Y, attachpos.Z)),
                                    new XElement("Forward", String.Format("{0,12:F6} {1,12:F6} {2,12:F6}", fwdvector.X, fwdvector.Y, fwdvector.Z)),
                                    new XElement("Up", String.Format("{0,12:F6} {1,12:F6} {2,12:F6}", upvector.X, upvector.Y, upvector.Z))
                                    ));
            }
コード例 #2
0
            protected static XElement GetHEADData(SubStream data, string name)
            {
                int   v1           = data.GetInt32(0);
                float v2           = data.GetSingle(4);
                float v3           = data.GetSingle(8);
                float v4           = data.GetSingle(12);
                float v5           = data.GetSingle(16);
                float v6           = data.GetSingle(20);
                float v7           = data.GetSingle(24);
                float v8           = data.GetSingle(28);
                float lodhimindist = data.GetSingle(32);
                float lodhimaxdist = data.GetSingle(36);
                float lodlomindist = data.GetSingle(40);
                float lodlomaxdist = data.GetSingle(44);
                int   v13          = data.GetInt32(48);

                return(new XElement("IMDL_HEAD",
                                    new XElement("v1", v1),
                                    new XElement("vf", String.Format("{0,12:F6} {1,12:F6} {2,12:F6} {3,12:F6} {4,12:F6} {5,12:F6} {6,12:F6}", v2, v3, v4, v5, v6, v7, v8)),
                                    new XElement("LOD",
                                                 new XAttribute("level", "high"),
                                                 new XAttribute("mindist", lodhimindist),
                                                 new XAttribute("maxdist", lodhimaxdist)
                                                 ),
                                    new XElement("LOD",
                                                 new XAttribute("level", "low"),
                                                 new XAttribute("mindist", lodlomindist),
                                                 new XAttribute("maxdist", lodlomaxdist)
                                                 ),
                                    new XElement("Flags", v13)
                                    ));
            }
コード例 #3
0
 protected static XElement GetCOLRData(SubStream data)
 {
     return(new XElement("IMDL_COLR",
                         new XAttribute("count", data.Length / 4),
                         String.Join(" ", Enumerable.Range(0, (int)(data.Length / 4)).Select(i => data.GetSingle(i * 4)))
                         ));
 }