Changeset 4597 in orxonox.OLD for orxonox/trunk/src/lib/particles/quick_animation.cc
- Timestamp:
- Jun 11, 2005, 12:55:48 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/particles/quick_animation.cc
r4479 r4597 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 27 27 using namespace std; 28 28 29 30 29 /** 31 30 \brief standard constructor … … 33 32 QuickAnimation::QuickAnimation (void) 34 33 { 35 this->setClass Name("QuickAnimation");34 this->setClassID(CL_QUICK_ANIMATION, "QuickAnimation"); 36 35 37 36 this->first = this->current = NULL; … … 47 46 this->current = this->first; 48 47 QuickKeyFrame delKF; 49 48 50 49 while (this->current != NULL) 51 50 { … … 54 53 this->current = this->first; 55 54 } 56 57 55 } 58 56 … … 70 68 // if it is between some keyframes 71 69 if ((!this->current->next && this->current->position < position) 72 73 70 || (this->current->position < position && this->current->next->position > position)) 71 break; 74 72 // if it is the same as an already existing keyframe 75 73 else if (this->current->position == position) 76 74 return false; 77 75 this->current = this->current->next; 78 76 } … … 92 90 newKey->value = value; 93 91 newKey->position = position; 94 92 95 93 this->current = this->first; 96 94 … … 110 108 { 111 109 if (this->current->position < position+region && this->current->position > position-region) 112 113 114 115 116 this->current = this->current->next; 110 { 111 this->current->value = value; 112 return true; 113 } 114 this->current = this->current->next; 117 115 } 118 116 this->current = this->first; … … 122 120 /* 123 121 \param position The position where to find the Node to kill 124 122 125 123 bool QuickAnimation::removeEntry(float position) 126 124 { 127 125 this->current = this->first; 128 QuickKeyFrame* last = 129 126 QuickKeyFrame* last = 127 130 128 while (this->current) 131 129 { 132 130 if (this->current->position == position) 133 131 { 134 135 132 133 136 134 } 137 this->current = this->current->next; 135 this->current = this->current->next; 138 136 } 139 137 this->current = this->first; … … 145 143 \param position the position to get the value from :) 146 144 */ 147 float QuickAnimation::getValue(float position) 145 float QuickAnimation::getValue(float position) 148 146 { 149 147 if (unlikely(this->first == NULL)) … … 154 152 { 155 153 if (unlikely(position < this->current->position)) 156 157 158 159 160 154 { 155 if (position <= this->first->position) 156 return this->first->value; 157 this->current = this->first; 158 } 161 159 while (likely(this->current->next != NULL && position > this->current->next->position)) 162 160 this->current = this->current->next; 163 161 if (this->current->next == NULL) 164 165 162 return this->current->value; 163 166 164 return this->current->value + (this->current->next->value - this->current->value) 167 165 * ((position-this->current->position) / (this->current->next->position -this->current->position)); 168 166 } 169 167 }
Note: See TracChangeset
for help on using the changeset viewer.