Esempio n. 1
0
    internal static T Decode <T>(this Oni.InstanceDescriptor des)
    {
        List <IGenericMemberAcessor> l_members = new List <IGenericMemberAcessor>();
        T l_val = default(T);

        l_members.Add(new MemberAcess <T>(u => l_val = u, () => l_val, typeof(T).Name));
        Oni.Action <Oni.InstanceDescriptor> l_ides = null;
        System.Xml.XmlWriter l_w = new SWAGGYXmlWriter(l_members.GetEnumerator());
        l_ides = u =>
        {
            try
            {
                Debug.LogWarning("complex object : " + u.Name);
                Oni.Xml.GenericXmlWriter.Write(l_w, l_ides, u);
            }
            catch (System.Exception ee)
            {
                //Debug.Log(ee);
                //Debug.Log(des.IsPlaceholder);
            }
        };
        Oni.Xml.GenericXmlWriter.Write(l_w, l_ides, des);
        l_w.Flush();
        return(l_val);
    }
Esempio n. 2
0
 static void UseONLV(Oni.InstanceDescriptor ides)
 {
     Round2.ONLV l_onlv = ides.Decode <Round2.ONLV>();
     Debug.Log(l_onlv);
     Debug.Log(l_onlv.Environment);
     Debug.Break();
     Debug.DebugBreak();
     //Debug.Log((l_onlv = DeserializeAs<Round2.ONLV>(ides.AsXmlStream())).Environment.AKEV.Quads.AGQG.Quads[0].Points.Length);
     //l_onlv.InitEnv();
 }
Esempio n. 3
0
 internal static void RegisterDoorClass(Oni.InstanceDescriptor ides)
 {
     //if (ides != null)
     {
         if (ides.Template.Tag == Oni.TemplateTag.DOOR)
         {
             m_doorClassReg.Add(ides.Name, BinaryDatReader.ConvertInstance <DOOR>(ides));
             //Debug.Log("Registered door class : [" + ides.Name + "]");
         }
     }
 }
Esempio n. 4
0
    static System.Func <Round2.BinaryInitializable> InitializeLoader(int id, Oni.InstanceDescriptor ides, string resultTypeName)
    {
        try
        {
            if (ides.IsPlaceholder)
            {
                return(null);
            }

            Oni.BinaryReader reader = ides.OpenRead();
            Oni.InstanceFile l_file = ides.File;
            //using ()
            {
                List <byte> l_bytes = new List <byte>(System.BitConverter.GetBytes(ides.Index));
                l_bytes.AddRange(System.BitConverter.GetBytes(-1));//re-define for current level usage
                //Oni.BinaryReader l_reader = null;
                l_bytes.AddRange(reader.ReadBytes(ides.DataSize));
                System.Type l_t   = typeof(Round2.BinaryInitializable).Assembly.GetType(resultTypeName);//add Round2.Generated.Binary. before typename!
                object      l_res = System.Activator.CreateInstance(l_t);
                m_bytesUsed += l_bytes.Count;
                (l_res as Round2.BinaryInitializable).m_sourceFile = l_file;

                System.Func <Round2.BinaryInitializable> l_resultingLoader = () =>
                {
                    try
                    {
                        (l_res as Round2.BinaryInitializable).Convert(l_bytes.ToArray());
                        m_descriptors.Remove(ides);
                        m_descriptors.Add(ides, () => l_res as Round2.BinaryInitializable);
                        return(l_res as Round2.BinaryInitializable);
                    }
                    catch (System.Exception ee)
                    {
                        if (ee is System.IndexOutOfRangeException)
                        {
                            Debug.LogError("! bytes[" + l_bytes.Count + "]");
                        }

                        throw;
                    }
                };

                m_descriptors.Add(ides, l_resultingLoader);
                return(l_resultingLoader);
            }
            reader.Dispose();
        }
        catch (System.Exception ee)
        {
            Debug.Log("Exception at id : " + id + "\n" + ee.ToString() + "\n" + ee.InnerException);
        }

        return(null);
    }
