Ignore:
Timestamp:
07/21/14 02:19:34 (11 years ago)
Author:
epyon
Message:
  • full pure data model for animation
  • all loaders now use pure data model instead of the template/virtual one
File:
1 edited

Legend:

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

    r284 r285  
    138138                m_animation->nodes[i].parent_id     = node_header.parent_id;
    139139                m_animation->nodes[i].transform     = node_header.transform;
    140                 m_animation->nodes[i].channel_count = ch_count;
    141                 m_animation->nodes[i].channels      = nullptr;
     140                m_animation->nodes[i].data          = nullptr;
    142141                if ( ch_count > 0 )
    143142                {
    144                         m_animation->nodes[i].channels      = new key_raw_channel* [ch_count];
     143                        key_data* kdata = new key_data;
     144                        m_animation->nodes[i].data = kdata;
    145145                        for ( uint32 c = 0; c < ch_count; ++c )
    146146                        {
     
    151151                                key_raw_channel* channel = key_raw_channel::create( cheader.format, cheader.count );
    152152                                source.read( channel->data, channel->desc.size, channel->count );
    153                                 m_animation->nodes[i].channels[c] = channel;
     153                                kdata->add_channel( channel );
    154154                        }
    155155                }
     
    168168        {
    169169                nmd_node& node = m_animation->nodes[n];
    170                 key_animation_data* keys = nullptr;
    171                 if ( node.channel_count > 1 )
    172                 {
    173                         keys = new nv::key_vectors_prs( node.channels[0], node.channels[1], node.channels[2] );
    174                 }
    175                 else if ( node.channel_count == 1 )
    176                 {
    177                         keys      =  new nv::transform_vector( node.channels[0] );
    178                         node.channels[0] = nullptr;
    179                         node.channel_count = 0;
    180                 }
    181                 m_data.push_back( keys );
     170                m_data.push_back( node.data );
     171                node.data = nullptr;
    182172        }
    183173
     
    239229                        nv::mat4 node_mat( node->transform );
    240230
    241                         if ( m_data[n] && !m_data[n]->empty() )
     231                        if ( m_data[n] )
    242232                        {
    243233                                node_mat = m_data[n]->get_matrix( anim_time );
     
    257247        mat4 node_mat( node->transform );
    258248
    259         if ( m_data[ node_id ] && !m_data[ node_id ]->empty() )
     249        if ( m_data[ node_id ] )
    260250        {
    261251                node_mat = m_data[ node_id ]->get_matrix( time );
Note: See TracChangeset for help on using the changeset viewer.