Changeset 7919 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- May 28, 2006, 3:48:13 PM (19 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/graphics_engine.cc
r7871 r7919 286 286 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); //Use at least 16 bits for the depth buffer 287 287 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); //Enable double buffering 288 289 glEnable(GL_CULL_FACE); 290 glCullFace(GL_FRONT); 288 291 } 289 292 … … 576 579 void GraphicsEngine::drawBackgroundElements() const 577 580 { 581 GraphicsEngine::storeMatrices(); 582 578 583 Render2D::getInstance()->draw(E2D_LAYER_BELOW_ALL, E2D_LAYER_BELOW_ALL); 579 584 } -
trunk/src/lib/graphics/importer/material.cc
r7848 r7919 108 108 return true; 109 109 110 111 // setting diffuse color 110 if (likely(Material::selectedMaterial != NULL)) 111 { 112 for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i) 113 { 114 glActiveTexture(Material::glTextureArbs[i]); 115 //glBindTexture(GL_TEXTURE_2D, 0); 116 glDisable(GL_TEXTURE_2D); 117 } 118 } 119 120 // setting diffuse color 112 121 glColor4f (diffuse[0], diffuse[1], diffuse[2], this->transparency); 113 122 // setting ambient color … … 118 127 glMaterialf(GL_FRONT, GL_SHININESS, this->shininess); 119 128 120 121 129 // setting the transparency 122 130 if (this->transparency < 1.0 || /* This allows alpha blending of 2D textures with the scene */ … … 138 146 glShadeModel(GL_SMOOTH); 139 147 140 if (likely(Material::selectedMaterial != NULL))141 {142 for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i)143 {144 glActiveTexture(Material::glTextureArbs[i]);145 glBindTexture(GL_TEXTURE_2D, 0);146 glDisable(GL_TEXTURE_2D);147 }148 }149 148 150 149 for(unsigned int i = 0; i < this->textures.size(); ++i) … … 159 158 } 160 159 Material::selectedMaterial = this; 161 162 /* if (this->diffuseTexture != NULL)163 {164 glEnable(GL_TEXTURE_2D);165 glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());166 }167 else168 {169 glDisable(GL_TEXTURE_2D);170 glBindTexture(GL_TEXTURE_2D, 0);171 }*/172 160 } 173 161 -
trunk/src/lib/graphics/importer/material.h
r7788 r7919 16 16 17 17 #include <vector> 18 #include "SDL_image.h"19 20 18 #include "texture.h" 21 19 … … 51 49 void setTransparency (char* trans); 52 50 51 void getDiffuseColor(float& r, float& g, float& b) const { r = diffuse[0], g = diffuse[1], b = diffuse[2]; } 53 52 54 53 // MAPPING // -
trunk/src/lib/graphics/render2D/element_2d.cc
r7871 r7919 62 62 this->toCoordinate = NULL; 63 63 this->toDirection = NULL; 64 65 this->size = Vector2D(0,0); 64 66 this->toSize = NULL; 65 this->setSize2D(1, 1);66 67 67 68 … … 448 449 this->relCoordinate += shift; 449 450 this->bRelCoorChanged = true; 450 451 451 } 452 452 … … 847 847 if (unlikely(this->toSize != NULL)) 848 848 { 849 Vector2D shiftSize = (*this->toSize - Vector2D(this->sizeX, this->sizeY)) *fabsf(dt)*bias;849 Vector2D shiftSize = (*this->toSize - this->size) *fabsf(dt)*bias; 850 850 if (likely((shiftSize).len() >= .001))//PNODE_ITERATION_DELTA)) 851 851 { 852 this->sizeX += shiftSize.x; 853 this->sizeY += shiftSize.y; 852 this->size += shiftSize; 854 853 } 855 854 else … … 1109 1108 if (level == 0) 1110 1109 glPopAttrib(); 1111 1112 1110 } 1113 1111 -
trunk/src/lib/graphics/render2D/element_2d.h
r7843 r7919 125 125 inline const PNode* getBindNode() const { return this->bindNode; }; 126 126 127 inline void setSize2D(float x, float y) { this->sizeX = x, this->sizeY = y; }; 127 inline void setSize2D(float x, float y) { this->size = Vector2D(x, y); }; 128 inline void setSize2D(const Vector2D& size) { this->size = size; }; 129 inline const Vector2D& getSize2D() const { return this->size; }; 128 130 void setSizeSoft2D(float x, float y, float bias = 1.0); 129 inline void setSizeX2D(float x) { this->size X= x; };130 inline void setSizeY2D(float y) { this->size Y= y; };131 inline float getSizeX2D() const { return this->size X; };132 inline float getSizeY2D() const { return this->size Y; };131 inline void setSizeX2D(float x) { this->size.x = x; }; 132 inline void setSizeY2D(float y) { this->size.y = y; }; 133 inline float getSizeX2D() const { return this->size.x; }; 134 inline float getSizeY2D() const { return this->size.y; }; 133 135 134 136 public: … … 238 240 private: 239 241 const PNode* bindNode; //!< a node over which to display this 2D-element 240 float sizeX; //!< The size of the rendered item in x-direction 241 float sizeY; //!< The size of the rendered Item in y-direction 242 Vector2D size; //!< The size of the rendered item 242 243 Vector2D* toSize; //!< The Size to iterate to. 243 244 -
trunk/src/lib/graphics/text_engine/multi_line_text.cc
r7758 r7919 64 64 return; 65 65 glPushMatrix(); 66 glPushAttrib(GL_ENABLE_BIT); 66 67 // transform for alignment. 67 68 // TODO make the Stuff with the alignment … … 117 118 } 118 119 glEnd(); 120 glPopAttrib(); 119 121 glPopMatrix(); 120 122 } -
trunk/src/lib/graphics/text_engine/text.cc
r7753 r7919 36 36 this->font = NULL; 37 37 this->size = textSize; 38 this->setSizeY2D(size); 38 39 this->blending = TEXT_DEFAULT_BLENDING; 39 40 this->color = TEXT_DEFAULT_COLOR; … … 127 128 128 129 /** 130 * @brief appends one Character to the String. 131 */ 132 void Text::appendCharacter(char character) 133 { 134 this->text += character; 135 this->setupTextWidth(); 136 } 137 138 139 /** 129 140 * @brief append some text to the already existing Text. 130 141 * @param appendText The text to append to this Text. … … 135 146 return this->text; 136 147 } 148 149 /** 150 * @brief removes char characters from the Text. 151 * 152 * @note this function checks, if the count can be removed, and if so does it. 153 * Otherwise the maximum count of characters will be removed. 154 */ 155 void Text::removeCharacters(unsigned int chars) 156 { 157 if (text.size() > chars) 158 this->text.resize(this->text.size()-chars); 159 else if (!text.empty()) 160 text.clear(); 161 this->setupTextWidth(); 162 } 163 137 164 138 165 /** … … 188 215 return; 189 216 glPushMatrix(); 217 glPushAttrib(GL_ENABLE_BIT); 190 218 // transform for alignment. 191 219 if (this->getAlignment() == TEXT_ALIGN_RIGHT) … … 229 257 } 230 258 glEnd(); 259 glPopAttrib(); 231 260 glPopMatrix(); 232 261 } … … 242 271 if(this->font->getGlyphArray()[this->text[i]] != NULL) 243 272 width += this->font->getGlyphArray()[this->text[i]]->advance; 244 this->setSizeX2D(width * this->getSize());273 this->setSizeX2D(width * this->getSize()); 245 274 } 246 275 -
trunk/src/lib/graphics/text_engine/text.h
r7753 r7919 37 37 void setText(const std::string& text); 38 38 void append(const std::string& appendText); 39 void appendCharacter(char character); 39 40 const std::string& operator<<(const std::string& appendText); 41 void removeCharacters(unsigned int chars); 40 42 41 43 /// SETUP
Note: See TracChangeset
for help on using the changeset viewer.