/// <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 "material": { var material = new An8Material(); material.ParseTokens(chunk.Tokens); this.Materials.Add(material); break; } } } foreach (var component in An8Component.ParseComponents(tokens)) { this.Components.Add(component); } }
/// <summary> /// Parses the tokens of the chunk. /// </summary> /// <param name="tokens">The tokens.</param> internal override void ParseTokens(string[] tokens) { base.ParseTokens(tokens); foreach (var component in An8Component.ParseComponents(tokens)) { this.Components.Add(component); } }
/// <summary> /// Parses the tokens of the chunk. /// </summary> /// <param name="tokens">The tokens.</param> internal override void ParseTokens(string[] tokens) { base.ParseTokens(tokens); var chunks = Tokenizer.SplitChunks(tokens); foreach (var chunk in chunks) { int index = 0; switch (chunk.Ident) { case "length": this.Length = Tokenizer.ReadFloat(chunk.Tokens, ref index); break; case "diameter": this.Diameter = Tokenizer.ReadFloat(chunk.Tokens, ref index); break; case "segments": this.SegmentsCount = Tokenizer.ReadInt(chunk.Tokens, ref index); break; case "method": { var method = new An8Method(); method.ParseTokens(chunk.Tokens); this.Method = method; break; } } } this.Component = An8Component.ParseComponents(tokens).LastOrDefault(); }
/// <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); } }
/// <summary> /// Parses the tokens of components. /// </summary> /// <param name="tokens">The tokens.</param> /// <returns>The components.</returns> internal static List <An8Component> ParseComponents(string[] tokens) { var components = new List <An8Component>(); var chunks = Tokenizer.SplitChunks(tokens); foreach (var chunk in chunks) { An8Component component = null; switch (chunk.Ident) { case "mesh": component = new An8Mesh(); break; case "sphere": component = new An8Sphere(); break; case "cylinder": component = new An8Cylinder(); break; case "cube": component = new An8Cube(); break; case "subdivision": component = new An8Subdivision(); break; case "path": component = new An8Path(); break; case "textcom": component = new An8TextCom(); break; case "modifier": component = new An8Modifier(); break; case "image": component = new An8Image(); break; case "namedobject": component = new An8NamedObject(); break; case "group": component = new An8Group(); break; } if (component != null) { component.ParseTokens(chunk.Tokens); components.Add(component); } } return(components); }