Esempio n. 5
0
    static void UseTXMP(Oni.InstanceDescriptor ides)
    {
        Texture2D l_tex = null;

        if ((l_tex = ObtainTXFrom(ides)) != null)
        {
            Texture2DQuery.Loaded(ides.Index, l_tex);
            Debug.Log(ides.Decode <Round2.TXMP>());
            //DeserializeAs<Round2.TXMP>(ides.AsXmlStream());
        }

        //Debug.Log(ides.Name);
    }
Esempio n. 6
0
    internal static MemoryStream AsXmlStream(this Oni.InstanceDescriptor des)
    {
        DateTime l_dt = DateTime.Now;

        Debug.LogWarning(des.DataSize);
        MemoryStream l_ms = new MemoryStream(des.DataSize);

        Round2.TXMP l_v = null;
        List <IGenericMemberAcessor> l_stt = new List <IGenericMemberAcessor>();

        l_stt.Add
        (
            new MemberAcess <Round2.TXMP>
            (
                u =>
        {
            l_v = u;
        },
                () => l_v,
                "TXMP"
            )
        );

        System.Xml.XmlWriter l_w = new SWAGGYXmlWriter(l_stt.GetEnumerator());//System.Xml.XmlWriter.Create(l_ms);
        Oni.Action <Oni.InstanceDescriptor> l_ides = null;
        l_ides = u =>
        {
            try
            {
                Oni.Xml.GenericXmlWriter.Write(l_w, l_ides, u);
            }
            catch (System.Exception ee)
            {
                throw;
                //Debug.Log(ee);
                //Debug.Log(des.IsPlaceholder);
            }
        };
        Oni.Xml.GenericXmlWriter.Write(l_w, l_ides, des);
        l_w.Flush();
        l_ms.Seek(0, SeekOrigin.Begin);
        Debug.Log("ASXMLSTREAM : " + (DateTime.Now - l_dt));
        return(l_ms);
    }
Esempio n. 7
0
    static internal Texture2D ObtainTXFrom(Oni.InstanceDescriptor txca)
    {
        //Debug.Log(txca.Index);
        {
            try
            {
                Oni.Motoko.Texture  l_rtex       = Oni.Motoko.TextureDatReader.Read(txca);
                Texture2D           l_t          = new Texture2D(l_rtex.Width, l_rtex.Height, TextureFormat.RGBA32, true);
                Oni.Imaging.Surface l_s          = l_rtex.Surfaces[0].Convert(Oni.Imaging.SurfaceFormat.RGBA);
                List <byte>         l_colorBytes = new List <byte>();
                List <Color32>      l_colors     = new List <Color32>();

                foreach (byte b in l_s.Data)
                {
                    l_colorBytes.Add(b);

                    if (l_colorBytes.Count == 4)
                    {
                        l_colors.Add(new Color32(l_colorBytes[0], l_colorBytes[1], l_colorBytes[2], l_colorBytes[3]));
                        l_colorBytes.Clear();
                    }
                }

                l_t.name = txca.Name;
                l_t.SetPixels32(l_colors.ToArray());
                l_t.Apply(true);
                //Debug.Log(l_t +"|"+txca.Index, l_t);
                return(l_t);
            }
            catch (System.Exception ee)
            {
                Debug.LogError("TXCA id : " + txca.Index + "\nName:" + txca.Name + "\n" + ee.ToString());
                return(null);
            }
        }
    }
Esempio n. 8
0
    internal static T ConvertInstance <T>(Oni.InstanceDescriptor ides)
        where T : Round2.BinaryInitializable
    {
        if (!m_descriptors.ContainsKey(ides))
        {
            System.Func <Round2.BinaryInitializable> l_initializer = InitializeLoader(ides.Index, ides, "Round2.Generated.Binary." + typeof(T).Name);


            if (ides.Template.Tag == Oni.TemplateTag.BINA)
            {
                try
                {
                    //ParseBINA2(l_initializer(), ides);
                    ParseBINA(l_initializer(), ides);
                }
                catch (System.Exception ee)
                {
                    Debug.LogError(ee.ToString());
                }
            }
        }

        return((T)m_descriptors[ides]());
    }
Esempio n. 9
0
 static void UseDOOR(Oni.InstanceDescriptor ides)
 {
     Round2.DOOR des = DeserializeAs <Round2.DOOR>(ides.AsXmlStream());
     Debug.Log(des.id);
 }
