/// <summary>
        /// Parses a pivot chunk.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        private void ParsePivot(string[] tokens)
        {
            var chunks = Tokenizer.SplitChunks(tokens);

            foreach (var chunk in chunks)
            {
                int index = 0;

                switch (chunk.Ident)
                {
                case "origin":
                    this.PivotOrigin = An8Point.ReadTokens(chunk.Tokens, ref index);
                    break;

                case "orientation":
                    this.PivotOrientation = An8Quaternion.ReadTokens(chunk.Tokens, ref index);
                    break;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Parses the tokens of the chunk.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        internal override void ParseTokens(string[] tokens)
        {
            var chunks = Tokenizer.SplitChunks(tokens);

            foreach (var chunk in chunks)
            {
                int index = 0;

                switch (chunk.Ident)
                {
                case null:
                    this.Name = Tokenizer.ReadString(chunk.Tokens, ref index);
                    break;

                case "length":
                    this.Length = Tokenizer.ReadFloat(chunk.Tokens, ref index);
                    break;

                case "diameter":
                    this.Diameter = Tokenizer.ReadFloat(chunk.Tokens, ref index);
                    break;

                case "orientation":
                    this.Orientation = An8Quaternion.ReadTokens(chunk.Tokens, ref index);
                    break;

                case "locked":
                    this.IsLocked = true;
                    break;

                case "dof":
                {
                    var dof = new An8DegreeOfFreedom();
                    dof.ParseTokens(chunk.Tokens);
                    this.DegreesOfFreedom.Add(dof);
                    break;
                }

                case "influence":
                {
                    var influence = new An8Influence();
                    influence.ParseTokens(chunk.Tokens);
                    this.Influence = influence;
                    break;
                }

                case "bone":
                {
                    var bone = new An8Bone();
                    bone.ParseTokens(chunk.Tokens);
                    this.Bones.Add(bone);
                    break;
                }
                }
            }

            foreach (var component in An8Component.ParseComponents(tokens))
            {
                this.Components.Add(component);
            }
        }