Ignore:
Timestamp:
07/16/15 21:21:19 (10 years ago)
Author:
epyon
Message:
  • refactoring WIP! (compiles though - warnings on purpose)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/formats/md5_loader.cc

    r423 r424  
    118118                        {
    119119                                std::string name;
    120                                 sstream >> name >> nodes[i].parent_id;
     120                                sint16 parent_id;
     121                                sstream >> name >> parent_id;
    121122                                vec3 pos;
    122123                                quat orient;
     
    128129                                unit_quat_w( orient );
    129130                                remove_quotes( name );
    130 //                              nodes[i].name = name;
    131                                 nodes[i].name = hash_string< uint64 >( name.c_str() );
    132 //                              nodes[i].target_id       = -1;
    133                                 nodes[i].parent_id       = -1;
    134                                 nodes[i].transform       = transform( pos, orient ).inverse().extract();
    135                                 nodes[i].data            = nullptr;
     131                                nodes[i].data       = data_channel_set_creator::create_set( 0 );
     132                                data_channel_set_creator access( nodes[i].data );
     133                                access.set_parent_id( parent_id );
     134                                access.set_transform( transform( pos, orient ).inverse().extract() );
     135                                access.set_name( hash_string< uint64 >( name.c_str() ) );
    136136                                next_line( sstream );
    137137                        }
     
    141141                {
    142142                        assert( m_type == MESH );
    143                         data_channel_set* mesh = data_channel_set_creator::create( 4 );
     143                        data_channel_set* mesh = data_channel_set_creator::create_set( 4 );
    144144                        data_channel_set_creator maccess( mesh );
    145145
     
    251251                        {
    252252                                std::string    name;
    253                                 sstream >> name >> nodes[i].parent_id >> joint_infos[i].flags >> joint_infos[i].start_index;
     253                                sint16 parent_id;
     254                                sstream >> name >> parent_id >> joint_infos[i].flags >> joint_infos[i].start_index;
    254255                                remove_quotes( name );
    255 //                              nodes[i].name = name;
    256                                 nodes[i].name = hash_string< uint64 >( name.c_str() );
    257                                 nodes[i].transform = mat4();
    258                                 nodes[i].data = data_channel_set_creator::create( 1 );
    259                                 data_channel_set_creator( nodes[i].data ).add_channel< md5_key_t >( num_frames );
     256                                nodes[i].data = data_channel_set_creator::create_set( 1 );
     257                                data_channel_set_creator access( nodes[i].data );
     258                                access.add_channel< md5_key_t >( num_frames );
     259                                access.set_name( hash_string< uint64 >( name.c_str() ) );
     260                                access.set_parent_id( parent_id );
    260261                                next_line( sstream );
    261262                        }
     
    391392                                md5_weight& weight           = weights[start_weight + j];
    392393                                const mesh_node_data&  joint = nodes[weight.joint_id];
    393                                 const transform tr = transform( joint.transform ).inverse();
     394                                const transform tr = transform( joint.data->get_transform() ).inverse();
    394395                                vec3 rot_pos = tr.get_orientation() * weight.pos;
    395396
     
    454455                {
    455456                        const mesh_node_data&  joint = nodes[vdata.boneindex[j]];
    456                         const transform tr = transform( joint.transform ).inverse();
     457                        const transform tr = transform( joint.data->get_transform() ).inverse();
    457458                        vdata.normal  += ( normal  * tr.get_orientation() ) * vdata.boneweight[j];
    458459                        vdata.tangent += ( tangent * tr.get_orientation() ) * vdata.boneweight[j];
     
    472473                const md5_joint_info& jinfo = joint_infos[i];
    473474                mesh_node_data& joint = nodes[i];
    474                 int parent_id         = joint.parent_id;
     475                int parent_id         = joint.data->get_parent_id();
    475476
    476477                vec3 pos    = base_frames[i].get_position();
     
    519520{
    520521        uint32 size = m_meshes.size();
    521         data_channel_set* meshes = data_channel_set_creator::create_array( size, 4 );
     522        data_channel_set* meshes = data_channel_set_creator::create_set_array( size, 4 );
    522523        for ( uint32 i = 0; i < size; ++i )
    523524        {
Note: See TracChangeset for help on using the changeset viewer.