Esempio n. 10
0
 static void UseAKEV(Oni.InstanceDescriptor ides)
 {
     ides.AsXmlStream();
 }
Esempio n. 11
0
        public void BuildONCC(Oni.InstanceDescriptor l__oncc)
        {
            M3GM[]       l_bodyParts = new M3GM[19];
            GameObject[] l_gs        = new GameObject[19];
            m_singleton = this;
            {
                int l_i = 0;

                foreach (Round2.Generated.Binary.TRGA.Package pkg in this.m_TRBS_link_C3C.Value.m_TRCM_link_18.Value.m_TRGA_link_5C.Value.m_pkg_20)
                {
                    l_bodyParts[l_i++] = pkg.m_M3GM_link_0.Value;
                }
            }

            {
                int l_i = 0;

                foreach (M3GM m in l_bodyParts)
                {
                    Texture2D m_tex = this.m_TRMA_link_C40.Value.m_pkg_20[l_i].m_TXMP_link_0.Value.Surface_0;
                    l_gs[l_i] = new GameObject(((Bodyparts)l_i).ToString());
                    l_gs[l_i].AddComponent <MeshFilter>().mesh = m.UnityMesh;
                    (l_gs[l_i++].AddComponent <MeshRenderer>().material = new Material(Shader.Find("TwoSidedDiffuse"))).mainTexture = m_tex;
                }
            }

            {
                int l_i = 0;

                string child   = "";
                string parent  = "";
                string sibling = "";

                int        l_latestParent   = 0;
                int        l_nextChainStart = 0;
                List <int> l_childs         = new List <int>();
                List <int> l_siblings       = new List <int>();

                foreach (TRIA.Package pkg in this.m_TRBS_link_C3C.Value.m_TRCM_link_18.Value.m_TRIA_link_64.Value.m_pkg_20)
                {
                    child   += "|" + pkg.m_Major_joint_1;
                    sibling += "|" + pkg.m_Minor_joint_2;
                    parent  += "|" + pkg.m_Not_used_0;
                    l_childs.Add(pkg.m_Major_joint_1);
                    l_siblings.Add(pkg.m_Minor_joint_2);

                    if (pkg.m_Major_joint_1 != 0)
                    {
                        l_gs[pkg.m_Major_joint_1].transform.parent = l_gs[l_i].transform;
                    }

                    if (pkg.m_Minor_joint_2 != 0)
                    {
                        l_gs[pkg.m_Minor_joint_2].transform.parent = l_gs[l_i].transform.parent;
                    }

                    l_i++;
                }

                Debug.Log(parent);
                Debug.Log(child);
                Debug.Log(sibling);
                l_i = 0;

                foreach (TRTA.Package pkg in this.m_TRBS_link_C3C.Value.m_TRCM_link_18.Value.m_TRTA_link_60.Value.m_pkg_20)
                {
                    l_gs[l_i++].transform.localPosition = new UnityEngine.Vector3(-pkg.m_x_position_0, pkg.m_y_position_4, pkg.m_z_position_8);
                }

                int stub = this.m_TRAC_link_C88.Value.m_pkg_20.Length;

                Oni.Game.CharacterClass l_oncc = Oni.Game.CharacterClass.Read(l__oncc);

                foreach (Oni.InstanceDescriptor animdes in l_oncc.Animations)
                {
                    Oni.Totoro.Animation l_tram = Oni.Totoro.AnimationDatReader.Read(animdes);
                    AddAnimInfo(animdes.Name, l_tram);
                    string l_clipname = animdes.Name;

                    if (l_tram.FrameSize != 6)//TODO: fix?
                    {
                        continue;
                    }

                    AnimationClipHolder.Hold(animdes.Name, controller =>
                    {
                        Debug.LogWarning("building clip : " + l_clipname);
                        bool frameSize       = l_tram.FrameSize == 6;
                        AnimationClip l_clip = new AnimationClip();
                        l_clip.name          = l_clipname;

                        for (int i = 0; i < l_tram.Rotations.Count; i++)
                        {
                            Keyframe[] l_kFrx = new Keyframe[l_tram.Rotations[i].Count];
                            Keyframe[] l_kFry = new Keyframe[l_tram.Rotations[i].Count];
                            Keyframe[] l_kFrz = new Keyframe[l_tram.Rotations[i].Count];
                            Keyframe[] l_kFrw = new Keyframe[l_tram.Rotations[i].Count];
                            int l_duration    = 0;

                            for (int j = 0; j < l_tram.Rotations[i].Count; j++)
                            {
                                UnityEngine.Quaternion _l_q;

                                if (!frameSize)
                                {
                                    Oni.Quaternion l_q = new Oni.Quaternion(l_tram.Rotations[i][j].Rotation);
                                    _l_q = UnityEngine.Quaternion.Euler(Oni.MathHelper.ToDegrees(l_q.ToEulerXYZ().X), Oni.MathHelper.ToDegrees(l_q.ToEulerXYZ().Y), Oni.MathHelper.ToDegrees(l_q.ToEulerXYZ().Z));
                                }
                                else
                                {
                                    Oni.Quaternion qq = Oni.Quaternion.CreateFromEulerXYZ(l_tram.Rotations[i][j].Rotation.X, -l_tram.Rotations[i][j].Rotation.Y, -l_tram.Rotations[i][j].Rotation.Z);
                                    _l_q = new UnityEngine.Quaternion(qq.X, qq.Y, qq.Z, qq.W);
                                }

                                l_kFrx[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.x);
                                l_kFry[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.y);
                                l_kFrz[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.z);
                                l_kFrw[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.w);

                                l_duration = l_duration + l_tram.Rotations[i][j].Duration;
                            }

                            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                            string l_path = "";
                            l_path        = "";
                            sb.Remove(0, sb.Length);
                            sb.Append(((Bodyparts)i).ToString());
                            l_path = "";

                            for (Transform _i = l_gs[i].transform.parent; _i.parent != null; _i = _i.transform.parent)
                            {
                                sb.Insert(0, '/');
                                sb.Insert(0, _i.name);
                            }

                            l_path = sb.ToString();
                            l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.x", new AnimationCurve(l_kFrx));
                            l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.y", new AnimationCurve(l_kFry));
                            l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.z", new AnimationCurve(l_kFrz));
                            l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.w", new AnimationCurve(l_kFrw));
                        }

                        List <float> posXList = new List <float>();
                        List <float> posYList = new List <float>();
                        List <float> posZList = new List <float>();

                        for (int k = 0; k < l_tram.Velocities.Count; k++)
                        {
                            posXList.Add(-l_tram.Velocities[k].X);
                            if (l_tram.Heights.Count <= k)
                            {
                                posYList.Add(0);
                            }
                            else
                            {
                                posYList.Add(l_tram.Heights[k]);
                            }
                            posZList.Add(l_tram.Velocities[k].Y);
                        }

                        {
                            float _iien = 0;
                            float timer = 0;
                            l_clip.SetCurve("", typeof(GUIANIMCONTROL), "m_motionVector.x", new AnimationCurve(posXList.ConvertAll <Keyframe>(frame =>
                            {
                                Keyframe res = new Keyframe(timer += 0.0166666675f, frame / 0.0166666675f);
                                return(res);
                            }).ToArray()));
                        }

                        {
                            float _iien = 0;
                            float timer = 0;
                            l_clip.SetCurve("pelvis", typeof(Transform), "m_LocalPosition.y", new AnimationCurve(posYList.ConvertAll <Keyframe>(frame =>
                            {
                                Keyframe res = new Keyframe(timer += 0.0166666675f, frame);
                                _iien        = frame;
                                return(res);
                            }).ToArray()));
                        }

                        {
                            float _iien = 0;
                            float timer = 0;
                            l_clip.SetCurve("", typeof(GUIANIMCONTROL), "m_motionVector.z", new AnimationCurve(posZList.ConvertAll <Keyframe>(frame =>
                            {
                                Keyframe res = new Keyframe(timer += 0.0166666675f, frame / 0.0166666675f);
                                return(res);
                            }).ToArray()));
                            AnimationEvent ev  = null;
                            l_clip.AddEvent(ev = new AnimationEvent()
                            {
                                objectReferenceParameter = controller, functionName = "OnActionFrame", time = timer - 1 / 60f, stringParameter = l_clipname
                            });
                            // m_events.Add(desc.Name, ev);
                        }

                        l_clip.EnsureQuaternionContinuity();
                        l_clip.wrapMode = WrapMode.ClampForever;
                        return(l_clip);
                    });
                }
            }

            GameObject l_parent = new GameObject();

            l_gs[0].transform.parent = l_parent.transform;
            Debug.Log("added", l_parent.AddComponent <GUIANIMCONTROL>());
            Camera.allCameras[0].transform.parent = l_parent.transform;
            CharacterController l_cc = l_parent.AddComponent <CharacterController>();

            l_cc.radius = 4;
            l_cc.center = UnityEngine.Vector3.up * 9;
            l_cc.height = 18;
            l_parent.AddComponent <Animation>();
        }
