indent
@@ -11,29 +11,29 @@ | ||
11 | 11 | |
12 | 12 | namespace TDCG |
13 | 13 | { |
14 | - using BYTE = Byte; | |
15 | - using WORD = UInt16; | |
14 | + using BYTE = Byte; | |
15 | + using WORD = UInt16; | |
16 | 16 | using DWORD = UInt32; |
17 | - using LONG = Int32; | |
17 | + using LONG = Int32; | |
18 | 18 | |
19 | - [StructLayout(LayoutKind.Sequential, Pack=1)] | |
19 | + [StructLayout(LayoutKind.Sequential, Pack = 1)] | |
20 | 20 | struct TARGA_HEADER |
21 | 21 | { |
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; | |
34 | 34 | }; |
35 | 35 | |
36 | - [StructLayout(LayoutKind.Sequential, Pack=1)] | |
36 | + [StructLayout(LayoutKind.Sequential, Pack = 1)] | |
37 | 37 | struct BITMAPFILEHEADER |
38 | 38 | { |
39 | 39 | public WORD bfType; |
@@ -43,7 +43,7 @@ | ||
43 | 43 | public DWORD bfOffBits; |
44 | 44 | } |
45 | 45 | |
46 | - [StructLayout(LayoutKind.Sequential, Pack=1)] | |
46 | + [StructLayout(LayoutKind.Sequential, Pack = 1)] | |
47 | 47 | struct BITMAPINFOHEADER |
48 | 48 | { |
49 | 49 | //public DWORD biSize; |
@@ -171,10 +171,10 @@ | ||
171 | 171 | |
172 | 172 | Array.Resize(ref bone_indices, bone_indices.Length + 1); |
173 | 173 | maxPalettes++; |
174 | - | |
174 | + | |
175 | 175 | int end = bone_indices.Length - 1; |
176 | 176 | bone_indices[end] = bone_index; |
177 | - | |
177 | + | |
178 | 178 | return end; |
179 | 179 | } |
180 | 180 |
@@ -351,8 +351,8 @@ | ||
351 | 351 | public void Dispose() |
352 | 352 | { |
353 | 353 | 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(); | |
356 | 356 | } |
357 | 357 | } |
358 | 358 |
@@ -774,7 +774,7 @@ | ||
774 | 774 | this.width = header.width; |
775 | 775 | this.height = header.height; |
776 | 776 | 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); | |
778 | 778 | } |
779 | 779 | |
780 | 780 | /// <summary> |
@@ -802,26 +802,26 @@ | ||
802 | 802 | //Console.WriteLine("biSize {0}", biSize); |
803 | 803 | |
804 | 804 | 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; | |
819 | 819 | if (biSize >= 56) |
820 | 820 | { |
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); | |
825 | 825 | } |
826 | 826 | |
827 | 827 | if (bih.biBitCount != 24 && bih.biBitCount != 32) |
@@ -830,7 +830,7 @@ | ||
830 | 830 | this.width = bih.biWidth; |
831 | 831 | this.height = bih.biHeight; |
832 | 832 | 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); | |
834 | 834 | |
835 | 835 | if (biSize >= 56) |
836 | 836 | { |
@@ -862,9 +862,9 @@ | ||
862 | 862 | this.width = reader.ReadInt32(); |
863 | 863 | this.height = reader.ReadInt32(); |
864 | 864 | 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); | |
866 | 866 | |
867 | - for(int j = 0; j < buf.Length; j += 4) | |
867 | + for (int j = 0; j < buf.Length; j += 4) | |
868 | 868 | { |
869 | 869 | byte tmp = buf[j + 2]; |
870 | 870 | buf[j + 2] = buf[j + 0]; |
@@ -946,7 +946,7 @@ | ||
946 | 946 | byte[] buf = new byte[this.data.Length]; |
947 | 947 | Array.Copy(this.data, 0, buf, 0, buf.Length); |
948 | 948 | |
949 | - for(int j = 0; j < buf.Length; j += 4) | |
949 | + for (int j = 0; j < buf.Length; j += 4) | |
950 | 950 | { |
951 | 951 | byte tmp = buf[j + 2]; |
952 | 952 | buf[j + 2] = buf[j + 0]; |
@@ -1075,10 +1075,12 @@ | ||
1075 | 1075 | /// </summary> |
1076 | 1076 | public Quaternion Rotation |
1077 | 1077 | { |
1078 | - get { | |
1078 | + get | |
1079 | + { | |
1079 | 1080 | return rotation; |
1080 | 1081 | } |
1081 | - set { | |
1082 | + set | |
1083 | + { | |
1082 | 1084 | rotation = value; |
1083 | 1085 | need_update_transformation = true; |
1084 | 1086 | } |
@@ -1089,10 +1091,12 @@ | ||
1089 | 1091 | /// </summary> |
1090 | 1092 | public Vector3 Translation |
1091 | 1093 | { |
1092 | - get { | |
1094 | + get | |
1095 | + { | |
1093 | 1096 | return translation; |
1094 | 1097 | } |
1095 | - set { | |
1098 | + set | |
1099 | + { | |
1096 | 1100 | translation = value; |
1097 | 1101 | need_update_transformation = true; |
1098 | 1102 | } |
@@ -1117,7 +1121,7 @@ | ||
1117 | 1121 | /// Id |
1118 | 1122 | /// </summary> |
1119 | 1123 | public int Id { get { return id; } } |
1120 | - | |
1124 | + | |
1121 | 1125 | /// <summary> |
1122 | 1126 | /// 名称 |
1123 | 1127 | /// </summary> |
@@ -1207,7 +1211,8 @@ | ||
1207 | 1211 | /// </summary> |
1208 | 1212 | public Matrix RotationMatrix |
1209 | 1213 | { |
1210 | - get { | |
1214 | + get | |
1215 | + { | |
1211 | 1216 | return Matrix.RotationQuaternion(rotation); |
1212 | 1217 | } |
1213 | 1218 | } |
@@ -1217,7 +1222,8 @@ | ||
1217 | 1222 | /// </summary> |
1218 | 1223 | public Matrix TranslationMatrix |
1219 | 1224 | { |
1220 | - get { | |
1225 | + get | |
1226 | + { | |
1221 | 1227 | return Matrix.Translation(translation); |
1222 | 1228 | } |
1223 | 1229 | } |
@@ -1227,7 +1233,8 @@ | ||
1227 | 1233 | /// </summary> |
1228 | 1234 | public Matrix TransformationMatrix |
1229 | 1235 | { |
1230 | - get { | |
1236 | + get | |
1237 | + { | |
1231 | 1238 | if (need_update_transformation) |
1232 | 1239 | { |
1233 | 1240 | transformation_matrix = ScalingMatrix * RotationMatrix * TranslationMatrix; |
@@ -1235,7 +1242,8 @@ | ||
1235 | 1242 | } |
1236 | 1243 | return transformation_matrix; |
1237 | 1244 | } |
1238 | - set { | |
1245 | + set | |
1246 | + { | |
1239 | 1247 | transformation_matrix = value; |
1240 | 1248 | translation = Helper.DecomposeMatrix(ref value, out scaling); |
1241 | 1249 | rotation = Quaternion.RotationMatrix(value); |
@@ -1499,8 +1507,8 @@ | ||
1499 | 1507 | this.effect = effect; |
1500 | 1508 | |
1501 | 1509 | 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); | |
1504 | 1512 | |
1505 | 1513 | texmap = new Dictionary<string, TSOTex>(); |
1506 | 1514 |
@@ -1552,7 +1560,7 @@ | ||
1552 | 1560 | return; |
1553 | 1561 | current_shader = shader; |
1554 | 1562 | |
1555 | - if (! techmap.ContainsKey(shader.technique)) | |
1563 | + if (!techmap.ContainsKey(shader.technique)) | |
1556 | 1564 | { |
1557 | 1565 | Console.WriteLine("Error: shader technique not found. " + shader.technique); |
1558 | 1566 | return; |
@@ -1565,19 +1573,19 @@ | ||
1565 | 1573 | |
1566 | 1574 | switch (p.type) |
1567 | 1575 | { |
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 | + */ | |
1581 | 1589 | } |
1582 | 1590 | } |
1583 | 1591 | effect.SetValue(handle_LightDir, shader.LightDir); |