- Timestamp:
- Jan 24, 2007, 11:30:09 AM (18 years ago)
- Location:
- branches/blink/src/world_entities/effects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blink/src/world_entities/effects/blink.cc
r10253 r10325 19 19 #include "debug.h" 20 20 #include "state.h" 21 21 22 22 23 #include "material.h" … … 70 71 //this->material->setBlendFunc(GL_ZERO,GL_ZERO); 71 72 //this->material->setDiffuseMap("pictures/rblink2.png"); 72 this->material->setDiffuseMap("maps/star .bmp");73 this->material->setDiffuseMap("maps/star_alpha.png"); 73 74 //this->setAbsCoor(0, 0, 0);d 74 75 //this->setVisibiliy(true); 75 76 // this->setSize(5, 5); 76 77 78 //srand((unsigned)time(NULL)); 79 80 81 /// Standard values 77 82 this->setAbsCoor(0, 0, 0); 78 this->position = Vector(0, 0, 0); ///remove 83 this->position = Vector(0, 0, 0); ///remove 84 this->color = Vector(255, 255, 255); 79 85 this->size = 10; 86 this->omega = 10; 87 this->angle = rand() % 1000; 88 PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle); 89 this->angle *= 2 * M_PI; 90 PRINTF(0)("\n\n\n\n\n\n\nangle: %f\n\n\n\n\n\n\n\n", this->angle); 80 91 } 81 92 … … 91 102 LoadParam(root, "position", this, Blink, setPosition); 92 103 LoadParam(root, "size", this, Blink, setSize); 104 LoadParam(root, "color", this, Blink, setColor); 105 LoadParam(root, "omega", this, Blink, setOmega); 93 106 // LoadParam(root, "watersize", this, Blink, setWaterSize); 94 107 // LoadParam(root, "wateruv", this, Blink, setWaterUV); … … 116 129 void Blink::tick(float dt) 117 130 { 131 this->angle += dt * this->omega; 132 133 if (this->angle > 2 * M_PI) 134 this->angle -= 2 * M_PI; 135 136 this->blinkStr = sinf(angle); 118 137 } 119 138 … … 125 144 { 126 145 glPushAttrib(GL_ENABLE_BIT); 127 gl Disable(GL_LIGHTING);146 glEnable(GL_LIGHTING); //glDisable(GL_LIGHTING); 128 147 glDisable(GL_FOG); 129 148 glMatrixMode(GL_MODELVIEW); … … 147 166 // glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 148 167 149 glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Set The Blending Function For Translucency 150 glEnable(GL_BLEND); 151 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); 168 // glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Set The Blending Function For Translucency 169 // glEnable(GL_BLEND); 170 // glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); 171 // glShadeModel(GL_SMOOTH); 172 173 174 Vector camCoor = State::getCameraNode()->getAbsCoor(); 175 Vector diff = camCoor - this->position; 152 176 153 177 //glTranslatef(position.x + size/2, position.y + size/2, position.z); … … 164 188 165 189 166 glColor4ub( 255, 0, 0, 255);190 glColor4ub(this->color.x, this->color.y, this->color.z, 127.5*(this->blinkStr + 1)); 167 191 glBegin(GL_QUADS); 168 192 glTexCoord2f(1, 1); glVertex3f(0, 0, 0); -
branches/blink/src/world_entities/effects/blink.h
r10253 r10325 7 7 8 8 #include "world_entity.h" 9 #include "color.h" 9 10 10 11 class Material; … … 23 24 void setPosition(float x, float y, float z) { this->position = Vector(x, y, z); } 24 25 void setSize(float s) { this->size = s; } 26 void setOmega(float w) { this->omega = w; } 27 void setColor(float r, float g, float b) { this->color = Vector(r, g, b); } 25 28 //void setTexture(const std::string& textureFile); 26 29 … … 31 34 Material* material; 32 35 Vector position; 36 Vector color; 37 float angle; 38 float omega; 39 float blinkStr; 33 40 float size; //! only one float caus' its quadratical 34 41 };
Note: See TracChangeset
for help on using the changeset viewer.