Changeset 13041 for OpenSceneGraph/trunk/src/osgUtil/SceneGraphBuilder.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgUtil/SceneGraphBuilder.cpp
r12372 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 60 60 { 61 61 if (!_matrixStack.empty()) _matrixStack.pop_back(); 62 62 63 63 matrixChanged(); 64 64 } … … 215 215 { 216 216 osg::Vec3 vertex(x,y,z); 217 217 218 218 vertex = vertex * _matrixStack.back(); 219 219 220 220 if (_vertices.valid()) _vertices->push_back(vertex); 221 221 if (_normal.valid()) _normals->push_back(_normal); … … 229 229 _primitiveMode = mode; 230 230 _vertices = new osg::Vec3Array; 231 231 232 232 _normalSet = false; 233 233 _normals = new osg::Vec3Array; … … 246 246 247 247 _geometry->setVertexArray(_vertices.get()); 248 248 249 249 if (_colorSet) 250 250 { … … 256 256 osg::Vec4Array* colors = new osg::Vec4Array; 257 257 colors->push_back(_color); 258 258 259 259 _geometry->setColorArray(colors); 260 260 _geometry->setColorBinding(osg::Geometry::BIND_OVERALL); 261 261 } 262 262 263 263 if (_normalSet) 264 264 { … … 270 270 _geometry->setNormalBinding(osg::Geometry::BIND_OFF); 271 271 } 272 272 273 273 if (_maxNumTexCoordComponents==1) 274 274 { … … 449 449 { 450 450 osg::ref_ptr<osg::Node> node; 451 451 452 452 if (_group.valid() && _group->getNumChildren()>0) node = _group.get(); 453 453 else if (_transform.valid() && _transform->getNumChildren()>0) node = _transform.get(); 454 454 else if (_geode.valid() && _geode->getNumDrawables()>0) node = _geode.get(); 455 455 456 456 // reset all the pointers to properly release the scene graph 457 457 _geometry = 0; … … 459 459 _transform = 0; 460 460 _group = 0; 461 461 462 462 return node.release(); 463 463 } … … 496 496 osg::ShapeDrawable* sd = new osg::ShapeDrawable(shape); 497 497 sd->setColor(_color); 498 498 499 499 addDrawable(sd); 500 500 } … … 520 520 _statesetAssigned = false; 521 521 } 522 522 523 523 if (!_stateset) _stateset = new osg::StateSet; 524 524 }
