|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
3 | | -using System.Diagnostics; |
4 | | -using System.IO; |
5 | | -using System.Linq; |
6 | | -using System.Text; |
7 | | - |
8 | | -namespace TRRM |
9 | | -{ |
10 | | - public class BDATChunk : Chunk |
11 | | - { |
12 | | - public string BoneName; |
13 | | - public float[] Unknown1; |
14 | | - public float[] Unknown2; |
15 | | - public float[] Unknown3; |
16 | | - public float[,] BoneMatrix; |
17 | | - public Chunk BoundingVolume; |
18 | | - |
19 | | - public override bool Load( BinaryReader reader ) |
20 | | - { |
21 | | - BoundingVolume = null; |
22 | | - |
23 | | - Start( reader ); |
24 | | - if ( !ReadHeader( reader ) || !IsValidVersion( 1, 2 ) ) |
25 | | - { |
26 | | - return false; |
27 | | - } |
28 | | - |
29 | | - BoneName = reader.ReadCString(); |
30 | | - Unknown1 = reader.ReadFloatArray( 4 ); |
31 | | - Unknown2 = reader.ReadFloatArray( 3 ); |
32 | | - if (Header.Version == 2) |
33 | | - { |
34 | | - Unknown3 = reader.ReadFloatArray( 3 ); |
35 | | - } |
36 | | - |
37 | | - BoneMatrix = reader.ReadMatrix( 4, 4 ); |
38 | | - |
39 | | - LogInfo( "name: " + BoneName ); |
40 | | - |
41 | | - ChunkType nextChunk = ChunkUtils.PeekNextChunk( reader ); |
42 | | - switch( nextChunk ) |
43 | | - { |
44 | | - case ChunkType.phyBone: |
45 | | - break; |
46 | | - case ChunkType.phyBVSphere: |
47 | | - BoundingVolume = new BVSPChunk(); |
48 | | - break; |
49 | | - case ChunkType.phyBVBox: |
50 | | - BoundingVolume = new BVBXChunk(); |
51 | | - break; |
52 | | - case ChunkType.phyBVAlignedCylinder: |
53 | | - BoundingVolume = new BVACChunk(); |
54 | | - break; |
55 | | - case ChunkType.phyBVCapsule: |
56 | | - BoundingVolume = new BVCPChunk(); |
57 | | - break; |
58 | | - case ChunkType.phyBVSurface: |
59 | | - BoundingVolume = new BVSFChunk(); |
60 | | - break; |
61 | | - case ChunkType.phyBVWalkableSurface: |
62 | | - BoundingVolume = new BVWSChunk(); |
63 | | - break; |
64 | | - default: |
65 | | - //Debugger.Break(); |
66 | | - break; |
67 | | - } |
68 | | - |
69 | | - if ( BoundingVolume != null ) |
70 | | - { |
71 | | - if ( !BoundingVolume.Load( reader ) ) |
72 | | - { |
73 | | - return false; |
74 | | - } |
75 | | - } |
76 | | - |
77 | | - End( reader ); |
78 | | - return true; |
79 | | - } |
80 | | - |
81 | | - public override ChunkType Type() |
82 | | - { |
83 | | - return ChunkType.phyBoneSharedData; |
84 | | - } |
85 | | - } |
86 | | -} |
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Diagnostics; |
| 4 | +using System.IO; |
| 5 | +using System.Linq; |
| 6 | +using System.Text; |
| 7 | + |
| 8 | +namespace TRRM |
| 9 | +{ |
| 10 | + public class BDATChunk : Chunk |
| 11 | + { |
| 12 | + public string BoneName; |
| 13 | + public float[] Unknown1; |
| 14 | + public float[] Unknown2; |
| 15 | + public float[] Unknown3; |
| 16 | + public float[,] BoneMatrix; |
| 17 | + public Chunk BoundingVolume; |
| 18 | + |
| 19 | + public override bool Load( BinaryReader reader ) |
| 20 | + { |
| 21 | + BoundingVolume = null; |
| 22 | + |
| 23 | + Start( reader ); |
| 24 | + if ( !ReadHeader( reader ) || !IsValidVersion( 1, 2 ) ) |
| 25 | + { |
| 26 | + return false; |
| 27 | + } |
| 28 | + |
| 29 | + BoneName = reader.ReadCString(); |
| 30 | + Unknown1 = reader.ReadFloatArray( 4 ); |
| 31 | + Unknown2 = reader.ReadFloatArray( 3 ); |
| 32 | + if (Header.Version == 2) |
| 33 | + { |
| 34 | + Unknown3 = reader.ReadFloatArray( 3 ); |
| 35 | + } |
| 36 | + |
| 37 | + BoneMatrix = reader.ReadMatrix( 4, 4 ); |
| 38 | + |
| 39 | + LogInfo( "name: " + BoneName ); |
| 40 | + |
| 41 | + ChunkType nextChunk = ChunkUtils.PeekNextChunk( reader ); |
| 42 | + switch( nextChunk ) |
| 43 | + { |
| 44 | + case ChunkType.phyBone: |
| 45 | + break; |
| 46 | + case ChunkType.phyBVSphere: |
| 47 | + BoundingVolume = new BVSPChunk(); |
| 48 | + break; |
| 49 | + case ChunkType.phyBVBox: |
| 50 | + BoundingVolume = new BVBXChunk(); |
| 51 | + break; |
| 52 | + case ChunkType.phyBVAlignedCylinder: |
| 53 | + BoundingVolume = new BVACChunk(); |
| 54 | + break; |
| 55 | + case ChunkType.phyBVCapsule: |
| 56 | + BoundingVolume = new BVCPChunk(); |
| 57 | + break; |
| 58 | + case ChunkType.phyBVSurface: |
| 59 | + BoundingVolume = new BVSFChunk(); |
| 60 | + break; |
| 61 | + case ChunkType.phyBVWalkableSurface: |
| 62 | + BoundingVolume = new BVWSChunk(); |
| 63 | + break; |
| 64 | + default: |
| 65 | + //Debugger.Break(); |
| 66 | + break; |
| 67 | + } |
| 68 | + |
| 69 | + if ( BoundingVolume != null ) |
| 70 | + { |
| 71 | + if ( !BoundingVolume.Load( reader ) ) |
| 72 | + { |
| 73 | + return false; |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + End( reader ); |
| 78 | + return true; |
| 79 | + } |
| 80 | + |
| 81 | + public override ChunkType Type() |
| 82 | + { |
| 83 | + return ChunkType.phyBoneSharedData; |
| 84 | + } |
| 85 | + } |
| 86 | +} |
0 commit comments