Changeset 10156 in orxonox.OLD for branches/playability/src/world_entities/effects
- Timestamp:
- Jan 1, 2007, 9:51:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/effects/wobblegrid.cc
r10154 r10156 89 89 90 90 this->grid = new Grid( this->size, this->size, this->subdivision, this->subdivision); 91 for (int i = 0; i < 25; i++)92 PRINTF(0)("Coordinate %i: %f,%f\n",i,this->grid->vertex(i).x,this->grid->vertex(i).z);93 91 this->angularSpeed = M_PI; //180; 92 this->setModel(this->grid); 94 93 } 95 94 … … 145 144 } 146 145 //this->grid->finalize(); 146 147 Vector view = this->getAbsCoor() - State::getCameraNode()->getAbsCoor(); 148 view.normalize(); 149 150 Vector up = Vector(0, 1, 0); 151 Vector h = up.cross(view); 152 up = h.cross(view); 153 154 Quaternion dir = Quaternion::lookAt( this->getAbsCoor(), this->getAbsCoor() + up, view); 155 this->setAbsDir(dir); 156 147 157 } 148 158 … … 153 163 void Wobblegrid::draw() const 154 164 { 165 166 // this->material->select(); 167 // WorldEntity::draw(); 168 // return; 169 170 155 171 if( !this->isVisible()) 156 172 return; … … 160 176 glDisable(GL_FOG); 161 177 178 glMatrixMode(GL_MODELVIEW); 162 179 glPushMatrix(); 163 180 … … 166 183 this->material->select(); 167 184 168 const PNode* camera = State::getCameraNode(); //!< @todo MUST be different169 Vector cameraPos = camera->getAbsCoor();170 Vector cameraTargetPos = State::getCameraTargetNode()->getAbsCoor();171 Vector view = cameraTargetPos - cameraPos;172 173 174 Vector up = Vector(0, 1, 0);175 up = camera->getAbsDir().apply(up);176 Vector h = up.cross(view);177 Vector v = h.cross(view);178 h.normalize();179 v.normalize();180 181 float rangle = acosf(v.dot(view)/view.len());182 183 v *= size;184 h *= size;185 186 //v += this->getAbsCoor();187 //PRINTF(0)("sizeX: %f sizeZ: %f\n", sizeX, sizeZ);188 /*int xone = 0;189 int zone = 0;190 185 191 glBegin(GL_QUADS);192 193 for( int z=0; z<4; z++)194 {195 for( int x=0; x<4; x++)196 {197 xone = x + 1;198 zone = z + 1;199 glTexCoord2f(x*.25f,z*.25f);200 glVertex3f( this->getAbsCoor().x + this->grid[z][x].x*this->sizeX2 - h.x - v.x,201 this->getAbsCoor().y - h.y - v.y,202 this->getAbsCoor().z + this->grid[z][x].z*this->sizeZ2 - h.z - v.z);203 204 glTexCoord2f(x*.25f,zone*.25f);205 glVertex3f( this->getAbsCoor().x + this->grid[zone][x].x*this->sizeX2 - h.x - v.x,206 this->getAbsCoor().y - h.y - v.y,207 this->getAbsCoor().z + this->grid[zone][x].z*this->sizeZ2 - h.z - v.z);208 209 glTexCoord2f(xone*.25f,zone*.25f);210 glVertex3f( this->getAbsCoor().x + this->grid[zone][xone].x*this->sizeX2 - h.x - v.x,211 this->getAbsCoor().y - h.y - v.y,212 this->getAbsCoor().z + this->grid[zone][xone].z*this->sizeZ2 - h.z - v.z);213 214 glTexCoord2f(xone*.25f,z*.25f);215 glVertex3f( this->getAbsCoor().x + this->grid[z][xone].x*this->sizeX2 - h.x - v.x,216 this->getAbsCoor().y - h.y - v.y,217 this->getAbsCoor().z + this->grid[z][xone].z*this->sizeZ2 - h.z - v.z);218 }219 }220 glEnd();*/221 186 glTranslatef (this->getAbsCoor ().x, 222 187 this->getAbsCoor ().y, 223 188 this->getAbsCoor ().z); 224 //Vector tmpRot = this->getAbsDir().getSpacialAxis(); 225 glRotatef (rangle, view.x, view.y, view.z ); 189 190 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 191 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 192 193 //Quaternion dir = Quaternion(this->getAbsDir().getSpacialAxisAngle(),view); 194 //this->setAbsDir(dir); 226 195 //glRotatef(this->angle, 0.0, 0.0, 1.0); 227 228 196 this->grid->draw(); 229 197
Note: See TracChangeset
for help on using the changeset viewer.