Esempio n. 12
0
    static Oni.InstanceDescriptor ZeroRegistryPull(Oni.InstanceDescriptor ides)
    {
        string l_name = ides.Name + "|" + ides.Template.Tag;

        return(m_level0instances.ContainsKey(l_name) ? m_level0instances[l_name] : null);
    }
Esempio n. 13
0
 static void ZeroRegistryPush(Oni.InstanceDescriptor ides)
 {
     m_level0instances.Add(ides.Name + "|" + ides.Template.Tag, ides);
 }
Esempio n. 14
0
 //this one breaks links to file0. Resolve somehow ffs
 internal static T GetByLinkId <T>(int linkId, Oni.InstanceFile srcFile)
     where T : Round2.BinaryInitializable
 {
     Oni.InstanceDescriptor l_located = srcFile.ResolveLink(linkId);
     return(ConvertInstance <T>(l_located));
 }
Esempio n. 15
0
 internal static Oni.InstanceDescriptor ResolveInstanceByLink(int link, Oni.InstanceFile srcFile)
 {
     Oni.InstanceDescriptor ides =
         srcFile.ResolveLink(link);
     return(ides);
 }
Esempio n. 16
0
    static void UseONCC(Oni.InstanceDescriptor ides)
    {
        DateTime l_n = DateTime.Now;

        ides.AsXmlStream();

        /*
         * Round2.ONCC l_chr = DeserializeAs<Round2.ONCC>(ides.AsXmlStream());
         * l_chr.SetName(ides.Name);
         * Debug.Log(l_chr.BodySet.TRBS.id);
         * Oni.Game.CharacterClass l_oncc = Oni.Game.CharacterClass.Read(ides);
         *
         * foreach (Oni.InstanceDescriptor animdes in l_oncc.Animations)
         * {
         *  Oni.Totoro.Animation l_tram = Oni.Totoro.AnimationDatReader.Read(animdes);
         *  l_chr.AddAnimInfo(animdes.Name, l_tram);
         *  string l_clipname = animdes.Name;
         *
         *  if (l_tram.FrameSize != 6)//TODO: fix?
         *  {
         *      continue;
         *  }
         *
         *  AnimationClipHolder.Hold(animdes.Name, controller =>
         *  {
         *      bool frameSize = l_tram.FrameSize == 6;
         *      AnimationClip l_clip = new AnimationClip();
         *      l_clip.name = l_clipname;
         *
         *      for (int i = 0; i < l_tram.Rotations.Count; i++)
         *      {
         *          Keyframe[] l_kFrx = new Keyframe[l_tram.Rotations[i].Count];
         *          Keyframe[] l_kFry = new Keyframe[l_tram.Rotations[i].Count];
         *          Keyframe[] l_kFrz = new Keyframe[l_tram.Rotations[i].Count];
         *          Keyframe[] l_kFrw = new Keyframe[l_tram.Rotations[i].Count];
         *          int l_duration = 0;
         *
         *          for (int j = 0; j < l_tram.Rotations[i].Count; j++)
         *          {
         *              UnityEngine.Quaternion _l_q;
         *
         *              if (!frameSize)
         *              {
         *                  Oni.Quaternion l_q = new Oni.Quaternion(l_tram.Rotations[i][j].Rotation);
         *                  _l_q = Quaternion.Euler(Oni.MathHelper.ToDegrees(l_q.ToEulerXYZ().X), Oni.MathHelper.ToDegrees(l_q.ToEulerXYZ().Y), Oni.MathHelper.ToDegrees(l_q.ToEulerXYZ().Z));
         *              }
         *              else
         *              {
         *                  Oni.Quaternion qq = Oni.Quaternion.CreateFromEulerXYZ(l_tram.Rotations[i][j].Rotation.X, -l_tram.Rotations[i][j].Rotation.Y, -l_tram.Rotations[i][j].Rotation.Z);
         *                  _l_q = new Quaternion(qq.X, qq.Y, qq.Z, qq.W);
         *              }
         *
         *              l_kFrx[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.x);
         *              l_kFry[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.y);
         *              l_kFrz[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.z);
         *              l_kFrw[j] = new Keyframe(l_duration * 0.0166666675f, _l_q.w);
         *
         *              l_duration = l_duration + l_tram.Rotations[i][j].Duration;
         *          }
         *
         *          System.Text.StringBuilder sb = new System.Text.StringBuilder();
         *          string l_path = "";
         *          l_path = "";
         *          sb.Remove(0, sb.Length);
         *          sb.Append(i == 0 ? "" : ((Round2.ONCC.Bodyparts)i).ToString());
         *          l_path = "";
         *
         *          for (int _i = l_chr.BodySet.TRBS.Elements[0].TRCM.Hierarchy.TRIA.Elements[i].Parent; _i != l_chr.BodySet.TRBS.Elements[0].TRCM.Hierarchy.TRIA.Elements[_i].Parent; _i = l_chr.BodySet.TRBS.Elements[0].TRCM.Hierarchy.TRIA.Elements[_i].Parent)
         *          {
         *              sb.Insert(0, '/');
         *              sb.Insert(0, ((Round2.ONCC.Bodyparts)_i).ToString());
         *          }
         *
         *          l_path = sb.ToString();
         *          l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.x", new AnimationCurve(l_kFrx));
         *          l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.y", new AnimationCurve(l_kFry));
         *          l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.z", new AnimationCurve(l_kFrz));
         *          l_clip.SetCurve(l_path, typeof(Transform), "m_LocalRotation.w", new AnimationCurve(l_kFrw));
         *      }
         *
         *      l_clip.AddEvent(new AnimationEvent() { objectReferenceParameter = controller, functionName = "OnActionFrame", time = (0.0166666675f * l_tram.Velocities.Count) - 1 / 60f, stringParameter = l_clipname });
         *      l_clip.EnsureQuaternionContinuity();
         *      l_clip.wrapMode = WrapMode.ClampForever;
         *      //l_chr.m_clips.Add(l_clip);
         *      return l_clip;
         *  });
         *
         * }
         *
         */
        Debug.Log("finished in " + (DateTime.Now - l_n).TotalSeconds);
    }
