- Timestamp:
- Oct 22, 2005, 1:57:29 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r5419 r5420 36 36 /** 37 37 * standard constructor 38 */38 */ 39 39 PNode::PNode () 40 40 { … … 46 46 /** 47 47 * @param root the load-Element for the PNode 48 */48 */ 49 49 PNode::PNode(const TiXmlElement* root) 50 50 { … … 60 60 * @param absCoordinate the Absolute coordinate of the Object 61 61 * @param parent The parent-node of this node. 62 */62 */ 63 63 PNode::PNode (const Vector& absCoor, PNode* parent ) 64 64 { … … 116 116 * initializes a PNode 117 117 * @param parent the parent for this PNode 118 */118 */ 119 119 void PNode::init(PNode* parent) 120 120 { … … 136 136 * loads parameters of the PNode 137 137 * @param root the XML-element to load the properties of 138 */138 */ 139 139 void PNode::loadParams(const TiXmlElement* root) 140 140 { … … 176 176 * set relative coordinates 177 177 * @param relCoord relative coordinates to its parent 178 179 it is very importand, that you use this function, if you want to update the 180 relCoordinates. If you don't use this, the PNode won't recognize, that something 181 has changed and won't update the children Nodes. 182 */ 178 * 179 * 180 * it is very importand, that you use this function, if you want to update the 181 * relCoordinates. If you don't use this, the PNode won't recognize, that something 182 * has changed and won't update the children Nodes. 183 */ 183 184 void PNode::setRelCoor (const Vector& relCoord) 184 185 { … … 199 200 * @param z z-relative coordinates to its parent 200 201 * @see void PNode::setRelCoor (const Vector& relCoord) 201 */202 */ 202 203 void PNode::setRelCoor (float x, float y, float z) 203 204 { … … 306 307 * shift coordinate relative 307 308 * @param shift shift vector 308 309 310 311 312 313 314 315 otherwise you would have to:316 317 318 319 320 309 * 310 * this function shifts the current coordinates about the vector shift. this is 311 * usefull because from some place else you can: 312 * PNode* someNode = ...; 313 * Vector objectMovement = calculateShift(); 314 * someNode->shiftCoor(objectMovement); 315 * 316 * this is the internal method of: 317 * PNode* someNode = ...; 318 * Vector objectMovement = calculateShift(); 319 * Vector currentCoor = someNode->getRelCoor(); 320 * Vector newCoor = currentCoor + objectMovement; 321 * someNode->setRelCoor(newCoor); 321 322 * 322 323 */ … … 417 418 418 419 /** 419 * 420 * sets the absolute direction 420 421 * @param absDir absolute coordinates 421 422 */ … … 461 462 * @param child child reference 462 463 * use this to add a child to this node. 463 */464 */ 464 465 void PNode::addChild (PNode* child) 465 466 { … … 491 492 * 492 493 * Children from pNode will not be lost, they are referenced to NullPointer 493 */494 */ 494 495 void PNode::removeChild (PNode* child) 495 496 { … … 504 505 /** 505 506 * remove this pnode from the tree and adds all following to NullParent 506 507 508 */507 * 508 * this can be the case, if an entity in the world is being destroyed. 509 */ 509 510 void PNode::remove() 510 511 { … … 525 526 * sets the parent of this PNode 526 527 * @param parent the Parent to set 527 */528 */ 528 529 void PNode::setParent (PNode* parent) 529 530 { … … 604 605 * updates the absCoordinate/absDirection 605 606 * @param dt The time passed since the last update 606 607 608 609 610 */607 * 608 * this is used to go through the parent-tree to update all the absolute coordinates 609 * and directions. this update should be done by the engine, so you don't have to 610 * worry, normaly... 611 */ 611 612 void PNode::update (float dt) 612 613 { … … 713 714 * (0: all children will be debugged, 1: only this PNode, 2: this and direct children, ...) 714 715 * @param level !! INTERNAL !! The n-th level of the Node we draw (this is internal and only for nice output). 715 */716 */ 716 717 void PNode::debug(unsigned int depth, unsigned int level) const 717 718 { -
trunk/src/lib/graphics/render2D/render_2d.h
r5417 r5420 2 2 * @file render_2d.h 3 3 * @brief Definition of the 2D-rendering engine singleton Class 4 * @todo implement Layer-rendering 5 */ 4 */ 6 5 7 6 #ifndef _RENDER_2D_H -
trunk/src/lib/graphics/text_engine/font.cc
r5418 r5420 412 412 413 413 this->initGlyphs(32, numberOfGlyphs); 414 this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space414 // this->glyphArray[32]->width = .5f; //!< @todo find out the real size of a Space 415 415 416 416 int rectSize = this->findOptimalFastTextureSize(); … … 437 437 tmpRect.x = 0; tmpRect.y = 0; tmpRect.w = tmpSurf->w; tmpRect.h = tmpSurf->h; 438 438 SDL_SetClipRect(tmpSurf, &tmpRect); 439 int maxLineHeight = 0;439 int maxLineHeight = this->getMaxHeight(); 440 440 441 441 // all the interessting Glyphs … … 453 453 { 454 454 tmpRect.x = 0; 455 tmpRect.y = tmpRect.y + maxLineHeight + 1; 456 maxLineHeight = 0; 455 tmpRect.y = tmpRect.y + maxLineHeight; 457 456 } 458 457 if (tmpRect.y + maxLineHeight > tmpSurf->h) … … 470 469 { 471 470 SDL_SetAlpha(glyphSurf, 0, 0); 472 471 int tmp = tmpRect.y; 472 tmpRect.y += this->getMaxAscent()-(int)((float)tmpGlyph->bearingY*this->renderSize); 473 473 SDL_BlitSurface(glyphSurf, NULL, tmpSurf, &tmpRect); 474 tmpGlyph->texCoord[0] = (float)tmpRect.x/(float)tmpSurf->w; 475 tmpGlyph->texCoord[1] = (float)(tmpRect.x + tmpGlyph->advance*this->renderSize)/(float)tmpSurf->w; 474 tmpRect.y = tmp; 475 476 tmpGlyph->texCoord[0] = (float)(tmpRect.x)/(float)tmpSurf->w; 477 tmpGlyph->texCoord[1] = (float)(tmpRect.x + tmpGlyph->width*(float)this->renderSize)/(float)tmpSurf->w; 476 478 tmpGlyph->texCoord[2] = (float)(tmpRect.y)/(float)tmpSurf->w; 477 tmpGlyph->texCoord[3] = (float)(tmpRect.y+t mpGlyph->height*this->renderSize)/(float)tmpSurf->w;479 tmpGlyph->texCoord[3] = (float)(tmpRect.y+this->getMaxHeight())/(float)tmpSurf->w; 478 480 SDL_FreeSurface(glyphSurf); 479 480 tmpRect.x += (int)(tmpGlyph->advance*this->renderSize)+1; 481 482 // Outputting Glyphs to BMP-files. 481 tmpRect.x += (int)(tmpGlyph->advance * this->renderSize)+1; 482 483 483 /* 484 char outname[512]; 484 // Outputting Glyphs to BMP-files. 485 char outname[1024]; 485 486 if (i < 10) 486 487 sprintf( outname, "%s-glyph-00%d.bmp", this->getName(), i ); … … 489 490 else 490 491 sprintf( outname, "%s-glyph-%d.bmp", this->getName(), i ); 491 SDL_SaveBMP(tmpSurf, outname); 492 */ 492 SDL_SaveBMP(tmpSurf, outname);*/ 493 493 } 494 494 } 495 495 } 496 // outputting the GLYPH-table 497 // char outName[1024]; 498 // sprintf( outName, "%s-glyphs.bmp", this->getName()); 499 // SDL_SaveBMP(tmpSurf, outName); 496 500 497 501 GLuint texture; -
trunk/src/lib/graphics/text_engine/text.cc
r5419 r5420 243 243 { 244 244 glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0); 245 glRotatef(this->getAbsDir2D(), 0, 0,1);245 glRotatef(this->getAbsDir2D(), 0, 0, 1); 246 246 Glyph* tmpGlyph; 247 247 float posX = 0.0f; … … 253 253 254 254 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[2]); 255 glVertex2d(posX, - tmpGlyph->bearingY * this->size);255 glVertex2d(posX, 0); 256 256 257 257 glTexCoord2f(tmpGlyph->texCoord[0], tmpGlyph->texCoord[3]); 258 glVertex2d(posX, (tmpGlyph->height - tmpGlyph->bearingY)*this->size);258 glVertex2d(posX, this->size); 259 259 260 260 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[3]); 261 glVertex2d(posX+tmpGlyph->width*this->size, (tmpGlyph->height - tmpGlyph->bearingY)*this->size);261 glVertex2d(posX+tmpGlyph->width*this->size, this->size); 262 262 263 263 glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]); 264 glVertex2d(posX+tmpGlyph->width*this->size, - tmpGlyph->bearingY*this->size);264 glVertex2d(posX+tmpGlyph->width*this->size, 0); 265 265 266 266 glEnd(); -
trunk/src/lib/gui/gl_gui/glgui_pushbutton.cc
r5418 r5420 19 19 20 20 #include "text.h" 21 #include "material.h" 21 22 22 23 using namespace std; … … 45 46 { 46 47 this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton"); 48 // this->label->setRelCoor2D(10, 10); 47 49 50 this->backMat = new Material(); 51 this->backMat->setDiffuse(0, 0, 0); 52 53 this->setSize2D(label->getSizeX2D()+10, label->getSizeY2D()+10); 48 54 } 49 55 … … 53 59 void GLGuiPushButton::draw() const 54 60 { 55 this->label->draw(); 61 this->backMat->select(); 62 glPushMatrix(); 63 glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); 64 glBegin(GL_QUADS); 65 66 glVertex2d(0,0); 67 glVertex2d(0, this->getSizeY2D()); 68 glVertex2d(this->getSizeX2D(), this->getSizeY2D()); 69 glVertex2d(this->getSizeX2D(),0); 70 71 glEnd(); 72 glPopMatrix(); 73 74 // this->label->draw(); 56 75 // printf("test"); 57 76 } -
trunk/src/lib/math/vector.cc
r5005 r5420 15 15 16 16 Quaternion code borrowed from an Gamasutra article by Nick Bobick and Ken Shoemake 17 18 2005-06-02: Benjamin Grauer: speed up, and new Functionality to Vector (mostly inline now) 17 19 */ 18 20 … … 30 32 * returns the this-vector normalized to length 1.0 31 33 * @todo there is some error in this function, that i could not resolve. it just does not, what it is supposed to do. 32 */34 */ 33 35 Vector Vector::getNormalized() const 34 36 { … … 53 55 /** 54 56 * Outputs the values of the Vector 55 */57 */ 56 58 void Vector::debug() const 57 59 { … … 77 79 * 78 80 * @TODO !!! OPTIMIZE THIS !!! 79 */81 */ 80 82 Quaternion::Quaternion (const Vector& dir, const Vector& up) 81 83 { … … 110 112 * @param pitch: the pitch in radians 111 113 * @param yaw: the yaw in radians 112 */114 */ 113 115 Quaternion::Quaternion (float roll, float pitch, float yaw) 114 116 { … … 136 138 * convert the Quaternion to a 4x4 rotational glMatrix 137 139 * @param m: a buffer to store the Matrix in 138 */140 */ 139 141 void Quaternion::matrix (float m[4][4]) const 140 142 { … … 167 169 * @param to where 168 170 * @param t the time this transformation should take value [0..1] 169 170 171 * @returns the Result of the smooth move 171 */172 */ 172 173 Quaternion Quaternion::quatSlerp(const Quaternion& from, const Quaternion& to, float t) 173 174 { … … 194 195 } 195 196 196 //if( (1.0 - cosom) > DELTA )197 //{198 197 omega = acos(cosom); 199 198 sinom = sin(omega); 200 199 scale0 = sin((1.0 - t) * omega) / sinom; 201 200 scale1 = sin(t * omega) / sinom; 202 //}203 /*204 else205 {206 scale0 = 1.0 - t;207 scale1 = t;208 }209 */210 211 212 /*213 Quaternion res;214 res.v.x = scale0 * from.v.x + scale1 * tol[0];215 res.v.y = scale0 * from.v.y + scale1 * tol[1];216 res.v.z = scale0 * from.v.z + scale1 * tol[2];217 res.w = scale0 * from.w + scale1 * tol[3];218 */219 201 return Quaternion(Vector(scale0 * from.v.x + scale1 * tol[0], 220 221 202 scale0 * from.v.y + scale1 * tol[1], 203 scale0 * from.v.z + scale1 * tol[2]), 222 204 scale0 * from.w + scale1 * tol[3]); 223 205 } … … 227 209 * convert a rotational 4x4 glMatrix into a Quaternion 228 210 * @param m: a 4x4 matrix in glMatrix order 229 */211 */ 230 212 Quaternion::Quaternion (float m[4][4]) 231 213 { -
trunk/src/lib/math/vector.h
r5419 r5420 1 /* 2 orxonox - the future of 3D-vertical-scrollers 3 4 Copyright (C) 2004 orx 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 ### File Specific: 12 main-programmer: Christian Meyer 13 co-programmer: ... 14 */ 15 1 16 /*! 2 17 * @file vector.h -
trunk/src/lib/shell/shell.cc
r5398 r5420 84 84 this->textSize = 20; 85 85 this->lineSpacing = 0; 86 this->bActive = false;86 this->bActive = true; 87 87 this->fontFile = new char[strlen(SHELL_DEFAULT_FONT)+1]; 88 88 strcpy(this->fontFile, SHELL_DEFAULT_FONT); … … 94 94 this->setBackgroundColor(SHELL_DEFAULT_BACKGROUND_COLOR); 95 95 96 this->deactivate(); 96 97 // register the shell at the ShellBuffer 97 98 ShellBuffer::getInstance()->registerShell(this); … … 135 136 { 136 137 this->bufferText[i]->setText(bufferIT->getCurrent(), true); 138 this->bufferText[i]->setVisibility(true); 137 139 bufferIT->prevStep(); 138 140 } … … 159 161 this->bufferText[i]->setText(bufferIT->getCurrent(), false); 160 162 bufferIT->prevStep(); 163 this->bufferText[i]->setVisibility(false); 161 164 } 162 165 delete bufferIT; … … 254 257 this->shellInput->setColor(this->textColor[0], this->textColor[1], this->textColor[2]); 255 258 this->shellInput->setBlending(this->textColor[3]); 256 this->shellInput->setRelCoor2D(5, (this->textSize + this->lineSpacing)* this->bufferDisplaySize + this->textSize);259 this->shellInput->setRelCoor2D(5, (this->textSize + this->lineSpacing)*(this->bufferDisplaySize)); 257 260 } 258 261 … … 271 274 } 272 275 this->shellHeight = (this->textSize + this->lineSpacing) * (bufferDisplaySize+1); 273 274 276 } 275 277 … … 501 503 Vector Shell::calculateLinePosition(unsigned int lineNumber) 502 504 { 503 return Vector(5, (this->textSize + this->lineSpacing)*(this->bufferDisplaySize - lineNumber - 1) + this->textSize, 0);505 return Vector(5, (this->textSize + this->lineSpacing)*(this->bufferDisplaySize - lineNumber - 2) + this->textSize, 0); 504 506 } 505 507 -
trunk/src/world_entities/player.cc
r5396 r5420 149 149 GLGuiButton* button = new GLGuiPushButton(); 150 150 button->show(); 151 button->setLabel(" test");151 button->setLabel("orxonox"); 152 152 button->setBindNode(this); 153 153
Note: See TracChangeset
for help on using the changeset viewer.