Changeset 568

Show
Ignore:
Timestamp:
04/25/08 17:43:33 (9 months ago)
Author:
phill
Message:

o WIP stuff.

Files:

Legend:

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

    r567 r568  
    498498        morph_target_ptr find_morph_target( const std::string &name ) const; 
    499499        morph_target_ptr create_morph_target( const std::string &name ); 
     500 
     501        void append( const geometry &geom ); 
    500502 
    501503        /* 
  • branches/morph-targets/libx42make/modelbuilder-geometry.cpp

    r545 r568  
    256256} 
    257257 
     258void geometry::append( const geometry &geom ) 
     259{ 
     260        if( !are_vert_arrays_parallell() ) 
     261                throw error( "Can't append to an invalid group." ); 
     262 
     263        if( !geom.are_vert_arrays_parallell() ) 
     264                throw error( "Can't append an invalid group." ); 
     265 
     266        if( geom.prim_type.to_list_type() != prim_type.to_list_type() ) 
     267                throw error( "Can't append a group with an incompatible primitive type." ); 
     268 
     269        size_t base_vert = base_shape.size(); 
     270 
     271        base_shape.insert( base_shape.end(), 
     272                geom.base_shape.begin(), geom.base_shape.end() ); 
     273        weights.insert( weights.end(), 
     274                geom.weights.begin(), geom.weights.end() ); 
     275        attributes.insert( attributes.end(), 
     276                geom.attributes.begin(), geom.attributes.end() ); 
     277 
     278        std::vector< bool > targets_appended( geom.morph_targets.size(), false ); 
     279        for( size_t i = 0; i < morph_targets.size(); i++ ) 
     280        { 
     281                morph_target_ptr dst = morph_targets[i]; 
     282                const_morph_target_ptr src; 
     283 
     284                for( size_t j = 0; !src && j < geom.morph_targets.size(); j++ ) 
     285                { 
     286                        if( geom.morph_targets[j]->name() == dst->name() ) 
     287                        { 
     288                                src = geom.morph_targets[j]; 
     289                                targets_appended[j] = true; 
     290                        } 
     291                } 
     292 
     293                if( src ) 
     294                { 
     295                        dst->vertices.insert( dst->vertices.end(), 
     296                                src->vertices.begin(), src->vertices.end() ); 
     297                } 
     298                else 
     299                { 
     300                        //pull in an identity target (copy the base shape) 
     301                        dst->vertices.insert( dst->vertices.end(), 
     302                                geom.base_shape.begin(), geom.base_shape.end() ); 
     303                } 
     304        } 
     305 
     306        //add in any morph targets that haven't already been merged in 
     307        for( size_t i = 0; i < geom.morph_targets.size(); i++ ) 
     308        { 
     309                if( targets_appended[i] ) 
     310                        //already handled 
     311                        continue; 
     312 
     313                const_morph_target_ptr src = geom.morph_targets[i]; 
     314                morph_target_ptr dst = create_morph_target( src->name() ); 
     315 
     316                dst->vertices.insert( dst->vertices.end(), 
     317                        base_shape.begin(), base_shape.begin() + base_vert ); 
     318                dst->vertices.insert( dst->vertices.end(), 
     319                        src->vertices.begin(), src->vertices.end() ); 
     320        } 
     321 
     322        if( geom.prim_type == prim_type ) 
     323        { 
     324                indices.reserve( indices.size() + geom.indices.size() ); 
     325                for( size_t i = 0; i < geom.indices.size(); i++ ) 
     326                        indices.push_back( checked_int_cast< index >( geom.indices[i] + base_vert ) ); 
     327        } 
     328        else 
     329        { 
     330                std::vector< index > list_indices = geom.get_list_indices(); 
     331                indices.reserve( indices.size() + list_indices.size() ); 
     332                for( size_t i = 0; i < list_indices.size(); i++ ) 
     333                        indices.push_back( checked_int_cast< index >( list_indices[i] + base_vert ) ); 
     334        } 
     335} 
     336 
    258337void geometry::remap_vertices( const std::vector< index > &remap ) 
    259338{ 
  • branches/morph-targets/x42maya/modelexporter-gather.cpp

    r567 r568  
    359359} 
    360360 
     361std::vector< mesh_part model_exporter::import_mesh_geometry( MObject &mesh_obj ) 
     362{ 
     363        MStatus stat; 
     364 
     365        MFnMesh mesh( mesh_obj, &stat ); 
     366        check_status( stat ); 
     367 
     368 
     369} 
     370 
    361371}; 
    362372}; 
  • branches/morph-targets/x42maya/modelexporter.h

    r567 r568  
    177177        bone_ptr import_bone( const MDagPath &path ); 
    178178 
     179        struct mesh_part 
     180        { 
     181                std::string             surface_name; 
     182                std::string             shader_name; 
     183                make::geometry  geometry; 
     184        }; 
     185 
     186        std::vector< mesh_part > import_mesh_geometry( MObject &mesh_obj ); 
     187 
    179188        MObject get_skin_input( const MObject &draw_mesh ); 
    180189        uint get_lod_number( const MObject &mesh );