Changeset 1984
- Timestamp:
- 06/24/03 23:57:13 (10 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 39 added
- 18 modified
-
Make/makedirdefs (modified) (2 diffs)
-
VisualStudio/osg/osg.dsp (modified) (2 diffs)
-
VisualStudio/osgPlugins/osg/dot_osg.dsp (modified) (1 diff)
-
VisualStudio/osgUtil/osgUtil.dsp (modified) (2 diffs)
-
examples/osgdemeter (added)
-
examples/osgdemeter/GNUmakefile (added)
-
examples/osgdemeter/GNUmakefile.inst (added)
-
examples/osgdemeter/osgdemeter.cpp (added)
-
examples/osgpoints (added)
-
examples/osgpoints/GNUmakefile (added)
-
examples/osgpoints/GNUmakefile.inst (added)
-
examples/osgpoints/osgpoints.cpp (added)
-
examples/osgprerendercubemap (added)
-
examples/osgprerendercubemap/GNUmakefile (added)
-
examples/osgprerendercubemap/GNUmakefile.inst (added)
-
examples/osgprerendercubemap/osgprerendercubemap.cpp (added)
-
examples/osgshape/osgshape.cpp (modified) (1 diff)
-
examples/osgslideshow (added)
-
examples/osgslideshow/DefaultPresentation.cpp (added)
-
examples/osgslideshow/GNUmakefile (added)
-
examples/osgslideshow/GNUmakefile.inst (added)
-
examples/osgslideshow/SlideEventHandler.cpp (added)
-
examples/osgslideshow/SlideEventHandler.h (added)
-
examples/osgslideshow/osgslideshow.cpp (added)
-
include/osg/Geometry (modified) (1 diff)
-
include/osg/ShapeDrawable (modified) (5 diffs)
-
include/osg/Texture2D (modified) (1 diff)
-
include/osgUtil/TransformAttributeFunctor (added)
-
src/osg/GNUmakefile (modified) (1 diff)
-
src/osg/Geometry.cpp (modified) (1 diff)
-
src/osg/Image.cpp (modified) (5 diffs)
-
src/osg/ShapeDrawable.cpp (modified) (25 diffs)
-
src/osg/Texture2D.cpp (modified) (1 diff)
-
src/osgPlugins/ive/ConvexPlanarOccluder.cpp (added)
-
src/osgPlugins/ive/ConvexPlanarOccluder.h (added)
-
src/osgPlugins/ive/ConvexPlanarPolygon.cpp (added)
-
src/osgPlugins/ive/ConvexPlanarPolygon.h (added)
-
src/osgPlugins/ive/DrawElementsUInt.cpp (added)
-
src/osgPlugins/ive/DrawElementsUInt.h (added)
-
src/osgPlugins/ive/Impostor.cpp (added)
-
src/osgPlugins/ive/Impostor.h (added)
-
src/osgPlugins/ive/OccluderNode.cpp (added)
-
src/osgPlugins/ive/OccluderNode.h (added)
-
src/osgPlugins/ive/Point.cpp (added)
-
src/osgPlugins/ive/Point.h (added)
-
src/osgPlugins/ive/PolygonOffset.cpp (added)
-
src/osgPlugins/ive/PolygonOffset.h (added)
-
src/osgPlugins/ive/ShadeModel.cpp (added)
-
src/osgPlugins/ive/ShadeModel.h (added)
-
src/osgPlugins/ive/Switch.cpp (added)
-
src/osgPlugins/ive/Switch.h (added)
-
src/osgPlugins/osg/GNUmakefile (modified) (1 diff)
-
src/osgPlugins/osg/ShapeDrawable.cpp (modified) (4 diffs)
-
src/osgSim/GNUmakefile (modified) (1 diff)
-
src/osgUtil/GNUmakefile (modified) (1 diff)
-
src/osgUtil/Optimizer.cpp (modified) (4 diffs)
-
src/osgUtil/TransformAttributeFunctor.cpp (added)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/Make/makedirdefs
r1983 r1984 136 136 osgshape\ 137 137 osgstereoimage\ 138 osgstereoimage\139 138 osgteapot\ 140 139 osgtext\ … … 149 148 osgviewer\ 150 149 osgprerendercubemap\ 151 150 osgslideshow\ 151 152 152 # osgsimulation\ 153 153 # osgdemeter\ -
OpenSceneGraph/trunk/VisualStudio/osg/osg.dsp
r1983 r1984 422 422 # Begin Source File 423 423 424 SOURCE=..\..\src\osg\TransformAttributeFunctor.cpp425 # End Source File426 # Begin Source File427 428 424 SOURCE=..\..\src\osg\BlendFunc.cpp 429 425 # End Source File … … 841 837 # End Source File 842 838 # Begin Source File 843 844 SOURCE=..\..\Include\Osg\TransformAttributeFunctor845 # End Source File846 # Begin Source File847 848 839 849 840 SOURCE=..\..\Include\Osg\TriangleFunctor -
OpenSceneGraph/trunk/VisualStudio/osgPlugins/osg/dot_osg.dsp
r1960 r1984 271 271 # Begin Source File 272 272 273 SOURCE=..\..\..\src\osgPlugins\osg\TessellationHints.cpp 274 # End Source File 275 # Begin Source File 276 273 277 SOURCE=..\..\..\src\osgPlugins\osg\TexEnv.cpp 274 278 # End Source File -
OpenSceneGraph/trunk/VisualStudio/osgUtil/osgUtil.dsp
r1889 r1984 178 178 # Begin Source File 179 179 180 SOURCE=..\..\src\osgUtil\TransformAttributeFunctor.cpp 181 # End Source File 182 # Begin Source File 183 180 184 SOURCE=..\..\src\osgUtil\TriStripVisitor.cpp 181 185 # End Source File … … 283 287 284 288 SOURCE=..\..\include\osgUtil\TransformCallback 289 # End Source File 290 # Begin Source File 291 292 SOURCE=..\..\include\osgUtil\TransformAttributeFunctor 285 293 # End Source File 286 294 # Begin Source File -
OpenSceneGraph/trunk/examples/osgshape/osgshape.cpp
r1844 r1984 35 35 float height = 1.0f; 36 36 37 geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f,0.0f,0.0f),radius))); 38 geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(2.0f,0.0f,0.0f),2*radius))); 39 geode->addDrawable(new osg::ShapeDrawable(new osg::Cone(osg::Vec3(4.0f,0.0f,0.0f),radius,height))); 40 geode->addDrawable(new osg::ShapeDrawable(new osg::Cylinder(osg::Vec3(6.0f,0.0f,0.0f),radius,height))); 37 osg::TessellationHints* hints = new osg::TessellationHints; 38 hints->setDetailRatio(0.5f); 39 40 geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f,0.0f,0.0f),radius),hints)); 41 geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(2.0f,0.0f,0.0f),2*radius),hints)); 42 geode->addDrawable(new osg::ShapeDrawable(new osg::Cone(osg::Vec3(4.0f,0.0f,0.0f),radius,height),hints)); 43 geode->addDrawable(new osg::ShapeDrawable(new osg::Cylinder(osg::Vec3(6.0f,0.0f,0.0f),radius,height),hints)); 41 44 42 45 osg::Grid* grid = new osg::Grid; -
OpenSceneGraph/trunk/include/osg/Geometry
r1983 r1984 395 395 }; 396 396 397 /** Convenience function to be used for creating quad geometry with texture coords. 398 * Tex coords go from bottom left (0,0) to top right (1,1).*/ 399 extern SG_EXPORT Geometry* createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVec,const Vec3& heightVec); 400 401 397 402 398 403 } -
OpenSceneGraph/trunk/include/osg/ShapeDrawable
r1920 r1984 30 30 TessellationHints(): 31 31 _TessellationMode(USE_SHAPE_DEFAULTS), 32 _detailRatio(1.0f), 32 33 _targetNumFaces(100), 33 34 _createFrontFace(true), … … 43 44 Object(tess,copyop), 44 45 _TessellationMode(tess._TessellationMode), 46 _detailRatio(tess._detailRatio), 45 47 _targetNumFaces(tess._targetNumFaces), 46 48 _createFrontFace(tess._createFrontFace), … … 63 65 inline void setTessellationMode(TessellationMode mode) { _TessellationMode=mode; } 64 66 inline TessellationMode getTessellationMode() const { return _TessellationMode; } 67 68 inline void setDetailRatio(float ratio) { _detailRatio = ratio; } 69 inline float getDetailRatio() const { return _detailRatio; } 65 70 66 71 inline void setTargetNumFaces(unsigned int target) { _targetNumFaces=target; } … … 94 99 95 100 TessellationMode _TessellationMode; 101 102 float _detailRatio; 96 103 unsigned int _targetNumFaces; 97 104 … … 113 120 ShapeDrawable(); 114 121 115 ShapeDrawable(Shape* shape );122 ShapeDrawable(Shape* shape,TessellationHints* hints=0); 116 123 117 124 /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ -
OpenSceneGraph/trunk/include/osg/Texture2D
r1927 r1984 26 26 27 27 Texture2D(); 28 29 Texture2D(osg::Image* image); 28 30 29 31 /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ -
OpenSceneGraph/trunk/src/osg/GNUmakefile
r1983 r1984 84 84 TextureCubeMap.cpp\ 85 85 TextureRectangle.cpp\ 86 TransformAttributeFunctor.cpp\87 86 Timer.cpp\ 88 87 Transform.cpp\ -
OpenSceneGraph/trunk/src/osg/Geometry.cpp
r1983 r1984 2185 2185 } 2186 2186 } 2187 2188 2189 Geometry* osg::createTexturedQuadGeometry(const osg::Vec3& corner,const osg::Vec3& widthVec,const osg::Vec3& heightVec) 2190 { 2191 Geometry* geom = new Geometry; 2192 2193 Vec3Array* coords = new Vec3Array(4); 2194 (*coords)[0] = corner+heightVec; 2195 (*coords)[1] = corner; 2196 (*coords)[2] = corner+widthVec; 2197 (*coords)[3] = corner+widthVec+heightVec; 2198 geom->setVertexArray(coords); 2199 2200 Vec2Array* tcoords = new Vec2Array(4); 2201 (*tcoords)[0].set(0.0f,1.0f); 2202 (*tcoords)[1].set(0.0f,0.0f); 2203 (*tcoords)[2].set(1.0f,0.0f); 2204 (*tcoords)[3].set(1.0f,1.0f); 2205 geom->setTexCoordArray(0,tcoords); 2206 2207 osg::Vec4Array* colours = new osg::Vec4Array(1); 2208 (*colours)[0].set(1.0f,1.0f,1.0,1.0f); 2209 geom->setColorArray(colours); 2210 geom->setColorBinding(Geometry::BIND_OVERALL); 2211 2212 osg::Vec3Array* normals = new osg::Vec3Array(1); 2213 (*normals)[0] = widthVec^heightVec; 2214 (*normals)[0].normalize(); 2215 geom->setNormalArray(normals); 2216 geom->setNormalBinding(Geometry::BIND_OVERALL); 2217 2218 geom->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS,0,4)); 2219 2220 return geom; 2221 } -
OpenSceneGraph/trunk/src/osg/Image.cpp
r1983 r1984 161 161 default: 162 162 { 163 std::cout<<"error format = "<<std::hex<<format<<std::endl;163 notify(WARN)<<"error format = "<<std::hex<<format<<std::endl; 164 164 return 0; 165 165 } … … 209 209 default: 210 210 { 211 std::cout<<"error type = "<<type<<std::endl;211 notify(WARN)<<"error type = "<<type<<std::endl; 212 212 return 0; 213 213 } … … 221 221 int widthInBits = width*pixelSize; 222 222 int packingInBits = packing*8; 223 std::cout<< "width="<<width<<" pixelSize="<<pixelSize<<" width in bit="<<widthInBits<<" packingInBits="<<packingInBits<<" widthInBits%packingInBits="<<widthInBits%packingInBits<<std::endl;223 //notify(INFO) << "width="<<width<<" pixelSize="<<pixelSize<<" width in bit="<<widthInBits<<" packingInBits="<<packingInBits<<" widthInBits%packingInBits="<<widthInBits%packingInBits<<std::endl; 224 224 return (widthInBits/packingInBits + ((widthInBits%packingInBits)?1:0))*packing; 225 225 } … … 268 268 r*t; 269 269 270 // std::cout<<"sizeOfLastMipMap="<<sizeOfLastMipMap<<"\ts="<<s<<"\tt="<<t<<"\tr"<<r<<std::endl;270 // notify(INFO)<<"sizeOfLastMipMap="<<sizeOfLastMipMap<<"\ts="<<s<<"\tt="<<t<<"\tr"<<r<<std::endl; 271 271 272 272 return maxValue+sizeOfLastMipMap; … … 492 492 if (!_data) 493 493 { 494 cout<<"allocating image"<<endl;494 notify(INFO)<<"allocating image"<<endl; 495 495 allocateImage(s_offset+source->r(),t_offset+source->t(),r_offset+source->t(), 496 496 source->getPixelFormat(),source->getDataType(), -
OpenSceneGraph/trunk/src/osg/ShapeDrawable.cpp
r1890 r1984 17 17 using namespace osg; 18 18 19 // arbitrary minima for rows & segments 20 const unsigned int MIN_NUM_ROWS = 3; 21 const unsigned int MIN_NUM_SEGMENTS = 5; 22 23 19 24 /////////////////////////////////////////////////////////////////////////////// 20 25 // … … 30 35 _hints(hints) 31 36 { 37 #if 0 32 38 if (hints) 33 39 { 34 40 notify(NOTICE)<<"Warning: TessellationHints ignored in present osg::ShapeDrawable implementation."<<std::endl; 35 41 } 36 42 #endif 37 43 } 38 44 … … 60 66 glTranslatef(sphere.getCenter().x(),sphere.getCenter().y(),sphere.getCenter().z()); 61 67 62 63 68 unsigned int numSegments = 40; 64 69 unsigned int numRows = 20; 70 if (_hints && _hints->getDetailRatio() != 1.0f) { 71 float ratio = _hints->getDetailRatio(); 72 numRows = (unsigned int) (numRows * ratio); 73 if (numRows < MIN_NUM_ROWS) 74 numRows = MIN_NUM_ROWS; 75 numSegments = (unsigned int) (numSegments * ratio); 76 if (numSegments < MIN_NUM_SEGMENTS) 77 numSegments = MIN_NUM_SEGMENTS; 78 } 65 79 66 80 float lDelta = osg::PI/(float)numRows; … … 77 91 float nRatioBase=0.0f; 78 92 79 for(unsigned int rowi=0; 80 rowi<numRows; 81 ++rowi) 93 for(unsigned int rowi=0; rowi<numRows; ++rowi) 82 94 { 83 95 … … 94 106 float texCoord = 0.0f; 95 107 96 for(unsigned int topi=0; 97 topi<numSegments; 108 for(unsigned int topi=0; topi<numSegments; 98 109 ++topi,angle+=angleDelta,texCoord+=texCoordHorzDelta) 99 110 { … … 136 147 137 148 } 138 139 140 149 141 150 glPopMatrix(); … … 144 153 void DrawShapeVisitor::apply(const Box& box) 145 154 { 155 // evaluate hints 156 bool createBody = (_hints ? _hints->getCreateBody() : true); 157 bool createTop = (_hints ? _hints->getCreateTop() : true); 158 bool createBottom = (_hints ? _hints->getCreateBottom() : true); 146 159 147 160 float dx = box.getHalfLengths().x(); … … 161 174 glBegin(GL_QUADS); 162 175 176 if (createBody) { 163 177 // -ve y plane 164 178 glNormal3f(0.0f,-1.0f,0.0f); … … 220 234 glTexCoord2f(1.0f,1.0f); 221 235 glVertex3f(-dx,-dy,dz); 222 236 } 237 238 if (createTop) { 223 239 // +ve z plane 224 240 glNormal3f(0.0f,0.0f,1.0f); … … 235 251 glTexCoord2f(1.0f,1.0f); 236 252 glVertex3f(dx,dy,dz); 237 253 } 254 255 if (createBottom) { 238 256 // -ve z plane 239 257 glNormal3f(0.0f,0.0f,-1.0f); … … 250 268 glTexCoord2f(1.0f,1.0f); 251 269 glVertex3f(-dx,dy,-dz); 270 } 252 271 253 272 glEnd(); … … 269 288 } 270 289 290 // evaluate hints 291 bool createBody = (_hints ? _hints->getCreateBody() : true); 292 bool createBottom = (_hints ? _hints->getCreateBottom() : true); 271 293 272 294 unsigned int numSegments = 40; 273 295 unsigned int numRows = 10; 296 if (_hints && _hints->getDetailRatio() != 1.0f) { 297 float ratio = _hints->getDetailRatio(); 298 numRows = (unsigned int) (numRows * ratio); 299 if (numRows < MIN_NUM_ROWS) 300 numRows = MIN_NUM_ROWS; 301 numSegments = (unsigned int) (numSegments * ratio); 302 if (numSegments < MIN_NUM_SEGMENTS) 303 numSegments = MIN_NUM_SEGMENTS; 304 } 274 305 275 306 float r = cone.getRadius(); … … 295 326 float texCoord; 296 327 297 for(unsigned int rowi=0; 298 rowi<numRows; 299 ++rowi,topz=basez, basez-=hDelta, topr=baser, baser+=rDelta, topv=basev, basev-=texCoordRowDelta) 300 { 301 // we can't use a fan for the cone top 302 // since we need different normals at the top 303 // for each face.. 304 glBegin(GL_QUAD_STRIP); 305 306 angle = 0.0f; 307 texCoord = 0.0f; 308 for(unsigned int topi=0; 309 topi<numSegments; 310 ++topi,angle+=angleDelta,texCoord+=texCoordHorzDelta) 311 { 312 313 float c = cosf(angle); 314 float s = sinf(angle); 315 316 glNormal3f(c*normalRatio,s*normalRatio,normalz); 317 318 glTexCoord2f(texCoord,topv); 319 glVertex3f(c*topr,s*topr,topz); 320 321 glTexCoord2f(texCoord,basev); 322 glVertex3f(c*baser,s*baser,basez); 323 324 } 325 326 // do last point by hand to ensure no round off errors. 327 glNormal3f(normalRatio,0.0f,normalz); 328 329 glTexCoord2f(1.0f,topv); 330 glVertex3f(topr,0.0f,topz); 331 332 glTexCoord2f(1.0f,basev); 333 glVertex3f(baser,0.0f,basez); 334 335 glEnd(); 336 337 } 338 339 // we can't use a fan for the cone top 340 // since we need different normals at the top 341 // for each face.. 342 glBegin(GL_TRIANGLE_FAN); 343 344 angle = osg::PI*2.0f; 345 texCoord = 1.0f; 346 basez = cone.getBaseOffset(); 347 348 glNormal3f(0.0f,0.0f,-1.0f); 349 glTexCoord2f(0.5f,0.5f); 350 glVertex3f(0.0f,0.0f,basez); 351 352 for(unsigned int bottomi=0; 353 bottomi<numSegments; 354 ++bottomi,angle-=angleDelta,texCoord-=texCoordHorzDelta) 355 { 356 357 float c = cosf(angle); 358 float s = sinf(angle); 359 360 glTexCoord2f(c*0.5f+0.5f,s*0.5f+0.5f); 361 glVertex3f(c*r,s*r,basez); 362 363 } 364 365 glTexCoord2f(1.0f,0.0f); 366 glVertex3f(r,0.0f,basez); 367 368 glEnd(); 369 328 if (createBody) { 329 for(unsigned int rowi=0; rowi<numRows; 330 ++rowi,topz=basez, basez-=hDelta, topr=baser, baser+=rDelta, topv=basev, basev-=texCoordRowDelta) { 331 // we can't use a fan for the cone top 332 // since we need different normals at the top 333 // for each face.. 334 glBegin(GL_QUAD_STRIP); 335 336 angle = 0.0f; 337 texCoord = 0.0f; 338 for(unsigned int topi=0; topi<numSegments; 339 ++topi,angle+=angleDelta,texCoord+=texCoordHorzDelta) { 340 341 float c = cosf(angle); 342 float s = sinf(angle); 343 344 glNormal3f(c*normalRatio,s*normalRatio,normalz); 345 346 glTexCoord2f(texCoord,topv); 347 glVertex3f(c*topr,s*topr,topz); 348 349 glTexCoord2f(texCoord,basev); 350 glVertex3f(c*baser,s*baser,basez); 351 } 352 353 // do last point by hand to ensure no round off errors. 354 glNormal3f(normalRatio,0.0f,normalz); 355 356 glTexCoord2f(1.0f,topv); 357 glVertex3f(topr,0.0f,topz); 358 359 glTexCoord2f(1.0f,basev); 360 glVertex3f(baser,0.0f,basez); 361 362 glEnd(); 363 } 364 } 365 366 if (createBottom) { 367 glBegin(GL_TRIANGLE_FAN); 368 369 angle = osg::PI*2.0f; 370 texCoord = 1.0f; 371 basez = cone.getBaseOffset(); 372 373 glNormal3f(0.0f,0.0f,-1.0f); 374 glTexCoord2f(0.5f,0.5f); 375 glVertex3f(0.0f,0.0f,basez); 376 377 for(unsigned int bottomi=0; bottomi<numSegments; 378 ++bottomi,angle-=angleDelta,texCoord-=texCoordHorzDelta) { 379 380 float c = cosf(angle); 381 float s = sinf(angle); 382 383 glTexCoord2f(c*0.5f+0.5f,s*0.5f+0.5f); 384 glVertex3f(c*r,s*r,basez); 385 } 386 387 glTexCoord2f(1.0f,0.0f); 388 glVertex3f(r,0.0f,basez); 389 390 glEnd(); 391 } 392 370 393 glPopMatrix(); 371 394 } … … 383 406 } 384 407 408 // evaluate hints 409 bool createBody = (_hints ? _hints->getCreateBody() : true); 410 bool createTop = (_hints ? _hints->getCreateTop() : true); 411 bool createBottom = (_hints ? _hints->getCreateBottom() : true); 385 412 386 413 unsigned int numSegments = 40; 414 if (_hints && _hints->getDetailRatio() != 1.0f) { 415 float ratio = _hints->getDetailRatio(); 416 numSegments = (unsigned int) (numSegments * ratio); 417 if (numSegments < MIN_NUM_SEGMENTS) 418 numSegments = MIN_NUM_SEGMENTS; 419 } 387 420 388 421 float angleDelta = 2.0f*osg::PI/(float)numSegments; 389 390 float texCoordDelta = 1.0/(float)numSegments; 422 float texCoordDelta = 1.0f/(float)numSegments; 391 423 392 424 float r = cylinder.getRadius(); … … 396 428 float topz = h*0.5f; 397 429 430 float angle = 0.0f; 431 float texCoord = 0.0f; 432 398 433 // cylinder body 399 glBegin(GL_QUAD_STRIP); 400 401 float angle = 0.0f; 402 float texCoord = 0.0f; 434 if (createBody) { 435 glBegin(GL_QUAD_STRIP); 436 403 437 for(unsigned int bodyi=0; 404 438 bodyi<numSegments; 405 439 ++bodyi,angle+=angleDelta,texCoord+=texCoordDelta) 406 440 { 407 408 441 float c = cosf(angle); 409 442 float s = sinf(angle); … … 416 449 glTexCoord2f(texCoord,0.0f); 417 450 glVertex3f(c*r,s*r,basez); 418 419 451 } 420 452 … … 428 460 glVertex3f(r,0.0f,basez); 429 461 430 glEnd();431 432 433 434 // cylinder top435 glBegin(GL_TRIANGLE_FAN);462 glEnd(); 463 } 464 465 // cylinder top 466 if (createTop) { 467 glBegin(GL_TRIANGLE_FAN); 436 468 437 469 glNormal3f(0.0f,0.0f,1.0f); … … 445 477 ++topi,angle+=angleDelta,texCoord+=texCoordDelta) 446 478 { 447 448 479 float c = cosf(angle); 449 480 float s = sinf(angle); … … 451 482 glTexCoord2f(c*0.5f+0.5f,s*0.5f+0.5f); 452 483 glVertex3f(c*r,s*r,topz); 453 454 484 } 455 485 … … 457 487 glVertex3f(r,0.0f,topz); 458 488 459 glEnd(); 489 glEnd(); 490 } 460 491 461 492 // cylinder bottom 462 glBegin(GL_TRIANGLE_FAN); 493 if (createBottom) { 494 glBegin(GL_TRIANGLE_FAN); 463 495 464 496 glNormal3f(0.0f,0.0f,-1.0f); … … 472 504 ++bottomi,angle-=angleDelta,texCoord-=texCoordDelta) 473 505 { 474 475 506 float c = cosf(angle); 476 507 float s = sinf(angle); … … 478 509 glTexCoord2f(c*0.5f+0.5f,s*0.5f+0.5f); 479 510 glVertex3f(c*r,s*r,basez); 480 481 511 } 482 512 … … 484 514 glVertex3f(r,0.0f,basez); 485 515 486 glEnd(); 516 glEnd(); 517 } 487 518 488 519 glPopMatrix(); … … 520 551 glEnd(); 521 552 } 522 523 524 553 } 525 554 … … 1263 1292 } 1264 1293 1265 ShapeDrawable::ShapeDrawable(Shape* shape): 1266 _color(1.0f,1.0f,1.0f,1.0f) 1294 ShapeDrawable::ShapeDrawable(Shape* shape,TessellationHints* hints): 1295 _color(1.0f,1.0f,1.0f,1.0f), 1296 _tessellationHints(hints) 1267 1297 { 1268 1298 setShape(shape); -
OpenSceneGraph/trunk/src/osg/Texture2D.cpp
r1927 r1984 29 29 } 30 30 31 Texture2D::Texture2D(osg::Image* image): 32 _textureWidth(0), 33 _textureHeight(0), 34 _numMipmapLevels(0) 35 { 36 setUseHardwareMipMapGeneration(true); 37 setImage(image); 38 } 39 31 40 Texture2D::Texture2D(const Texture2D& text,const CopyOp& copyop): 32 41 Texture(text,copyop), -
OpenSceneGraph/trunk/src/osgPlugins/osg/GNUmakefile
r1960 r1984 48 48 Stencil.cpp\ 49 49 Switch.cpp\ 50 TessellationHints.cpp\ 50 51 TexEnv.cpp\ 51 52 TexEnvCombine.cpp\ -
OpenSceneGraph/trunk/src/osgPlugins/osg/ShapeDrawable.cpp
r1890 r1984 1 1 #include <osg/ShapeDrawable> 2 #include <osg/Notify> 2 3 3 4 #include <osgDB/Registry> … … 11 12 bool ShapeDrawable_readLocalData(Object& obj, Input& fr); 12 13 bool ShapeDrawable_writeLocalData(const Object& obj, Output& fw); 13 14 // //register the read and write functions with the osgDB::Registry.15 // RegisterDotOsgWrapperProxy g_ShapeDrawableFuncProxy16 // (17 // new osg::ShapeDrawable,18 // "ShapeDrawable",19 // "Object Drawable ShapeDrawable",20 // 0,21 // 0,22 // DotOsgWrapper::READ_AND_WRITE23 // );24 14 25 15 RegisterDotOsgWrapperProxy g_ShapeDrawableFuncProxy … … 53 43 } 54 44 45 ref_ptr<Object> readObject = fr.readObject(); 46 if (readObject.valid()) { 47 TessellationHints* hints = dynamic_cast<TessellationHints*>(readObject.get()); 48 if (hints) 49 geom.setTessellationHints(hints); 50 else 51 notify(WARN) << "Warning: " << readObject->className() << " loaded but cannot be attached to ShapeDrawable.\n"; 52 iteratorAdvanced = true; 53 } 54 55 55 return iteratorAdvanced; 56 56 } … … 62 62 fw.indent() << "color " << geom.getColor() << std::endl; 63 63 64 const TessellationHints* hints = geom.getTessellationHints(); 65 if (hints) 66 fw.writeObject(*hints); 67 64 68 return true; 65 69 } -
OpenSceneGraph/trunk/src/osgSim/GNUmakefile
r1983 r1984 10 10 Sector.cpp\ 11 11 Version.cpp\ 12 12 13 13 # SphereSegment.cpp\ 14 14 -
OpenSceneGraph/trunk/src/osgUtil/GNUmakefile
r1889 r1984 22 22 Tesselator.cpp\ 23 23 TransformCallback.cpp\ 24 TransformAttributeFunctor.cpp\ 24 25 TriStripVisitor.cpp\ 25 26 TriStrip_tri_stripper.cpp\ -
OpenSceneGraph/trunk/src/osgUtil/Optimizer.cpp
r1983 r1984 14 14 15 15 #include <osg/Transform> 16 #include <osg/TransformAttributeFunctor>17 16 #include <osg/MatrixTransform> 18 17 #include <osg/PositionAttitudeTransform> … … 26 25 #include <osg/Switch> 27 26 27 #include <osgUtil/TransformAttributeFunctor> 28 28 29 #include <typeinfo> 29 30 #include <algorithm> … … 498 499 if (drawable) 499 500 { 500 osg ::TransformAttributeFunctor tf(matrix);501 osgUtil::TransformAttributeFunctor tf(matrix); 501 502 drawable->accept(tf); 502 503 drawable->dirtyBound(); … … 533 534 matrix_no_trans.setTrans(0.0f,0.0f,0.0f); 534 535 535 osg ::TransformAttributeFunctor tf(matrix_no_trans);536 osgUtil::TransformAttributeFunctor tf(matrix_no_trans); 536 537 537 538 osg::Vec3 axis = osg::Matrix::transform3x3(tf._im,billboard->getAxis());
