Changeset 505
- Timestamp:
- 02/13/08 12:41:20 (11 months ago)
- Files:
-
- branches/morph-targets/libx42.net/Group.cpp (modified) (2 diffs)
- branches/morph-targets/libx42.net/Group.h (modified) (3 diffs)
- branches/morph-targets/libx42.net/Model.cpp (modified) (2 diffs)
- branches/morph-targets/libx42.net/Model.h (modified) (3 diffs)
- branches/morph-targets/libx42.net/MorphDeltaData.cpp (added)
- branches/morph-targets/libx42.net/MorphDeltaData.h (added)
- branches/morph-targets/libx42.net/MorphTarget.cpp (modified) (4 diffs)
- branches/morph-targets/libx42.net/MorphTarget.h (modified) (6 diffs)
- branches/morph-targets/libx42.net/VertexData.cpp (modified) (2 diffs)
- branches/morph-targets/libx42.net/libx42.net.vcproj (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/morph-targets/libx42.net/Group.cpp
r462 r505 29 29 #include "VertexData.h" 30 30 #include "UtilTypes.h" 31 #include "MorphTarget.h" 31 32 32 33 using namespace System; … … 43 44 indices = gcnew IndexCollection( owner, this ); 44 45 verts = gcnew VertexData( this ); 46 morphs = gcnew MorphData( this ); 45 47 } 46 48 branches/morph-targets/libx42.net/Group.h
r462 r505 35 35 ref class IndexCollection; 36 36 ref class VertexData; 37 ref class MorphData; 37 38 38 39 public ref class Group … … 85 86 } 86 87 88 property MorphData^ Morphs 89 { 90 MorphData^ get( void ) { return morphs; } 91 } 92 87 93 internal: 88 94 Group( Model ^owner, int index ); … … 95 101 IndexCollection^ indices; 96 102 VertexData^ verts; 103 MorphData ^morphs; 97 104 }; 98 105 branches/morph-targets/libx42.net/Model.cpp
r504 r505 39 39 #include "VertexData.h" 40 40 #include "MorphTarget.h" 41 #include "MorphDeltaData.h" 41 42 42 43 using namespace System; … … 141 142 infs = gcnew InfluenceCollection( this ); 142 143 tags = gcnew TagCollection( this ); 143 morphDeltas = gcnew MorphDeltaCollection( this ); 144 morphs = gcnew Libx42::MorphData( this ); 145 morphData = gcnew MorphDeltaData( this ); 144 146 groups = gcnew GroupCollection( this, 0, m->header.numGroups ); 145 147 lods = gcnew LodCollection( this ); branches/morph-targets/libx42.net/Model.h
r504 r505 51 51 ref class AnimationBuffer; 52 52 ref class AnimationData; 53 ref class MorphDeltaCollection; 53 ref class MorphData; 54 ref class MorphDeltaData; 54 55 55 56 public value struct Sphere … … 178 179 } 179 180 180 property MorphDeltaCollection^ MorphDeltas 181 { 182 MorphDeltaCollection^ get( void ) { return morphDeltas; } 181 property MorphData^ Morphs 182 { 183 MorphData^ get( void ) { return morphs; } 184 } 185 186 property MorphDeltaData^ MorphData 187 { 188 MorphDeltaData^ get( void ) { return morphData; } 183 189 } 184 190 … … 253 259 LodCollection ^lods; 254 260 IndexCollection ^indices; 255 MorphDeltaCollection ^morphDeltas; 261 Libx42::MorphData ^morphs; 262 MorphDeltaData ^morphData; 256 263 257 264 VertexData ^verts; branches/morph-targets/libx42.net/MorphTarget.cpp
r504 r505 24 24 #include "MorphTarget.h" 25 25 26 #include "MorphDeltaData.h" 26 27 #include "Model.h" 27 28 #include "Group.h" … … 37 38 : owner( owner ), index( index ) 38 39 { 39 40 deltaData = gcnew MorphDeltaData( this ); 40 41 } 41 42 … … 64 65 List< MorphDelta^ > ^lst = gcnew List< MorphDelta^ >; 65 66 66 for ( int i = 0; i < group->Owner->MorphDeltas->Count; i++)67 for each( MorphDelta ^delta in group->Owner->Morphs->Deltas ) 67 68 { 68 if( group->Owner->MorphDeltas[i]->TargetGroup == group )69 lst->Add( group->Owner->MorphDeltas[i]);69 if( delta->TargetGroup == group ) 70 lst->Add( delta ); 70 71 } 71 72 … … 73 74 } 74 75 75 MorphDeltaCollection::MorphDeltaCollection( Mo rphTarget ^target)76 : ModelItemCollection( target->Owner )76 MorphDeltaCollection::MorphDeltaCollection( Model ^owner, IEnumerable< MorphDelta^ > ^deltas ) 77 : ModelItemCollection( owner ) 77 78 { 79 items = (gcnew List< MorphDelta^ >( deltas ))->ToArray(); 80 } 81 82 MorphTarget::MorphTarget( Model ^owner, IEnumerable< MorphDelta^ > ^deltas ) 83 : owner( owner ) 84 { 85 morphDeltas = gcnew MorphDeltaCollection( owner, deltas ); 86 for each( MorphDelta ^delta in morphDeltas ) 87 delta->target = this; 88 } 89 90 String^ MorphTarget::Name::get( void ) 91 { 92 return owner->GetModelString( morphDeltas[0]->RawTarget.targetName ); 93 } 94 95 MorphTargetCollection::MorphTargetCollection( Model ^owner, IEnumerable< MorphTarget^ > ^targets ) 96 : ModelItemCollection( owner ) 97 { 98 items = (gcnew List< MorphTarget^ >( targets ))->ToArray(); 99 } 100 101 MorphData::MorphData( Model ^owner ) 102 : owner( owner ) 103 { 104 deltas = gcnew MorphDeltaCollection( owner ); 105 106 List< List< MorphDelta^ >^ > ^targLists = gcnew List< List< MorphDelta^ >^ >; 107 for each( MorphDelta ^delta in deltas ) 108 { 109 List< MorphDelta^ > ^target = nullptr; 110 111 for each( List< MorphDelta^ > ^targ in targLists ) 112 { 113 if( targ[0]->RawTarget.targetName == delta->RawTarget.targetName ) 114 { 115 target = targ; 116 break; 117 } 118 } 119 120 if( !target ) 121 { 122 target = gcnew List< MorphDelta^ >; 123 targLists->Add( target ); 124 } 125 126 target->Add( delta ); 127 } 128 129 List< MorphTarget^ > ^targets = gcnew List< MorphTarget^ >; 130 for each( List< MorphDelta^ > ^targ in targLists ) 131 targets->Add( gcnew MorphTarget( owner, targ ) ); 132 133 MorphData::targets = gcnew MorphTargetCollection( owner, targets ); 134 } 135 136 MorphData::MorphData( Group ^group ) 137 : owner( group->Owner ) 138 { 139 deltas = gcnew MorphDeltaCollection( group ); 140 141 List< MorphTarget^ > ^targets = gcnew List< MorphTarget^ >; 142 for each( MorphDelta ^delta in deltas ) 143 { 144 if( !targets->Contains( delta->MorphTarget ) ) 145 targets->Add( delta->MorphTarget ); 146 } 147 148 MorphData::targets = gcnew MorphTargetCollection( owner, targets ); 78 149 } 79 150 branches/morph-targets/libx42.net/MorphTarget.h
r504 r505 31 31 ref class Model; 32 32 ref class Group; 33 ref class MorphDeltaData; 33 34 34 35 ref class MorphTarget; 36 ref class MorphData; 35 37 36 38 public ref class MorphDelta … … 47 49 property Libx42::MorphTarget^ MorphTarget { Libx42::MorphTarget^ get( void ) { return target; } } 48 50 51 property MorphDeltaData^ DeltaData { MorphDeltaData^ get( void ) { return deltaData; } } 52 49 53 internal: 50 54 Libx42::MorphTarget ^target; … … 54 58 Model ^owner; 55 59 int index; 60 61 MorphDeltaData ^deltaData; 56 62 }; 57 63 … … 62 68 MorphDeltaCollection( Model ^owner ); 63 69 MorphDeltaCollection( Group ^group ); 64 MorphDeltaCollection( Mo rphTarget ^target);70 MorphDeltaCollection( Model ^owner, Collections::Generic::IEnumerable< MorphDelta^ > ^deltas ); 65 71 }; 66 72 … … 71 77 72 78 property MorphDeltaCollection^ MorphDeltas { MorphDeltaCollection^ get( void ) { return morphDeltas; } } 79 property String^ Name { String^ get( void ); } 80 73 81 internal: 74 82 MorphTarget( Model ^owner, Collections::Generic::IEnumerable< MorphDelta^ > ^deltas ); 83 75 84 private: 76 85 Model ^owner; … … 79 88 }; 80 89 90 public ref class MorphTargetCollection 91 : public ModelItemCollection< MorphTarget^ > 92 { 93 public: 94 95 internal: 96 MorphTargetCollection( Model ^owner, Collections::Generic::IEnumerable< MorphTarget^ > ^targets ); 81 97 82 98 }; 99 100 public ref class MorphData 101 { 102 public: 103 property Model^ Owner { Model^ get( void ) { return owner; } } 104 105 property MorphTargetCollection^ Targets { MorphTargetCollection^ get( void ) { return targets; } } 106 property MorphDeltaCollection^ Deltas { MorphDeltaCollection^ get( void ) { return deltas; } } 107 108 internal: 109 MorphData( Model ^owner ); 110 MorphData( Group ^group ); 111 112 private: 113 Model ^owner; 114 MorphTargetCollection ^targets; 115 MorphDeltaCollection ^deltas; 116 }; 117 118 }; branches/morph-targets/libx42.net/VertexData.cpp
r462 r505 129 129 : owner( model ) 130 130 { 131 offset = 0; 132 count = model->m->header.numVerts; 133 134 InitStreams( offset, count ); 131 InitStreams( 0, model->m->header.numVerts ); 135 132 } 136 133 … … 138 135 : owner( group->Owner ) 139 136 { 140 offset = group->RawGroup.firstVert; 141 count = group->RawGroup.numVerts; 142 143 InitStreams( offset, count ); 137 InitStreams( group->RawGroup.firstVert, group->RawGroup.numVerts ); 144 138 } 145 139 146 140 void VertexData::InitStreams( int startIdx, int count ) 147 141 { 142 VertexData::offset = startIdx; 143 VertexData::count = count; 144 148 145 vp = gcnew DataStream< VertexPosition >( owner, owner->m->vertPos + startIdx, sizeof( x42vertAnim_t ), 0, count ); 149 146 branches/morph-targets/libx42.net/libx42.net.vcproj
r504 r505 289 289 </File> 290 290 <File 291 RelativePath=".\MorphDeltaData.cpp" 292 > 293 </File> 294 <File 295 RelativePath=".\MorphDeltaData.h" 296 > 297 </File> 298 <File 291 299 RelativePath=".\MorphTarget.cpp" 292 300 >
