• R/O
  • SSH
  • HTTPS

tdcgexplorer: 提交


Commit MetaInfo

修訂2274 (tree)
時間2017-12-22 09:17:14
作者nomeu

Log Message

indent

Change Summary

差異

--- trunk/tsoview/TDCG/TSOFile.cs (revision 2273)
+++ trunk/tsoview/TDCG/TSOFile.cs (revision 2274)
@@ -11,29 +11,29 @@
1111
1212 namespace TDCG
1313 {
14- using BYTE = Byte;
15- using WORD = UInt16;
14+ using BYTE = Byte;
15+ using WORD = UInt16;
1616 using DWORD = UInt32;
17- using LONG = Int32;
17+ using LONG = Int32;
1818
19- [StructLayout(LayoutKind.Sequential, Pack=1)]
19+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
2020 struct TARGA_HEADER
2121 {
22- public BYTE id;
23- public BYTE colormap;
24- public BYTE imagetype;
25- public WORD colormaporigin;
26- public WORD colormaplength;
27- public BYTE colormapdepth;
28- public WORD x;
29- public WORD y;
30- public WORD width;
31- public WORD height;
32- public BYTE depth;
33- public BYTE type;
22+ public BYTE id;
23+ public BYTE colormap;
24+ public BYTE imagetype;
25+ public WORD colormaporigin;
26+ public WORD colormaplength;
27+ public BYTE colormapdepth;
28+ public WORD x;
29+ public WORD y;
30+ public WORD width;
31+ public WORD height;
32+ public BYTE depth;
33+ public BYTE type;
3434 };
3535
36- [StructLayout(LayoutKind.Sequential, Pack=1)]
36+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
3737 struct BITMAPFILEHEADER
3838 {
3939 public WORD bfType;
@@ -43,7 +43,7 @@
4343 public DWORD bfOffBits;
4444 }
4545
46- [StructLayout(LayoutKind.Sequential, Pack=1)]
46+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
4747 struct BITMAPINFOHEADER
4848 {
4949 //public DWORD biSize;
@@ -171,10 +171,10 @@
171171
172172 Array.Resize(ref bone_indices, bone_indices.Length + 1);
173173 maxPalettes++;
174-
174+
175175 int end = bone_indices.Length - 1;
176176 bone_indices[end] = bone_index;
177-
177+
178178 return end;
179179 }
180180
@@ -351,8 +351,8 @@
351351 public void Dispose()
352352 {
353353 if (sub_meshes != null)
354- foreach (TSOSubMesh sub_mesh in sub_meshes)
355- sub_mesh.Dispose();
354+ foreach (TSOSubMesh sub_mesh in sub_meshes)
355+ sub_mesh.Dispose();
356356 }
357357 }
358358
@@ -774,7 +774,7 @@
774774 this.width = header.width;
775775 this.height = header.height;
776776 this.depth = header.depth / 8;
777- this.data = br.ReadBytes( this.width * this.height * this.depth );
777+ this.data = br.ReadBytes(this.width * this.height * this.depth);
778778 }
779779
780780 /// <summary>
@@ -802,26 +802,26 @@
802802 //Console.WriteLine("biSize {0}", biSize);
803803
804804 buf = br.ReadBytes((int)biSize - 4);
805- bih.biWidth = BitConverter.ToInt32(buf, 0x00);
806- bih.biHeight = BitConverter.ToInt32(buf, 0x04);
807- bih.biPlanes = BitConverter.ToUInt16(buf, 0x08);
808- bih.biBitCount = BitConverter.ToUInt16(buf, 0x0A);
809- bih.biCompression = BitConverter.ToUInt32(buf, 0x0C);
810- bih.biSizeImage = BitConverter.ToUInt32(buf, 0x10);
811- bih.biXPelsPerMeter = BitConverter.ToInt32(buf, 0x14);
812- bih.biYPelsPerMeter = BitConverter.ToInt32(buf, 0x18);
813- bih.biClrUsed = BitConverter.ToUInt32(buf, 0x1C);
814- bih.biClrImportant = BitConverter.ToUInt32(buf, 0x20);
815- bih.bV5RedMask = 0x00ff0000;
816- bih.bV5GreenMask = 0x0000ff00;
817- bih.bV5BlueMask = 0x000000ff;
818- bih.bV5AlphaMask = 0;
805+ bih.biWidth = BitConverter.ToInt32(buf, 0x00);
806+ bih.biHeight = BitConverter.ToInt32(buf, 0x04);
807+ bih.biPlanes = BitConverter.ToUInt16(buf, 0x08);
808+ bih.biBitCount = BitConverter.ToUInt16(buf, 0x0A);
809+ bih.biCompression = BitConverter.ToUInt32(buf, 0x0C);
810+ bih.biSizeImage = BitConverter.ToUInt32(buf, 0x10);
811+ bih.biXPelsPerMeter = BitConverter.ToInt32(buf, 0x14);
812+ bih.biYPelsPerMeter = BitConverter.ToInt32(buf, 0x18);
813+ bih.biClrUsed = BitConverter.ToUInt32(buf, 0x1C);
814+ bih.biClrImportant = BitConverter.ToUInt32(buf, 0x20);
815+ bih.bV5RedMask = 0x00ff0000;
816+ bih.bV5GreenMask = 0x0000ff00;
817+ bih.bV5BlueMask = 0x000000ff;
818+ bih.bV5AlphaMask = 0;
819819 if (biSize >= 56)
820820 {
821- bih.bV5RedMask = BitConverter.ToUInt32(buf, 0x24);
822- bih.bV5GreenMask = BitConverter.ToUInt32(buf, 0x28);
823- bih.bV5BlueMask = BitConverter.ToUInt32(buf, 0x2C);
824- bih.bV5AlphaMask = BitConverter.ToUInt32(buf, 0x30);
821+ bih.bV5RedMask = BitConverter.ToUInt32(buf, 0x24);
822+ bih.bV5GreenMask = BitConverter.ToUInt32(buf, 0x28);
823+ bih.bV5BlueMask = BitConverter.ToUInt32(buf, 0x2C);
824+ bih.bV5AlphaMask = BitConverter.ToUInt32(buf, 0x30);
825825 }
826826
827827 if (bih.biBitCount != 24 && bih.biBitCount != 32)
@@ -830,7 +830,7 @@
830830 this.width = bih.biWidth;
831831 this.height = bih.biHeight;
832832 this.depth = bih.biBitCount / 8;
833- buf = br.ReadBytes( this.width * this.height * this.depth );
833+ buf = br.ReadBytes(this.width * this.height * this.depth);
834834
835835 if (biSize >= 56)
836836 {
@@ -862,9 +862,9 @@
862862 this.width = reader.ReadInt32();
863863 this.height = reader.ReadInt32();
864864 this.depth = reader.ReadInt32();
865- byte[] buf = reader.ReadBytes( this.width * this.height * this.depth );
865+ byte[] buf = reader.ReadBytes(this.width * this.height * this.depth);
866866
867- for(int j = 0; j < buf.Length; j += 4)
867+ for (int j = 0; j < buf.Length; j += 4)
868868 {
869869 byte tmp = buf[j + 2];
870870 buf[j + 2] = buf[j + 0];
@@ -946,7 +946,7 @@
946946 byte[] buf = new byte[this.data.Length];
947947 Array.Copy(this.data, 0, buf, 0, buf.Length);
948948
949- for(int j = 0; j < buf.Length; j += 4)
949+ for (int j = 0; j < buf.Length; j += 4)
950950 {
951951 byte tmp = buf[j + 2];
952952 buf[j + 2] = buf[j + 0];
@@ -1075,10 +1075,12 @@
10751075 /// </summary>
10761076 public Quaternion Rotation
10771077 {
1078- get {
1078+ get
1079+ {
10791080 return rotation;
10801081 }
1081- set {
1082+ set
1083+ {
10821084 rotation = value;
10831085 need_update_transformation = true;
10841086 }
@@ -1089,10 +1091,12 @@
10891091 /// </summary>
10901092 public Vector3 Translation
10911093 {
1092- get {
1094+ get
1095+ {
10931096 return translation;
10941097 }
1095- set {
1098+ set
1099+ {
10961100 translation = value;
10971101 need_update_transformation = true;
10981102 }
@@ -1117,7 +1121,7 @@
11171121 /// Id
11181122 /// </summary>
11191123 public int Id { get { return id; } }
1120-
1124+
11211125 /// <summary>
11221126 /// 名称
11231127 /// </summary>
@@ -1207,7 +1211,8 @@
12071211 /// </summary>
12081212 public Matrix RotationMatrix
12091213 {
1210- get {
1214+ get
1215+ {
12111216 return Matrix.RotationQuaternion(rotation);
12121217 }
12131218 }
@@ -1217,7 +1222,8 @@
12171222 /// </summary>
12181223 public Matrix TranslationMatrix
12191224 {
1220- get {
1225+ get
1226+ {
12211227 return Matrix.Translation(translation);
12221228 }
12231229 }
@@ -1227,7 +1233,8 @@
12271233 /// </summary>
12281234 public Matrix TransformationMatrix
12291235 {
1230- get {
1236+ get
1237+ {
12311238 if (need_update_transformation)
12321239 {
12331240 transformation_matrix = ScalingMatrix * RotationMatrix * TranslationMatrix;
@@ -1235,7 +1242,8 @@
12351242 }
12361243 return transformation_matrix;
12371244 }
1238- set {
1245+ set
1246+ {
12391247 transformation_matrix = value;
12401248 translation = Helper.DecomposeMatrix(ref value, out scaling);
12411249 rotation = Quaternion.RotationMatrix(value);
@@ -1499,8 +1507,8 @@
14991507 this.effect = effect;
15001508
15011509 foreach (TSOMesh mesh in meshes)
1502- foreach (TSOSubMesh sub_mesh in mesh.sub_meshes)
1503- sub_mesh.WriteBuffer(device);
1510+ foreach (TSOSubMesh sub_mesh in mesh.sub_meshes)
1511+ sub_mesh.WriteBuffer(device);
15041512
15051513 texmap = new Dictionary<string, TSOTex>();
15061514
@@ -1552,7 +1560,7 @@
15521560 return;
15531561 current_shader = shader;
15541562
1555- if (! techmap.ContainsKey(shader.technique))
1563+ if (!techmap.ContainsKey(shader.technique))
15561564 {
15571565 Console.WriteLine("Error: shader technique not found. " + shader.technique);
15581566 return;
@@ -1565,19 +1573,19 @@
15651573
15661574 switch (p.type)
15671575 {
1568- case ShaderParameterType.String:
1569- effect.SetValue(p.name, p.GetString());
1570- break;
1571- case ShaderParameterType.Float:
1572- case ShaderParameterType.Float3:
1573- case ShaderParameterType.Float4:
1574- effect.SetValue(p.name, new float[]{ p.F1, p.F2, p.F3, p.F4 });
1575- break;
1576- /*
1577- case ShaderParameter.Type.Texture:
1578- effect.SetValue(p.name, p.GetTexture());
1579- break;
1580- */
1576+ case ShaderParameterType.String:
1577+ effect.SetValue(p.name, p.GetString());
1578+ break;
1579+ case ShaderParameterType.Float:
1580+ case ShaderParameterType.Float3:
1581+ case ShaderParameterType.Float4:
1582+ effect.SetValue(p.name, new float[] { p.F1, p.F2, p.F3, p.F4 });
1583+ break;
1584+ /*
1585+ case ShaderParameter.Type.Texture:
1586+ effect.SetValue(p.name, p.GetTexture());
1587+ break;
1588+ */
15811589 }
15821590 }
15831591 effect.SetValue(handle_LightDir, shader.LightDir);
Show on old repository browser