- Timestamp:
- Jun 18, 2005, 6:56:00 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/particles/particle_system.cc
r4649 r4654 95 95 this->setType(PARTICLE_DEFAULT_TYPE, 1); 96 96 ParticleEngine::getInstance()->addSystem(this); 97 98 colorAnim[0].setName("test"); //!< \todo delete this line 97 99 } 98 100 -
orxonox/trunk/src/lib/particles/quick_animation.cc
r4649 r4654 34 34 this->setClassID(CL_QUICK_ANIMATION, "QuickAnimation"); 35 35 36 this->first = this->current = NULL; 37 } 38 39 /** 40 \brief standard deconstructor 41 36 // initialize the First KeyFrame (will be deleted if a new one gets created) 37 this->count = 0; 38 this->first = this->current = new QuickKeyFrame; 39 this->first->next = this->first->prev = this->first; 40 this->first->position = 0.0; 41 this->first->value = 0.0; 42 } 43 44 /** 45 \brief deletes all the deconstructor stuff 42 46 */ 43 47 QuickAnimation::~QuickAnimation (void) 44 48 { 45 49 this->current = this->first; 46 QuickKeyFrame delKF; 47 48 while (this->current != NULL) 49 { 50 this->first = this->current->next; 51 delete this->current; 52 this->current = this->first; 53 } 50 QuickKeyFrame* delKF = this->first; 51 52 do 53 { 54 delKF = this->current; 55 this->current = this->current->next; 56 delete delKF; 57 } while (this->current != this->first); 58 54 59 } 55 60 … … 60 65 \returns false if the key existed already for a given position 61 66 */ 62 bool QuickAnimation::addEntry(float position, float value) 63 { 64 this->current = this->first; 65 while (this->current != NULL) 67 void QuickAnimation::addEntry(float position, float value) 68 { 69 if (this->getName()) 70 { 71 printf("ADDED KEYFRAME %d\n", this->count); 72 } 73 74 // create the new KeyFrame 75 QuickKeyFrame* newKey = new QuickKeyFrame; 76 newKey->position = position; 77 newKey->value = value; 78 79 // if we add a KeyFrame for the first Time: 80 if (unlikely (this->count == 0)) 81 { 82 delete this->first; 83 84 newKey->next = newKey; 85 newKey->prev = newKey; 86 this->first = newKey; 87 this->current = newKey; 88 } 89 // if the KeyFrame is in front of the FIRST keyFrame 90 else if (this->first->position > position) 91 { 92 newKey->next = this->first; 93 newKey->prev = this->first->prev; 94 newKey->prev->next = newKey; 95 newKey->next->prev = newKey; 96 97 this->first = newKey; // the new Key becomes the FIRST. 98 } 99 // if the KeyFrame is at the End of the Animation 100 else if (this->first->prev->position < position) 101 { 102 newKey->next = this->first; 103 newKey->prev = this->first->prev; 104 newKey->prev->next = newKey; 105 newKey->next->prev = newKey; 106 } 107 // if the Key is between two frames. 108 else 109 { 110 this->current = this->first; 111 do 66 112 { 67 // if it is between some keyframes 68 if ((!this->current->next && this->current->position < position) 69 || (this->current->position < position && this->current->next->position > position)) 113 if (this->current->position < position && this->current->next->position > position) 70 114 break; 71 115 // if it is the same as an already existing keyframe 72 116 else if (this->current->position == position) 73 return false; 117 { 118 this->current->value = value; 119 delete newKey; 120 return; 121 } 74 122 this->current = this->current->next; 75 } 76 77 QuickKeyFrame* newKey = new QuickKeyFrame; 78 if (this->first == NULL) 79 { 80 this->first = newKey; 81 this->current = newKey; 82 newKey->next = NULL; 83 } 84 else 85 { 86 newKey->next = this->current->next; 87 this->current->next = newKey; 88 } 89 newKey->value = value; 90 newKey->position = position; 91 92 this->current = this->first; 93 94 return true; 123 } while (this->current != this->first); 124 125 newKey->next = this->current->next; 126 newKey->prev = this->current; 127 newKey->next->prev = newKey; 128 newKey->prev->next = newKey; 129 } 130 this->current = this->first; 131 ++this->count; 95 132 } 96 133 … … 100 137 \param region a deviation of the existing keyframe (like a delta in witch to search for 101 138 \param value the new Value 102 */ 103 bool QuickAnimation::changeEntry(float position, float value, float region) 104 { 105 this->current = this->first; 106 while (this->current) 107 { 108 if (this->current->position < position+region && this->current->position > position-region) 109 { 110 this->current->value = value; 111 return true; 112 } 113 this->current = this->current->next; 114 } 115 this->current = this->first; 139 140 \todo rimplement 141 */ 142 void QuickAnimation::changeEntry(float position, float value, float region) 143 { 144 // this->current = this->first; 145 // do 146 // { 147 // if (this->current->position < position+region && this->current->position > position-region) 148 // { 149 // this->current->value = value; 150 // return; 151 // } 152 // this->current = this->current->next; 153 // } while (this->current != this->first); 154 // 155 // this->current = this->first; 116 156 117 157 this->addEntry(position, value); … … 145 185 float QuickAnimation::getValue(float position) 146 186 { 147 i f (unlikely(this->first == NULL))148 return 0.0;149 else if (unlikely (this->first->next == NULL))150 return this->first->value;151 else187 int counter = 0; 188 while (true) 189 { 190 counter++; 191 if (counter >= 10) 152 192 { 153 if (unlikely(position < this->current->position)) 154 { 155 if (position <= this->first->position) 156 return this->first->value; 157 this->current = this->first; 158 } 159 while (likely(this->current->next != NULL && position > this->current->next->position)) 160 this->current = this->current->next; 161 if (this->current->next == NULL) 162 return this->current->value; 163 193 printf("FUCK!!! %f\n", position); 194 this->debug(); 195 break; 196 197 } 198 // if we have a match 199 if (likely(this->current->position <= position && this->current->next->position >= position)) 164 200 return this->current->value + (this->current->next->value - this->current->value) 165 * ((position-this->current->position) / (this->current->next->position -this->current->position)); 166 } 201 * ((position-this->current->position) / (this->current->next->position -this->current->position)); 202 203 else if (unlikely(this->first->prev->position < position)) 204 return this->first->prev->value; 205 else if (unlikely(this->first->position > position)) 206 return this->first->value; 207 else if(likely(this->current->next->position < position)) 208 this->current = this->current->next; 209 else if (likely(this->current->position > position)) 210 this->current = this->current->prev; 211 } 167 212 } 168 213 … … 174 219 this->current = this->first; 175 220 176 PRINT(0)("QuickAnim :: (position, value)");177 while(this->current)221 PRINT(0)("QuickAnim(entries:%d)::(position, value)", this->count); 222 do 178 223 { 179 224 PRINT(0)("->(%f, %f)", this->current->position, this->current->value); 180 225 this->current = this->current->next; 181 } 226 } while(this->current != this->first); 182 227 183 228 PRINT(0)("\n"); -
orxonox/trunk/src/lib/particles/quick_animation.h
r4597 r4654 21 21 this class is optimized for a raising value. eg. 100 particles sorted 22 22 by age. 23 \todo speedUP this stuff (especially getValue)24 23 */ 25 24 class QuickAnimation : public BaseObject { … … 34 33 35 34 QuickKeyFrame* next; //!< The next Animation 35 QuickKeyFrame* prev; //!< The previous QuickKeyFrame 36 36 }; 37 37 … … 39 39 virtual ~QuickAnimation(); 40 40 41 booladdEntry(float position, float value);42 boolchangeEntry(float position, float value, float region = .04);41 void addEntry(float position, float value); 42 void changeEntry(float position, float value, float region = .04); 43 43 44 44 /** \todo implemente thos functions … … 52 52 53 53 private: 54 QuickKeyFrame* first; //!< The first KeyFrame in a Sequence of Keyframes 55 QuickKeyFrame* current; //!< The currently selected KeyFrame 54 QuickKeyFrame* first; //!< The first KeyFrame in a Sequence of Keyframes. 55 QuickKeyFrame* current; //!< The currently selected KeyFrame. 56 unsigned int count; //!< How many Keyframes the QuickAnimation has. 56 57 }; 57 58 -
orxonox/trunk/src/story_entities/world.cc
r4621 r4654 484 484 system->setMass (0.0, 1.0); 485 485 486 system->setColor(0, .5, 0,0,1);487 system->setColor(.5, 1, 1,0,.01);488 system->setColor(1.0, 0, 0,0,0);486 system->setColor(0, .5, 0, 0, 1); 487 system->setColor(.5, 1, 1, 0, .01); 488 system->setColor(1.0, 0, 0, 0, 0); 489 489 490 490
Note: See TracChangeset
for help on using the changeset viewer.