Esempio n. 17
0
    static void ParseBINA(Round2.BinaryInitializable obj, Oni.InstanceDescriptor ides)
    {
        Round2.Generated.Binary.BINA l_bina = (Round2.Generated.Binary.BINA)obj;

        using (Oni.BinaryReader l_rawReader = ides.GetRawReader(l_bina.m_Offset_C))
        {
            int l_tag = l_rawReader.ReadInt32();

            switch ((Oni.Metadata.BinaryTag)l_tag)
            {
            case Oni.Metadata.BinaryTag.OBJC:
            {
                int l_size    = l_rawReader.ReadInt32();
                int l_version = l_rawReader.ReadInt32();

                for (int l_nextSize = l_rawReader.ReadInt32(); l_nextSize != 0; l_nextSize = l_rawReader.ReadInt32())
                {
                    int    l_npos    = l_rawReader.Position + l_nextSize;  //calculate next position
                    string l_objType = (string)l_str(l_rawReader.ReadBytes(4).ReverseBytes(), 4);
                    int    l_objID   = l_rawReader.ReadInt32();
                    int    l_flags   = l_rawReader.ReadInt32();
                    float  l_xPos    = l_rawReader.ReadSingle();
                    float  l_yPos    = l_rawReader.ReadSingle();
                    float  l_zPos    = l_rawReader.ReadSingle();
                    float  l_xRot    = l_rawReader.ReadSingle();
                    float  l_yRot    = l_rawReader.ReadSingle();
                    float  l_zRot    = l_rawReader.ReadSingle();
                    Round2.Generated.Binary.Namespaces.BINA.OBJC.OBJCM l_obj = ParseOBJCMember(l_objType, l_npos, l_rawReader, l_objID);

                    if (l_obj != null)
                    {
                        l_obj.m_header.m_type  = l_objType;
                        l_obj.m_header.m_id    = l_objID;
                        l_obj.m_header.m_flags = l_flags;
                        l_obj.m_header.m_pos   = new Vector3(l_xPos, l_yPos, l_zPos);
                        l_obj.m_header.m_rot   = new Vector3(l_xRot, l_yRot, l_zRot);

                        //TODO : casually refactor
                        //TODO : replace plane with quad. Fix scale after
                        if (l_obj is Round2.Generated.Binary.Namespaces.BINA.OBJC.PART)
                        {
                            (l_obj as Round2.Generated.Binary.Namespaces.BINA.OBJC.PART).m_go.transform.position    = new UnityEngine.Vector3(-l_obj.m_header.m_pos.x, l_obj.m_header.m_pos.y, l_obj.m_header.m_pos.z);
                            (l_obj as Round2.Generated.Binary.Namespaces.BINA.OBJC.PART).m_go.transform.eulerAngles = l_obj.m_header.m_rot;
                            (l_obj as Round2.Generated.Binary.Namespaces.BINA.OBJC.PART).m_go.transform.localScale  = new UnityEngine.Vector3((l_obj as Round2.Generated.Binary.Namespaces.BINA.OBJC.PART).m_class.m_header.m_xScale / 5f, 1, (l_obj as Round2.Generated.Binary.Namespaces.BINA.OBJC.PART).m_class.m_header.m_yScale / 5f);
                            Debug.DrawLine(Vector3.up * 10, new Vector3(-l_obj.m_header.m_pos.x, l_obj.m_header.m_pos.y, l_obj.m_header.m_pos.z), Color.green, 15f);
                        }

                        //Debug.LogWarning(l_nextSize + ":" + l_objType + ":" + ides.GetHashCode() + "{" + l_obj.m_header.m_pos + "}" + "[" + l_obj.m_header.m_rot + "]");
                    }

                    l_rawReader.Position = l_npos;
                }
            }
            break;

            case Oni.Metadata.BinaryTag.PAR3:
            {
                int l_initPos = l_rawReader.Position;
                Round2.Generated.Binary.Namespaces.BINA.OBJC.PAR3.Header l_header = new Round2.Generated.Binary.Namespaces.BINA.OBJC.PAR3.Header();
                int l_completeParticleLength = l_rawReader.ReadInt32();
                l_rawReader.Skip(2);                                //skip length duplicate
                int l_version = l_rawReader.ReadInt16();
                l_rawReader.ReadInt32();                            //flags
                l_rawReader.ReadInt32();                            //flags2
                l_rawReader.ReadInt32();                            //unused
                l_header.m_variableCount = l_rawReader.ReadInt16(); //amout of variables
                l_header.m_eventsCount   = l_rawReader.ReadInt16(); //amount of events
                l_header.m_emittersCount = l_rawReader.ReadInt16(); //amount of emitters
                l_rawReader.ReadInt16();                            //unknown
                //Debug.Log(l_header.m_eventsCount.ToString("X") + " : PAR3 : " + ides.Name);
                l_rawReader.Skip(16 * 4);                           //skip slots. currently, they aren't used
                l_rawReader.Position   = l_initPos + 0x120 - 4;
                l_header.m_textureName = l_rawReader.ReadString(64);
                l_rawReader.Position   = l_initPos + 0xB4 - 4;
                l_header.m_xScale      = l_rawReader.ReadSingle();
                l_rawReader.Position   = l_initPos + 0xD0 - 4;
                l_header.m_yScale      = l_rawReader.ReadSingle();
                Round2.Generated.Binary.Namespaces.BINA.OBJC.PART.RegisterParticleClass(new Round2.Generated.Binary.Namespaces.BINA.OBJC.PAR3()
                    {
                        m_header = l_header
                    }, ides.Name);
                //Debug.LogError(">>>" + l_header.m_textureName);//texture name here
            }
            break;

            default:
                Debug.LogWarning("Cannot handle this tag yet");
                break;
            }
        }
    }