using System.Collections.Generic;\r
using System.IO;\r
using System.Text;\r
-using Microsoft.DirectX;\r
-using Microsoft.DirectX.Direct3D;\r
\r
namespace Tso2MqoGui\r
{\r
this.r = r;\r
}\r
\r
- public static int debug_count = 0;\r
-\r
public void ReadVertex(ref Vertex v)\r
{\r
v.Pos.X = r.ReadSingle();\r
int cnt = r.ReadInt32();\r
byte[] idx = new byte[4]{0, 0, 0, 0};\r
\r
- //System.Diagnostics.Debug.Assert(cnt >= 1 && cnt <= 4);\r
-#if false\r
- if(cnt >= 1) { idx[0]= (byte)r.ReadInt32(); v.Wgt.X = r.ReadSingle(); }\r
- if(cnt >= 2) { idx[1]= (byte)r.ReadInt32(); v.Wgt.Y = r.ReadSingle(); }\r
- if(cnt >= 3) { idx[2]= (byte)r.ReadInt32(); v.Wgt.Z = r.ReadSingle(); }\r
- if(cnt >= 4) { idx[3]= (byte)r.ReadInt32(); v.Wgt.W = r.ReadSingle(); }\r
-#endif\r
-#if false\r
- if(cnt >= 1) { idx[3]= (byte)r.ReadInt32(); v.Wgt.X = r.ReadSingle(); }\r
- if(cnt >= 2) { idx[2]= (byte)r.ReadInt32(); v.Wgt.Y = r.ReadSingle(); }\r
- if(cnt >= 3) { idx[1]= (byte)r.ReadInt32(); v.Wgt.Z = r.ReadSingle(); }\r
- if(cnt >= 4) { idx[0]= (byte)r.ReadInt32(); v.Wgt.W = r.ReadSingle(); }\r
-#endif\r
-#if false\r
- if(cnt >= 1) { idx[0]= (byte)r.ReadInt32(); v.Wgt.W = r.ReadSingle(); }\r
- if(cnt >= 2) { idx[1]= (byte)r.ReadInt32(); v.Wgt.Z = r.ReadSingle(); }\r
- if(cnt >= 3) { idx[2]= (byte)r.ReadInt32(); v.Wgt.Y = r.ReadSingle(); }\r
- if(cnt >= 4) { idx[3]= (byte)r.ReadInt32(); v.Wgt.X = r.ReadSingle(); }\r
-#endif\r
-#if true\r
if(cnt >= 1) { idx[3]= (byte)r.ReadInt32(); v.Wgt.W = r.ReadSingle(); }\r
if(cnt >= 2) { idx[2]= (byte)r.ReadInt32(); v.Wgt.Z = r.ReadSingle(); }\r
if(cnt >= 3) { idx[1]= (byte)r.ReadInt32(); v.Wgt.Y = r.ReadSingle(); }\r
if(cnt >= 6) { r.ReadInt32(); r.ReadSingle(); }\r
if(cnt >= 7) { r.ReadInt32(); r.ReadSingle(); }\r
if(cnt >= 8) { r.ReadInt32(); r.ReadSingle(); }\r
-#endif\r
-\r
- /*\r
- //if(debug_count++ < 30)\r
- {\r
- System.Diagnostics.Debug.WriteLine("["\r
- + idx[0] + ":" + v.Wgt.X.ToString("N8") +"], ["\r
- + idx[1] + ":" + v.Wgt.Y.ToString("N8") +"], ["\r
- + idx[2] + ":" + v.Wgt.Z.ToString("N8") +"], ["\r
- + idx[3] + ":" + v.Wgt.W.ToString("N8") +"]");\r
- }\r
- */\r
-\r
- v.Idx = BitConverter.ToUInt32(idx, 0);\r
- }\r
-\r
- public void ReadVertexDebug(ref Vertex v)\r
- {\r
- v.Pos.X = r.ReadSingle();\r
- v.Pos.Y = r.ReadSingle();\r
- v.Pos.Z = r.ReadSingle();\r
- v.Nrm.X = r.ReadSingle();\r
- v.Nrm.Y = r.ReadSingle();\r
- v.Nrm.Z = r.ReadSingle();\r
- v.Tex.X = r.ReadSingle();\r
- v.Tex.Y = r.ReadSingle();\r
-\r
- int cnt = r.ReadInt32();\r
- byte[] idx = new byte[4]{0, 0, 0, 0};\r
-\r
- System.Diagnostics.Debug.Assert(cnt >= 1 && cnt <= 4);\r
-\r
- if(cnt >= 1) { idx[3]= (byte)r.ReadInt32(); v.Wgt.W = r.ReadSingle(); }\r
- if(cnt >= 2) { idx[2]= (byte)r.ReadInt32(); v.Wgt.Z = r.ReadSingle(); }\r
- if(cnt >= 3) { idx[1]= (byte)r.ReadInt32(); v.Wgt.Y = r.ReadSingle(); }\r
- if(cnt >= 4) { idx[0]= (byte)r.ReadInt32(); v.Wgt.X = r.ReadSingle(); }\r
\r
v.Idx = BitConverter.ToUInt32(idx, 0);\r
-\r
- System.Diagnostics.Debug.WriteLine("cnt=" + cnt);\r
}\r
\r
Encoding enc = Encoding.GetEncoding("Shift_JIS");\r
return enc.GetString(buf.ToArray());\r
}\r
\r
- public unsafe Matrix ReadMatrix()\r
+ public unsafe Matrix44 ReadMatrix()\r
{\r
- Matrix m;\r
- m.M11 = r.ReadSingle();\r
- m.M12 = r.ReadSingle();\r
- m.M13 = r.ReadSingle();\r
- m.M14 = r.ReadSingle();\r
-\r
- m.M21 = r.ReadSingle();\r
- m.M22 = r.ReadSingle();\r
- m.M23 = r.ReadSingle();\r
- m.M24 = r.ReadSingle();\r
-\r
- m.M31 = r.ReadSingle();\r
- m.M32 = r.ReadSingle();\r
- m.M33 = r.ReadSingle();\r
- m.M34 = r.ReadSingle();\r
-\r
- m.M41 = r.ReadSingle();\r
- m.M42 = r.ReadSingle();\r
- m.M43 = r.ReadSingle();\r
- m.M44 = r.ReadSingle();\r
+ Matrix44 m = new Matrix44();\r
+ float* p = &m.m11;\r
+\r
+ for(int i= 0; i < 16; ++i)\r
+ *p++ = r.ReadSingle();\r
\r
return m;\r
}\r