Changeset 460 for cafu/trunk

Show
Ignore:
Timestamp:
01/11/12 12:10:00 (4 months ago)
Author:
Carsten
Message:

Model code:

  • Removed the now (see r459) obsolete "ChangeNum" stuff from the AnimExpressionT class hierarchy.
  • Fixed a bug in AnimExprBlendT::IsEqual().
Location:
cafu/trunk/Libs/Models
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/Libs/Models/AnimExpr.cpp

    r459 r460  
    2626AnimExpressionT::AnimExpressionT(const CafuModelT& Model) 
    2727    : m_Model(Model), 
    28       m_RefCount(0), 
    29       m_ChangeNum(0) 
    30 { 
    31     UpdateChangeNum(); 
    32 } 
    33  
    34  
    35 void AnimExpressionT::UpdateChangeNum() 
    36 { 
    37     static unsigned int s_ChangeCount=0; 
    38  
    39     m_ChangeNum = ++s_ChangeCount; 
     28      m_RefCount(0) 
     29{ 
    4030} 
    4131 
     
    174164    m_SequNr=SequNr; 
    175165    NormalizeInput(); 
    176  
    177     UpdateChangeNum(); 
    178166} 
    179167 
     
    185173    m_FrameNr=FrameNr; 
    186174    NormalizeInput(); 
    187  
    188     UpdateChangeNum(); 
    189175} 
    190176 
     
    231217    m_SubExpr  =SubExpr; 
    232218    m_ChannelNr=ChannelNr; 
    233  
    234     UpdateChangeNum(); 
    235 } 
    236  
    237  
    238 unsigned int AnimExprFilterT::GetChangeNum() const 
    239 { 
    240     return std::max(AnimExpressionT::GetChangeNum(), m_SubExpr->GetChangeNum()); 
    241219} 
    242220 
     
    286264    m_A=A; 
    287265    m_B=B; 
    288  
    289     UpdateChangeNum(); 
    290 } 
    291  
    292  
    293 unsigned int AnimExprCombineT::GetChangeNum() const 
    294 { 
    295     return std::max(AnimExpressionT::GetChangeNum(), 
    296                     std::max(m_A->GetChangeNum(), m_B->GetChangeNum())); 
    297266} 
    298267 
     
    362331    m_Duration=Duration; 
    363332    m_Frac=0.0f; 
    364  
    365     UpdateChangeNum(); 
    366 } 
    367  
    368  
    369 unsigned int AnimExprBlendT::GetChangeNum() const 
    370 { 
    371     if (m_Frac >= 1.0f) 
    372     { 
    373         return std::max(AnimExpressionT::GetChangeNum(), m_B->GetChangeNum()); 
    374     } 
    375  
    376     return std::max(AnimExpressionT::GetChangeNum(), 
    377                     std::max(m_A->GetChangeNum(), m_B->GetChangeNum())); 
    378333} 
    379334 
     
    437392 
    438393    m_B->AdvanceTime(Time, ForceLoop); 
    439  
    440  
    441     UpdateChangeNum(); 
    442394} 
    443395 
     
    457409 
    458410    if (!Other) return false; 
    459     return m_Frac==Other->m_Frac && m_Duration==Other->m_Duration && m_A->IsEqual(Other->m_A) && m_B->IsEqual(Other->m_B); 
     411    return m_Frac==Other->m_Frac && m_Duration==Other->m_Duration && 
     412           m_B->IsEqual(Other->m_B) && 
     413           (m_A==NULL ? Other->m_A==NULL : m_A->IsEqual(Other->m_A)); 
    460414} 
    461415 
  • cafu/trunk/Libs/Models/AnimExpr.hpp

    r459 r460  
    6565    unsigned int GetRefCount() const { return m_RefCount; } 
    6666 
    67     /// Returns a number that changes whenever this expression changes, 
    68     /// or more precisely, that changes whenever the data returned by GetData() changes. 
    69     /// This is the case for example after every call to AdvanceTime() with a nonzero Time, 
    70     /// or when a sub-expression has been modified (e.g. got a new sequence number assigned). 
    71     /// The caller can use this number in order to control updates of its mesh caches. 
    72     virtual unsigned int GetChangeNum() const { return m_ChangeNum; } 
    73  
    7467    /// For the joint with the given JointNr, this function returns 
    7568    ///   - the joint weight, 
     
    9083 
    9184 
    92     protected: 
    93  
    94     void UpdateChangeNum(); 
    95  
    96  
    9785    private: 
    9886 
     
    10492    const CafuModelT& m_Model;      ///< The related model that this is an anim expression for. 
    10593    unsigned int      m_RefCount;   ///< How many IntrusivePtrT<>'s currently refer to this anim expression? 
    106     unsigned int      m_ChangeNum;  ///< Changes whenever the data returned by GetData() changes. 
    10794}; 
    10895 
     
    156143 
    157144    // Implementations and overrides for base class methods. 
    158     virtual unsigned int GetChangeNum() const; 
    159145    virtual void GetData(unsigned int JointNr, float& Weight, Vector3fT& Pos, cf::math::QuaternionfT& Quat, Vector3fT& Scale) const; 
    160146    virtual void AdvanceTime(float Time, bool ForceLoop=false) { m_SubExpr->AdvanceTime(Time, ForceLoop); } 
     
    180166 
    181167    // Implementations and overrides for base class methods. 
    182     virtual unsigned int GetChangeNum() const; 
    183168    virtual void GetData(unsigned int JointNr, float& Weight, Vector3fT& Pos, cf::math::QuaternionfT& Quat, Vector3fT& Scale) const; 
    184169    virtual void AdvanceTime(float Time, bool ForceLoop=false); 
     
    215200 
    216201    // Implementations and overrides for base class methods. 
    217     virtual unsigned int GetChangeNum() const; 
    218202    virtual void GetData(unsigned int JointNr, float& Weight, Vector3fT& Pos, cf::math::QuaternionfT& Quat, Vector3fT& Scale) const; 
    219203    virtual void AdvanceTime(float Time, bool ForceLoop=false);