Changeset 13041 for OpenSceneGraph/trunk/src/osgWidget/Widget.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgWidget/Widget.cpp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgWidget/Widget.cpp
r12292 r13041 161 161 if(_coordMode == CM_RELATIVE) { 162 162 XYCoord size; 163 163 164 164 if(_parent) size = _parent->getSize(); 165 165 166 166 if(x >= 0.0f && x <= 1.0f) { 167 167 _relCoords[0] = x; 168 168 169 169 x = size.x() * x; 170 170 } … … 175 175 y = size.y() * y; 176 176 } 177 177 178 178 if(w >= 0.0f && w <= 1.0f) { 179 179 _relCoords[2] = w; 180 180 181 181 w = size.x() * w; 182 182 } 183 183 184 184 if(h >= 0.0f && h <= 1.0f) { 185 185 _relCoords[3] = h; 186 186 187 187 h = size.y() * h; 188 188 } … … 218 218 void Widget::addColor(color_type r, color_type g, color_type b, color_type a, Corner p) { 219 219 ColorArray* cols = _cols(); 220 220 221 221 if(p == ALL_CORNERS) { 222 222 (*cols)[LL] += Color(r, g, b, a); … … 264 264 265 265 (*texs)[LL] = t; 266 266 267 267 // Set the LOWER_RIGHT point. 268 268 t += XYCoord(w / tw, 0.0f); … … 298 298 299 299 if(!image || !texture || image->t() == 0.0f) return; 300 300 301 301 texture->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT); 302 302 … … 319 319 320 320 osg::Texture* texture = 0; 321 321 322 322 if(useTextRect) texture = new osg::TextureRectangle(); 323 323 324 324 else texture = new osg::Texture2D(); 325 325 326 326 if(!texture) return false; 327 327 … … 432 432 ); 433 433 } 434 434 435 435 else setDimensions(-1.0f, -1.0f, _relCoords[2] + w, _relCoords[3] + h); 436 436 } … … 438 438 point_type Widget::getWidth() const { 439 439 const PointArray* verts = _verts(); 440 440 441 441 return MACRO_WIDGET_W(verts); 442 442 } … … 444 444 point_type Widget::getHeight() const { 445 445 const PointArray* verts = _verts(); 446 446 447 447 return MACRO_WIDGET_H(verts); 448 448 } … … 513 513 point_type X = ((x / getWidth()) * width) + (*texs)[LL].x(); 514 514 point_type Y = (((getHeight() - y) / getHeight()) * height) + (*texs)[UR].y(); 515 515 516 516 return image->getColor(TexCoord(X, Y)); 517 517 } … … 520 520 return 521 521 _padLeft == _padRight && 522 _padLeft == _padTop && 522 _padLeft == _padTop && 523 523 _padLeft == _padBottom 524 524 ;
