Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7335 in orxonox.OLD


Ignore:
Timestamp:
Apr 18, 2006, 9:03:19 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: adding the same Key with the same Position multiple times does not work anymore (as it should)

Location:
trunk/src/lib/particles
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/particles/quick_animation.cc

    r7334 r7335  
    4848  {
    4949    printf("QuickAnimation::Position MUST BE between 0.0f and 1.0f\n");
     50    return false;
     51  }
     52  if(std::find(this->keyFrames.begin(), this->keyFrames.end(), position) != this->keyFrames.end())
     53  {
     54    printf("QuickAnimation:: key at position %f already added. Use changeValue instead\n", position);
    5055    return false;
    5156  }
  • trunk/src/lib/particles/quick_animation.h

    r7334 r7335  
    4343   * @param position The position to get the Value from.
    4444   */
    45   void QuickAnimation::getValue(float& value, float position) const
     45  void getValue(float& value, float position) const
    4646  {
    4747    value = this->lookupValues[int(position*this->lookupValues.size())];
     
    5353   * @returns the calculated Value.
    5454   */
    55   float QuickAnimation::getValue(float position) const
     55  float getValue(float position) const
    5656  {
    5757    return this->lookupValues[int(position*this->lookupValues.size())];
     
    6969    //! Creates a new QuickKeyFrame with @param position position @param value value */
    7070    QuickKeyFrame(float position, float value) :  position(position), value(value) {};
     71    //! compares this->position with position @param position pos to compare, @returns true on match.
     72    bool operator==(float position) { return this->position == position; };
    7173    float            value;             //!< The value of this KeyFrame
    7274    float            position;          //!< The position of thies KeyFrame
Note: See TracChangeset for help on using the changeset viewer.