Changeset 512
- Timestamp:
- 02/20/08 14:04:56 (11 months ago)
- Files:
-
- branches/morph-targets/libx42make/include/x42make-modelbuilder.h (modified) (6 diffs)
- branches/morph-targets/libx42make/libx42make.vcproj (modified) (1 diff)
- branches/morph-targets/libx42make/modelbuilder-enumerators.cpp (added)
- branches/morph-targets/libx42make/modelbuilder-geometry.cpp (modified) (1 diff)
- branches/morph-targets/libx42make/modelbuilder-influences.cpp (added)
- branches/morph-targets/libx42make/modelbuilder-skeleton.cpp (modified) (2 diffs)
- branches/morph-targets/libx42make/modelbuilder.cpp (modified) (1 diff)
- branches/morph-targets/x42maya/Export-Gather.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/morph-targets/libx42make/include/x42make-modelbuilder.h
r511 r512 370 370 void remap_vertices( const std::vector< index > &remap ); 371 371 372 size_t vertex_count() const { return base_shape.size(); } 373 size_t index_count() const { return indices.size(); } 374 372 375 bool is_valid() const; 373 376 }; … … 386 389 }; 387 390 391 class group_enumerator; 392 388 393 class lod : public ref_obj 389 394 { … … 396 401 397 402 private: 398 lod() { } 403 model_builder *owner; 404 lod( model_builder *owner ) : owner( owner ) { } 399 405 400 406 friend class model_builder; 407 friend class group_enumerator; 401 408 }; 402 409 … … 437 444 void begin_skeleton_update(); 438 445 void end_skeleton_update(); 446 447 //unbinds all vertices from influence 448 void unbind_influence( const influence_ptr &influence ); 449 //unbinds all vertices from influence and removes it from the model 450 void unbind_and_remove_influence( const influence_ptr &influence ); 451 //unbinds all vertices from old_influence and binds them to new_influence with the same weight 452 void rebind_influence( const influence_ptr &old_influence, const influence_ptr &new_influence ); 453 //unbinds all vertices from old_influence and binds them to new_influence with the same weight, then removes old_influence 454 void rebind_and_remove_influence( const influence_ptr &old_influence, const influence_ptr &new_influence ); 439 455 440 456 private: … … 455 471 void notify_influence_bone( influence *influence ); 456 472 void validate_influences(); 473 void erase_influence( const influence_ptr &influence ); 457 474 458 475 void validate_tag_bone( tag *tag, const bone_ptr &new_bone ); … … 465 482 }; 466 483 484 class group_enumerator 485 { 486 public: 487 group_enumerator(); 488 489 explicit group_enumerator( model_builder &model ); 490 explicit group_enumerator( const lod_ptr &lod ); 491 492 group_enumerator( const group_enumerator &src ); 493 494 void reset(); 495 bool next(); 496 group_ptr current(); 497 498 private: 499 model_builder *model; 500 size_t beg_lod, end_lod, cur_lod; 501 int cur_grp; 502 }; 503 504 class vertex_enumerator 505 { 506 public: 507 vertex_enumerator(); 508 509 vertex_enumerator( model_builder &model ); 510 vertex_enumerator( const lod_ptr &lod ); 511 vertex_enumerator( const group_ptr &group ); 512 513 vertex_enumerator( const vertex_enumerator &src ); 514 515 void reset(); 516 bool next(); 517 size_t current_index(); 518 geometry& current_geometry(); 519 520 private: 521 group_enumerator groups; 522 group_ptr cur_grp; 523 int cur_idx; 524 }; 525 467 526 }; 468 527 }; branches/morph-targets/libx42make/libx42make.vcproj
r509 r512 657 657 </File> 658 658 <File 659 RelativePath=".\modelbuilder-enumerators.cpp" 660 > 661 </File> 662 <File 659 663 RelativePath=".\modelbuilder-geometry.cpp" 664 > 665 </File> 666 <File 667 RelativePath=".\modelbuilder-influences.cpp" 660 668 > 661 669 </File> branches/morph-targets/libx42make/modelbuilder-geometry.cpp
r511 r512 212 212 } 213 213 214 /* 215 class model_builder 216 */ 217 214 218 }; 215 219 }; branches/morph-targets/libx42make/modelbuilder-skeleton.cpp
r511 r512 51 51 52 52 /* 53 class influence54 */55 56 void influence::bone( const bone_ptr &new_bone )57 {58 owner->validate_influence_bone( this, new_bone );59 60 _bone = new_bone;61 62 owner->notify_influence_bone( this );63 }64 65 /*66 53 class tag 67 54 */ … … 274 261 } 275 262 276 void model_builder::begin_influence_update()277 {278 _influence_update_count++;279 }280 281 void model_builder::end_influence_update()282 {283 if( !_influence_update_count )284 throw error();285 286 if( _influence_update_count == 1 )287 {288 validate_influences();289 }290 291 _influence_update_count--;292 }293 294 influence_ptr model_builder::create_influence( const bone_ptr &bone, const affine &matrix )295 {296 validate_influence_bone( null, bone );297 298 influence_ptr ret( new influence( this ) );299 300 ret->_bone = bone;301 ret->matrix = matrix;302 303 ret->_index = influences.size();304 influences.push_back( ret );305 306 return ret;307 }308 309 void model_builder::validate_influence_bone( influence * /* influence */, const bone_ptr &new_bone ) const310 {311 if( _influence_update_count )312 return;313 314 validate_bone_prop( new_bone );315 }316 317 void model_builder::notify_influence_bone( influence * /* influence */ )318 {319 }320 321 void model_builder::validate_influences()322 {323 if( _influence_update_count )324 return;325 326 for( size_t i = 0; i < influences.size(); i++ )327 {328 validate_influence_bone( influences[i].get(), influences[i]->_bone );329 }330 }331 332 263 void model_builder::begin_tag_update() 333 264 { branches/morph-targets/libx42make/modelbuilder.cpp
r509 r512 92 92 } 93 93 94 lod_ptr ret( new lod( ) );94 lod_ptr ret( new lod( this ) ); 95 95 96 96 ret->lod_number = lod_number; branches/morph-targets/x42maya/Export-Gather.cpp
r508 r512 200 200 return true; 201 201 } 202 catch( const error& )202 catch( const x42::error& ) 203 203 { 204 204 return false;
