- Timestamp:
- Jan 28, 2007, 2:08:47 AM (18 years ago)
- Location:
- branches/blink/src/world_entities/effects
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blink/src/world_entities/effects/billboard.cc
r10426 r10431 152 152 // changes the color of the texture (if any is set) 153 153 if(this->texColor != NULL) 154 glColor4ub((GLubyte)this->texColor->r()*255, (GLubyte)this->texColor->g()*255, (GLubyte)this->texColor->b()*255, 255);154 glColor4ub((GLubyte)this->texColor->r()*255, (GLubyte)this->texColor->g()*255, (GLubyte)this->texColor->b()*255, (GLubyte)(this->texColor->a()*255)); 155 155 156 156 glBegin(GL_QUADS); -
branches/blink/src/world_entities/effects/blink.cc
r10429 r10431 9 9 10 10 ### File Specific: 11 main-programmer: 11 main-programmer: Lieni 12 12 */ 13 13 … … 19 19 #include "state.h" 20 20 #include "effects/billboard.h" 21 22 #include "material.h"23 24 25 21 26 22 … … 37 33 this->init(); 38 34 39 if( 35 if(root) 40 36 this->loadParams(root); 41 42 // this->bBoard->setSize(this->size, this->size);43 37 } 44 38 … … 49 43 Blink::~Blink () 50 44 { 51 // if (this->material)52 // delete this->material;45 if(bBoard) 46 delete bBoard; 53 47 } 54 48 … … 67 61 this->bBoard->setVisibiliy(true); 68 62 this->bBoard->setTexture("maps/star_alpha.png"); 69 this->bBoard->setAbsCoor(0, 0, 0);70 71 63 72 64 /// Standard values 73 this-> setAbsCoor(0, 0, 0);74 // red if not definedin xml65 this->bBoard->setAbsCoor(0, 0, 0); 66 // default position if not set in xml 75 67 this->color = Color(1, 0, 0); 76 68 // 10x10 pxl if not defined in xml 77 69 this->size = 10; 70 // default angular rate 78 71 this->omega = 10; 79 this->angle = rand() % 1000; 80 PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle); 81 this->angle *= 2 * M_PI; 82 PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle); 72 73 // random start angle, blinkies shouldn't blink synchronous 74 this->angle = (float)rand()/(float)RAND_MAX * 2 * M_PI; 83 75 } 84 76 … … 107 99 this->angle += dt * this->omega; 108 100 109 if(this->angle > 2 * M_PI)101 while (this->angle > 2 * M_PI) 110 102 this->angle -= 2 * M_PI; 111 103 112 this->blinkStr = sinf(angle); 104 // blinkStr should be element of [0, 1] 105 this->blinkStr = (sinf(angle) + 1) / 2; 113 106 114 this->bBoard->colorTexture(Color(color.r(), color.g(), color.b(), 1));107 this->bBoard->colorTexture(Color(color.r(), color.g(), color.b(), this->blinkStr)); 115 108 } 116 109 -
branches/blink/src/world_entities/effects/blink.h
r10429 r10431 34 34 private: 35 35 Billboard* bBoard; 36 //Vector position;37 36 Color color; 38 37 float angle;
Note: See TracChangeset
for help on using the changeset viewer.