- Timestamp:
- 04/16/08 02:25:04 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Source/Contrib/Manipulators/OSGSimpleGeometryExt.cpp
r837 r1168 56 56 OSG_BEGIN_NAMESPACE 57 57 58 Geometry Ptr makeGridGeo(const Real32 width,59 const Real32 depth,60 const Real32 hCellWidth,61 const Color3f &color )58 GeometryTransitPtr makeGridGeo(const Real32 width, 59 const Real32 depth, 60 const Real32 hCellWidth, 61 const Color3f &color ) 62 62 { 63 63 Int32 nCols, nRows; … … 67 67 Color3f(color[0] - 0.4, color[1] - 0.4, color[2] - 0.4); 68 68 69 Geometry Ptr geo = Geometry::create();70 GeoPnt3fProperty Ptr pnts = GeoPnt3fProperty ::create();71 GeoUInt32Property Ptr lens = GeoUInt32Property ::create();72 GeoUInt8Property Ptr types = GeoUInt8Property ::create();73 GeoColor3fProperty Ptr colors = GeoColor3fProperty::create();69 GeometryTransitPtr geo = Geometry::create(); 70 GeoPnt3fPropertyUnrecPtr pnts = GeoPnt3fProperty ::create(); 71 GeoUInt32PropertyUnrecPtr lens = GeoUInt32Property ::create(); 72 GeoUInt8PropertyUnrecPtr types = GeoUInt8Property ::create(); 73 GeoColor3fPropertyUnrecPtr colors = GeoColor3fProperty::create(); 74 74 // GeoIndicesUI32Ptr indices = GeoIndicesUI32::create(); 75 SimpleMaterial Ptr mat = SimpleMaterial::create();75 SimpleMaterialUnrecPtr mat = SimpleMaterial::create(); 76 76 77 77 Real32 height (0.0 ); … … 156 156 } 157 157 158 Geometry Ptr makeGridBorderGeo(const Real32 width,159 const Real32 depth,160 const Color3f &color)158 GeometryTransitPtr makeGridBorderGeo(const Real32 width, 159 const Real32 depth, 160 const Color3f &color) 161 161 { 162 162 const Color3f darkerColor = 163 163 Color3f( color[0]-0.4, color[1]-0.4, color[2]-0.4 ); 164 164 165 Geometry Ptr geo = Geometry::create();166 GeoPnt3fProperty Ptr pnts = GeoPnt3fProperty::create();167 GeoUInt32Property Ptr lens = GeoUInt32Property::create();168 GeoUInt8Property Ptr types = GeoUInt8Property::create();169 GeoColor3fProperty Ptr colors = GeoColor3fProperty::create();165 GeometryTransitPtr geo = Geometry::create(); 166 GeoPnt3fPropertyUnrecPtr pnts = GeoPnt3fProperty::create(); 167 GeoUInt32PropertyUnrecPtr lens = GeoUInt32Property::create(); 168 GeoUInt8PropertyUnrecPtr types = GeoUInt8Property::create(); 169 GeoColor3fPropertyUnrecPtr colors = GeoColor3fProperty::create(); 170 170 // GeoIndicesUI32Ptr indices = GeoIndicesUI32::create(); 171 SimpleMaterial Ptr mat = SimpleMaterial::create();172 LineChunk Ptr lineChunk = LineChunk::create();171 SimpleMaterialUnrecPtr mat = SimpleMaterial::create(); 172 LineChunkUnrecPtr lineChunk = LineChunk::create(); 173 173 174 174 Real32 height (0.0 ); … … 249 249 * The grid has the base color <i>color</i>. 250 250 */ 251 Node Ptr makeGrid(const Real32 width,252 const Real32 depth,253 const Real32 hCellWidth,254 const Color3f &color )255 { 256 Node PtrgrpNode = Node::create();257 Group PtrgrpCore = Group::create();258 Node PtrgridNode = Node::create();259 Node PtrborderNode = Node::create();251 NodeTransitPtr makeGrid(const Real32 width, 252 const Real32 depth, 253 const Real32 hCellWidth, 254 const Color3f &color ) 255 { 256 NodeTransitPtr grpNode = Node::create(); 257 GroupUnrecPtr grpCore = Group::create(); 258 NodeUnrecPtr gridNode = Node::create(); 259 NodeUnrecPtr borderNode = Node::create(); 260 260 261 261 gridNode->setCore (makeGridGeo(width, depth, hCellWidth, color)); … … 272 272 273 273 274 Node Ptr makeSelection(NodePtr geoN)275 { 276 Node PtrtransN = Node::create();277 Node Ptr node = Node::create();278 ComponentTransform Ptr transC = ComponentTransform::create();274 NodeTransitPtr makeSelection(NodePtr geoN) 275 { 276 NodeTransitPtr transN = Node::create(); 277 NodeUnrecPtr node = Node::create(); 278 ComponentTransformUnrecPtr transC = ComponentTransform::create(); 279 279 280 280 node->setCore(makeSelectionGeo(geoN)); … … 283 283 transN->addChild(node ); 284 284 285 addRef(transN);286 287 285 commitChanges(); 288 286 … … 290 288 } 291 289 292 Geometry Ptr makeSelectionGeo(NodePtr geoN)290 GeometryTransitPtr makeSelectionGeo(NodePtr geoN) 293 291 { 294 292 Pnt3f min, max; 295 293 geoN->getVolume().getBounds(min, max); 296 294 297 Geometry Ptrgeo = Geometry::create();298 GeoPnt3fProperty Ptr newPnts = GeoPnt3fProperty::create();299 GeoUInt32Property Ptr lens = GeoUInt32Property::create();300 GeoUInt8Property Ptr types = GeoUInt8Property::create();301 GeoColor3fProperty Ptr colors = GeoColor3fProperty::create();295 GeometryTransitPtr geo = Geometry::create(); 296 GeoPnt3fPropertyUnrecPtr newPnts = GeoPnt3fProperty::create(); 297 GeoUInt32PropertyUnrecPtr lens = GeoUInt32Property::create(); 298 GeoUInt8PropertyUnrecPtr types = GeoUInt8Property::create(); 299 GeoColor3fPropertyUnrecPtr colors = GeoColor3fProperty::create(); 302 300 303 301 // GeoIndicesUI32Ptr indices = GeoIndicesUI32::create(); 304 SimpleMaterial Ptr mat = SimpleMaterial::create();305 306 LineChunk Ptr lineChunk = LineChunk::create();302 SimpleMaterialUnrecPtr mat = SimpleMaterial::create(); 303 304 LineChunkUnrecPtr lineChunk = LineChunk::create(); 307 305 308 306 GeometryPtr selGeoC = dynamic_cast<GeometryPtr>(geoN->getCore()); … … 350 348 351 349 352 PolygonChunk Ptr _gayaPolygonChunk;350 PolygonChunkUnrecPtr _gayaPolygonChunk; 353 351 354 352 PolygonChunkPtr getPolygonChunk(const UInt16 faces, … … 358 356 { 359 357 _gayaPolygonChunk = PolygonChunk::create(); 360 361 addRef(_gayaPolygonChunk);362 358 363 359 _gayaPolygonChunk->setCullFace(faces); … … 374 370 } 375 371 376 MaterialChunk Ptr _gayaMaterialChunk;372 MaterialChunkRecPtr _gayaMaterialChunk; 377 373 378 374 MaterialChunkPtr getMaterialChunk(const Color4f &ambientColor, … … 385 381 _gayaMaterialChunk = MaterialChunk::create(); 386 382 387 addRef(_gayaMaterialChunk);388 389 383 _gayaMaterialChunk->setDiffuse(diffuseColor); 390 384 _gayaMaterialChunk->setAmbient(ambientColor); … … 397 391 } 398 392 399 ChunkMaterial Ptr _gayaSelectionMaterial;393 ChunkMaterialRecPtr _gayaSelectionMaterial; 400 394 401 395 ChunkMaterialPtr getSelectionMaterial() … … 404 398 { 405 399 _gayaSelectionMaterial = ChunkMaterial::create(); 406 407 addRef(_gayaSelectionMaterial);408 400 409 401 _gayaSelectionMaterial->addChunk(getPolygonChunk());
