/// メッシュ操作を生成します。 public MeshCommand(TSOFile tso, TSOMesh mesh, TSONode selected_node, float weight, WeightOperation weight_op) { this.tso = tso; this.mesh = mesh; this.selected_node = selected_node; this.weight = weight; this.weight_op = weight_op; }
public static void Write(BinaryWriter bw, TSOMesh item) { Write(bw, item.name); Matrix m = item.transform_matrix; Write(bw, ref m); bw.Write(item.unknown1); bw.Write(item.sub_meshes.Length); foreach (TSOSubMesh i in item.sub_meshes) { Write(bw, i); } }
internal static MqoMesh FromTSOMesh(TSOMesh mesh) { MqoMesh mqo_mesh; if (meshmap.TryGetValue(mesh, out mqo_mesh)) { return(mqo_mesh); } mqo_mesh = new MqoMesh(mesh); mqo_mesh.CreateVertices(); meshmap[mesh] = mqo_mesh; return(mqo_mesh); }
/// <summary> /// 指定ストリームから読み込みます。 /// </summary> /// <param name="source_stream">ストリーム</param> public void Load(Stream source_stream) { reader = new BinaryReader(source_stream, System.Text.Encoding.Default); byte[] magic = reader.ReadBytes(4); if (magic[0] != (byte)'T' || magic[1] != (byte)'S' || magic[2] != (byte)'O' || magic[3] != (byte)'1') { throw new Exception("File is not TSO"); } int node_count = reader.ReadInt32(); nodes = new TSONode[node_count]; for (int i = 0; i < node_count; i++) { nodes[i] = new TSONode(i); nodes[i].Read(reader); } GenerateNodemapAndTree(); int node_matrix_count = reader.ReadInt32(); Matrix m = Matrix.Identity; for (int i = 0; i < node_matrix_count; i++) { reader.ReadMatrix(ref m); nodes[i].TransformationMatrix = m; } for (int i = 0; i < node_matrix_count; i++) { nodes[i].ComputeOffsetMatrix(); } UInt32 texture_count = reader.ReadUInt32(); textures = new TSOTex[texture_count]; for (int i = 0; i < texture_count; i++) { textures[i] = new TSOTex(); textures[i].Read(reader); } UInt32 script_count = reader.ReadUInt32(); scripts = new TSOScript[script_count]; for (int i = 0; i < script_count; i++) { scripts[i] = new TSOScript(); scripts[i].Read(reader); } UInt32 sub_script_count = reader.ReadUInt32(); sub_scripts = new TSOSubScript[sub_script_count]; for (int i = 0; i < sub_script_count; i++) { sub_scripts[i] = new TSOSubScript(); sub_scripts[i].Read(reader); sub_scripts[i].GenerateShader(); } UInt32 mesh_count = reader.ReadUInt32(); meshes = new TSOMesh[mesh_count]; for (int i = 0; i < mesh_count; i++) { meshes[i] = new TSOMesh(); meshes[i].Read(reader); meshes[i].LinkBones(nodes); //Console.WriteLine("mesh name {0} len {1}", mesh.name, mesh.sub_meshes.Length); } }
/// メッシュ操作を生成します。 public SmoothMeshCommand(TSOFile tso, TSOMesh mesh, TSONode selected_node) { this.tso = tso; this.mesh = mesh; this.selected_node = selected_node; }
public MqoMesh(TSOMesh mesh) { this.mesh = mesh; }
/// <summary> /// 指定ストリームから読み込みます。 /// </summary> /// <param name="source_stream">ストリーム</param> public void Load(Stream source_stream) { BinaryReader reader = new BinaryReader(source_stream, System.Text.Encoding.Default); byte[] magic = reader.ReadBytes(4); if (magic[0] != (byte)'T' || magic[1] != (byte)'S' || magic[2] != (byte)'O' || magic[3] != (byte)'1') throw new Exception("File is not TSO"); int node_count = reader.ReadInt32(); nodes = new TSONode[node_count]; for (int i = 0; i < node_count; i++) { nodes[i] = new TSONode(i); nodes[i].Read(reader); } GenerateNodemapAndTree(); int node_matrix_count = reader.ReadInt32(); Matrix m = Matrix.Identity; for (int i = 0; i < node_matrix_count; i++) { reader.ReadMatrix(ref m); nodes[i].TransformationMatrix = m; } for (int i = 0; i < node_matrix_count; i++) { nodes[i].ComputeOffsetMatrix(); } UInt32 texture_count = reader.ReadUInt32(); textures = new TSOTex[texture_count]; for (int i = 0; i < texture_count; i++) { textures[i] = new TSOTex(); textures[i].Read(reader); } UInt32 script_count = reader.ReadUInt32(); scripts = new TSOScript[script_count]; for (int i = 0; i < script_count; i++) { scripts[i] = new TSOScript(); scripts[i].Read(reader); } UInt32 sub_script_count = reader.ReadUInt32(); sub_scripts = new TSOSubScript[sub_script_count]; for (int i = 0; i < sub_script_count; i++) { sub_scripts[i] = new TSOSubScript(); sub_scripts[i].Read(reader); sub_scripts[i].GenerateShader(); } UInt32 mesh_count = reader.ReadUInt32(); meshes = new TSOMesh[mesh_count]; for (int i = 0; i < mesh_count; i++) { meshes[i] = new TSOMesh(); meshes[i].Read(reader); meshes[i].LinkBones(nodes); //Console.WriteLine("mesh name {0} len {1}", mesh.name, mesh.sub_meshes.Length); } }