Changeset 512

Show
Ignore:
Timestamp:
02/20/08 14:04:56 (11 months ago)
Author:
phill
Message:

o More work.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/morph-targets/libx42make/include/x42make-modelbuilder.h

    r511 r512  
    370370        void remap_vertices( const std::vector< index > &remap ); 
    371371 
     372        size_t vertex_count() const { return base_shape.size(); } 
     373        size_t index_count() const { return indices.size(); } 
     374 
    372375        bool is_valid() const; 
    373376}; 
     
    386389}; 
    387390 
     391class group_enumerator; 
     392 
    388393class lod : public ref_obj 
    389394{ 
     
    396401 
    397402private: 
    398         lod() { } 
     403        model_builder                           *owner; 
     404        lod( model_builder *owner ) : owner( owner ) { } 
    399405 
    400406        friend class model_builder; 
     407        friend class group_enumerator; 
    401408}; 
    402409 
     
    437444        void begin_skeleton_update(); 
    438445        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 ); 
    439455 
    440456private: 
     
    455471        void notify_influence_bone( influence *influence ); 
    456472        void validate_influences(); 
     473        void erase_influence( const influence_ptr &influence ); 
    457474 
    458475        void validate_tag_bone( tag *tag, const bone_ptr &new_bone ); 
     
    465482}; 
    466483 
     484class group_enumerator 
     485{ 
     486public: 
     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 
     498private: 
     499        model_builder   *model; 
     500        size_t                  beg_lod, end_lod, cur_lod; 
     501        int                             cur_grp; 
     502}; 
     503 
     504class vertex_enumerator 
     505{ 
     506public: 
     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 
     520private: 
     521        group_enumerator        groups; 
     522        group_ptr                       cur_grp; 
     523        int                                     cur_idx; 
     524}; 
     525 
    467526}; 
    468527}; 
  • branches/morph-targets/libx42make/libx42make.vcproj

    r509 r512  
    657657                </File> 
    658658                <File 
     659                        RelativePath=".\modelbuilder-enumerators.cpp" 
     660                        > 
     661                </File> 
     662                <File 
    659663                        RelativePath=".\modelbuilder-geometry.cpp" 
     664                        > 
     665                </File> 
     666                <File 
     667                        RelativePath=".\modelbuilder-influences.cpp" 
    660668                        > 
    661669                </File> 
  • branches/morph-targets/libx42make/modelbuilder-geometry.cpp

    r511 r512  
    212212} 
    213213 
     214/* 
     215        class model_builder 
     216*/ 
     217 
    214218}; 
    215219}; 
  • branches/morph-targets/libx42make/modelbuilder-skeleton.cpp

    r511 r512  
    5151 
    5252/* 
    53         class influence 
    54 */ 
    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 /* 
    6653        class tag 
    6754*/ 
     
    274261} 
    275262 
    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 ) const 
    310 { 
    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  
    332263void model_builder::begin_tag_update() 
    333264{ 
  • branches/morph-targets/libx42make/modelbuilder.cpp

    r509 r512  
    9292        } 
    9393 
    94         lod_ptr ret( new lod() ); 
     94        lod_ptr ret( new lod( this ) ); 
    9595 
    9696        ret->lod_number = lod_number; 
  • branches/morph-targets/x42maya/Export-Gather.cpp

    r508 r512  
    200200                return true; 
    201201        } 
    202         catch( const error& ) 
     202        catch( const x42::error& ) 
    203203        { 
    204204                return false;