Exemple #1
0
        /// <summary>
        /// To DO
        /// </summary>
        /// <param name="original"></param>
        /// <returns></returns>
        public static MMesh Clone(this MMesh original)
        {
            MMesh clone = new MMIStandard.MMesh()
            {
                ID         = original.ID,
                Properties = original.Properties,
                Triangles  = new List <int>(original.Triangles),
                Vertices   = new List <MVector3>(original.Vertices)
            };

            return(clone);
        }
Exemple #2
0
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_ID        = false;
                bool   isset_Name      = false;
                bool   isset_Transform = false;
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            ID       = iprot.ReadString();
                            isset_ID = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.String)
                        {
                            Name       = iprot.ReadString();
                            isset_Name = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            Transform = new MMIStandard.MTransform();
                            Transform.Read(iprot);
                            isset_Transform = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            Collider = new MCollider();
                            Collider.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Struct)
                        {
                            Mesh = new MMesh();
                            Mesh.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Struct)
                        {
                            PhysicsProperties = new MPhysicsProperties();
                            PhysicsProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.Map)
                        {
                            {
                                Properties = new Dictionary <string, string>();
                                TMap _map113 = iprot.ReadMapBegin();
                                for (int _i114 = 0; _i114 < _map113.Count; ++_i114)
                                {
                                    string _key115;
                                    string _val116;
                                    _key115             = iprot.ReadString();
                                    _val116             = iprot.ReadString();
                                    Properties[_key115] = _val116;
                                }
                                iprot.ReadMapEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 9:
                        if (field.Type == TType.List)
                        {
                            {
                                Attachments = new List <MAttachment>();
                                TList _list117 = iprot.ReadListBegin();
                                for (int _i118 = 0; _i118 < _list117.Count; ++_i118)
                                {
                                    MAttachment _elem119;
                                    _elem119 = new MAttachment();
                                    _elem119.Read(iprot);
                                    Attachments.Add(_elem119);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.List)
                        {
                            {
                                Constraints = new List <MMIStandard.MConstraint>();
                                TList _list120 = iprot.ReadListBegin();
                                for (int _i121 = 0; _i121 < _list120.Count; ++_i121)
                                {
                                    MMIStandard.MConstraint _elem122;
                                    _elem122 = new MMIStandard.MConstraint();
                                    _elem122.Read(iprot);
                                    Constraints.Add(_elem122);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_ID)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ID not set");
                }
                if (!isset_Name)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Name not set");
                }
                if (!isset_Transform)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field Transform not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }
        public void Read(TProtocol iprot)
        {
            iprot.IncrementRecursionDepth();
            try
            {
                bool   isset_ID = false;
                TField field;
                iprot.ReadStructBegin();
                while (true)
                {
                    field = iprot.ReadFieldBegin();
                    if (field.Type == TType.Stop)
                    {
                        break;
                    }
                    switch (field.ID)
                    {
                    case 1:
                        if (field.Type == TType.String)
                        {
                            ID       = iprot.ReadString();
                            isset_ID = true;
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 2:
                        if (field.Type == TType.String)
                        {
                            Name = iprot.ReadString();
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 3:
                        if (field.Type == TType.Struct)
                        {
                            Transform = new MTransformUpdate();
                            Transform.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 4:
                        if (field.Type == TType.Struct)
                        {
                            Collider = new MCollider();
                            Collider.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 5:
                        if (field.Type == TType.Struct)
                        {
                            Mesh = new MMesh();
                            Mesh.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 6:
                        if (field.Type == TType.Struct)
                        {
                            PhysicsProperties = new MPhysicsProperties();
                            PhysicsProperties.Read(iprot);
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 7:
                        if (field.Type == TType.List)
                        {
                            {
                                HandPoses = new List <MMIStandard.MHandPose>();
                                TList _list126 = iprot.ReadListBegin();
                                for (int _i127 = 0; _i127 < _list126.Count; ++_i127)
                                {
                                    MMIStandard.MHandPose _elem128;
                                    _elem128 = new MMIStandard.MHandPose();
                                    _elem128.Read(iprot);
                                    HandPoses.Add(_elem128);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 8:
                        if (field.Type == TType.List)
                        {
                            {
                                Properties = new List <MPropertyUpdate>();
                                TList _list129 = iprot.ReadListBegin();
                                for (int _i130 = 0; _i130 < _list129.Count; ++_i130)
                                {
                                    MPropertyUpdate _elem131;
                                    _elem131 = new MPropertyUpdate();
                                    _elem131.Read(iprot);
                                    Properties.Add(_elem131);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 9:
                        if (field.Type == TType.List)
                        {
                            {
                                Attachments = new List <MAttachment>();
                                TList _list132 = iprot.ReadListBegin();
                                for (int _i133 = 0; _i133 < _list132.Count; ++_i133)
                                {
                                    MAttachment _elem134;
                                    _elem134 = new MAttachment();
                                    _elem134.Read(iprot);
                                    Attachments.Add(_elem134);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    case 10:
                        if (field.Type == TType.List)
                        {
                            {
                                Constraints = new List <MMIStandard.MConstraint>();
                                TList _list135 = iprot.ReadListBegin();
                                for (int _i136 = 0; _i136 < _list135.Count; ++_i136)
                                {
                                    MMIStandard.MConstraint _elem137;
                                    _elem137 = new MMIStandard.MConstraint();
                                    _elem137.Read(iprot);
                                    Constraints.Add(_elem137);
                                }
                                iprot.ReadListEnd();
                            }
                        }
                        else
                        {
                            TProtocolUtil.Skip(iprot, field.Type);
                        }
                        break;

                    default:
                        TProtocolUtil.Skip(iprot, field.Type);
                        break;
                    }
                    iprot.ReadFieldEnd();
                }
                iprot.ReadStructEnd();
                if (!isset_ID)
                {
                    throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ID not set");
                }
            }
            finally
            {
                iprot.DecrementRecursionDepth();
            }
        }