Changeset 5215 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Sep 22, 2005, 4:02:08 PM (19 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/element_2d.cc
r5214 r5215 438 438 * use this to add a child to this node. 439 439 */ 440 void Element2D::addChild2D (Element2D* child, int parentingMod )440 void Element2D::addChild2D (Element2D* child, int parentingMode) 441 441 { 442 442 if( likely(child->parent != NULL)) … … 445 445 child->parent->children->remove(child); 446 446 } 447 child->parentMode = parentMode; 447 if (parentingMode != E2D_PARENT_NONE) 448 child->parentMode = parentingMode; 448 449 child->parent = this; 449 450 this->children->add(child); -
trunk/src/lib/graphics/render2D/element_2d.h
r5211 r5215 42 42 typedef enum 43 43 { 44 E2D_PARENT_NONE = 0, 44 45 E2D_PARENT_LOCAL_ROTATE = 1, //!< Rotates all the children around their centers. 45 46 E2D_PARENT_ROTATE_MOVEMENT = 2, //!< Moves all the children around the center of their parent, without the rotation around their own centers. … … 138 139 139 140 140 void addChild2D (Element2D* child, int parentingMode = E2D_ DEFAULT_PARENTING_MODE);141 void addChild2D (Element2D* child, int parentingMode = E2D_PARENT_NONE); 141 142 void addChild2D (const char* childName); 142 143 void removeChild2D (Element2D* child); -
trunk/src/lib/graphics/spatial_separation/quadtree.cc
r5075 r5215 53 53 /* make an array with access to the leafs of the Quad-Tree */ 54 54 this->nodes = new QuadtreeNode*[(int)pow(4, treeDepth)]; 55 int * index = new int; *index = 0;55 int index = 0; //new int; *index = 0; // !!changed by bensch!! 56 56 for(int i = 0; i < (int)pow(2, treeDepth); ++i) 57 57 { 58 this->rootNode->buildHashTable(this->nodes, index);58 this->rootNode->buildHashTable(this->nodes, &index); 59 59 } 60 60 /* sort and revert the hash table to fit the right position */ … … 65 65 this->quadLength = this->nodes[0]->getDimension()->getAxis() * 2.0f; 66 66 Rectangle* r = this->rootNode->getDimension(); 67 Vector* offset = new Vector();68 float xOff = r->getCenter() ->x - r->getAxis();69 float yOff = r->getCenter() ->z - r->getAxis();67 // Vector* offset = new Vector(); // unused removed by bensch 68 float xOff = r->getCenter().x - r->getAxis(); 69 float yOff = r->getCenter().z - r->getAxis(); 70 70 this->offset = new Vector(); 71 71 this->offset->x = xOff; … … 136 136 for( int k = j + 1; k < len; ++k) 137 137 { 138 a = this->nodes[i * len + j]->getDimension()->getCenter() ->z;139 b = this->nodes[i * len + k]->getDimension()->getCenter() ->z;138 a = this->nodes[i * len + j]->getDimension()->getCenter().z; 139 b = this->nodes[i * len + k]->getDimension()->getCenter().z; 140 140 141 141 if( b > a) -
trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
r5115 r5215 57 57 PRINT(3)(" |"); 58 58 PRINT(3)(" | +-| (II) Rectangle Center (%5.2f, %5.2f), half axis length: %5.2f\n", 59 this->pDimension->getCenter() ->x, this->pDimension->getCenter()->z, this->pDimension->getAxis());59 this->pDimension->getCenter().x, this->pDimension->getCenter().z, this->pDimension->getAxis()); 60 60 61 61 this->init(); … … 205 205 tList<sTriangleExt*>* listD = new tList<sTriangleExt*>(); //!< triangle list of nodeD 206 206 const float* pVert; //!< pointer to the vertices 207 const Vector*rectCenter; //!< vector to the center of the rect207 Vector rectCenter; //!< vector to the center of the rect 208 208 209 209 rectCenter = this->pDimension->getCenter(); … … 213 213 { 214 214 pVert = &this->pVertices[this->pTriangles[i]->indexToVertices[j]]; 215 if( pVert[0] > rectCenter ->x + this->offset && pVert[2] > rectCenter->z + this->offset)215 if( pVert[0] > rectCenter.x + this->offset && pVert[2] > rectCenter.z + this->offset) 216 216 listA->add(&this->pTriangles[i]); 217 if( pVert[0] < rectCenter ->x + this->offset && pVert[2] > rectCenter->z + this->offset)217 if( pVert[0] < rectCenter.x + this->offset && pVert[2] > rectCenter.z + this->offset) 218 218 listB->add(&this->pTriangles[i]); 219 if( pVert[0] < rectCenter ->x + this->offset && pVert[2] < rectCenter->z + this->offset)219 if( pVert[0] < rectCenter.x + this->offset && pVert[2] < rectCenter.z + this->offset) 220 220 listC->add(&this->pTriangles[i]); 221 if( pVert[0] > rectCenter ->x + this->offset && pVert[2] < rectCenter->z + this->offset)221 if( pVert[0] > rectCenter.x + this->offset && pVert[2] < rectCenter.z + this->offset) 222 222 listD->add(&this->pTriangles[i]); 223 223 } … … 304 304 305 305 306 v.x = this->pDimension->getCenter() ->x + this->pDimension->getAxis() / 2.0f;306 v.x = this->pDimension->getCenter().x + this->pDimension->getAxis() / 2.0f; 307 307 v.y = 0.0; 308 v.z = this->pDimension->getCenter() ->z + this->pDimension->getAxis() / 2.0f;308 v.z = this->pDimension->getCenter().z + this->pDimension->getAxis() / 2.0f; 309 309 rA = new Rectangle(v, this->pDimension->getAxis() / 2.0f); 310 v.z = this->pDimension->getCenter() ->z - this->pDimension->getAxis() / 2.0f;310 v.z = this->pDimension->getCenter().z - this->pDimension->getAxis() / 2.0f; 311 311 rB = new Rectangle(v, this->pDimension->getAxis() / 2.0f); 312 v.x = this->pDimension->getCenter() ->x - this->pDimension->getAxis() / 2.0f;312 v.x = this->pDimension->getCenter().x - this->pDimension->getAxis() / 2.0f; 313 313 rC = new Rectangle(v, this->pDimension->getAxis() / 2.0f); 314 v.z = this->pDimension->getCenter() ->z + this->pDimension->getAxis() / 2.0f;314 v.z = this->pDimension->getCenter().z + this->pDimension->getAxis() / 2.0f; 315 315 rD = new Rectangle(v, this->pDimension->getAxis() / 2.0f); 316 316 … … 371 371 for( int i = 0; i < this->treeDepth; ++i) 372 372 PRINT(3)(" |"); 373 PRINT(3)(" | +-| (II) Rectangle Dimension (%5.2f, %5.2f) to (%5.2f, %5.2f), Center (%5.2f, %5.2f)\n", minX, minY, maxX, maxY, rect->getCenter() ->x, rect->getCenter()->z, rect->getAxis());373 PRINT(3)(" | +-| (II) Rectangle Dimension (%5.2f, %5.2f) to (%5.2f, %5.2f), Center (%5.2f, %5.2f)\n", minX, minY, maxX, maxY, rect->getCenter().x, rect->getCenter().z, rect->getAxis()); 374 374 return rect; 375 375 } … … 383 383 bool QuadtreeNode::includesPoint(const Vector& v) const 384 384 { 385 Vector center = *this->pDimension->getCenter();385 Vector center = this->pDimension->getCenter(); 386 386 float ax = this->pDimension->getAxis(); 387 387 … … 492 492 if( this->treeDepth == this->maxDepth) 493 493 { 494 Vector t1 = *this->pDimension->getCenter();494 Vector t1 = this->pDimension->getCenter(); 495 495 float ax = this->pDimension->getAxis(); 496 496 float h = 50.0f; … … 525 525 return; 526 526 527 Vector t1 = *this->pDimension->getCenter();527 Vector t1 = this->pDimension->getCenter(); 528 528 float ax = this->pDimension->getAxis(); 529 529 float h = 70.0f; -
trunk/src/lib/graphics/text_engine.cc
r5208 r5215 405 405 // setting default values. 406 406 this->font = NULL; 407 this->fontFile = NULL;408 407 this->glyphArray = NULL; 409 408 this->fastTextureID = 0; … … 446 445 bool Font::loadFont(const char* fontFile) 447 446 { 448 if (!this-> fontFile)447 if (!this->getName()) 449 448 { 450 449 this->setName(fontFile); 451 this->fontFile = new char[strlen(fontFile)+1]; 452 strcpy(this->fontFile, fontFile); 453 454 this->font = TTF_OpenFont(this->fontFile, this->fontSize); 450 451 this->font = TTF_OpenFont(this->getName(), this->fontSize); 455 452 if(!this->font) 456 453 { -
trunk/src/lib/graphics/text_engine.h
r5181 r5215 190 190 // information about the Font 191 191 TTF_Font* font; //!< The font we use for this. 192 char* fontFile; //!< The fontfile from whitch the font was loaded.193 192 unsigned int fontSize; //!< The size of the font in pixels. each Font has one size. 194 193 int renderStyle; //!< The Renderstyle -
trunk/src/lib/math/vector.h
r5053 r5215 268 268 269 269 public: 270 Rectangle() { this->center = newVector(); }271 Rectangle(const Vector ¢er, float len) { this->center = newVector(center.x, center.y, center.z); this->axis[0] = len; this->axis[1] = len; }270 Rectangle() { this->center = Vector(); } 271 Rectangle(const Vector ¢er, float len) { this->center = Vector(center.x, center.y, center.z); this->axis[0] = len; this->axis[1] = len; } 272 272 virtual ~Rectangle() {} 273 273 274 274 /** \brief sets the center of the rectangle to a defined vector @param center the new center */ 275 inline void setCenter(const Vector ¢er) { *this->center = center;}275 inline void setCenter(const Vector ¢er) { this->center = center;} 276 276 /** \brief sets the center of the rectangle to a defined vector @param x coord of the center @param y coord of the center @param z coord of the center */ 277 inline void setCenter(float x, float y, float z) { this->center ->x = x; this->center->y = y; this->center->z = z; }277 inline void setCenter(float x, float y, float z) { this->center.x = x; this->center.y = y; this->center.z = z; } 278 278 /** \brief returns the center of the rectangle to a defined vector @returns center the new center */ 279 inline const Vector *getCenter() const { return this->center; }279 inline const Vector& getCenter() const { return this->center; } 280 280 281 281 /** \brief sets both axis of the rectangle to a defined vector @param unityLength the new center */ … … 287 287 288 288 private: 289 Vector *center;289 Vector center; 290 290 float axis[2]; 291 291 }; -
trunk/src/lib/shell/shell_buffer.cc
r5214 r5215 37 37 this->lineCount = 0; 38 38 this->keepBufferArray[0] = '\0'; 39 this->bufferArray[0] = '\0'; 39 40 this->keepBuffer = false; 40 41 this->buffer = new tList<char>; … … 101 102 this->buffer = new tList<char>; 102 103 this->bufferIterator = this->buffer->getIterator(); 104 103 105 } 104 106 … … 165 167 { 166 168 // newLineEnd = newLineBegin + strlen(newLineBegin); 167 strcpy(this->keepBufferArray, newLineBegin); 169 unsigned int len = strlen(newLineBegin); 170 strncpy(this->keepBufferArray, newLineBegin, len); 171 this->keepBufferArray[len] = '\0'; 168 172 this->keepBuffer = true; 169 173 break;
Note: See TracChangeset
for help on using the changeset viewer.