- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/stl/ReaderWriterSTL.cpp
r12697 r13041 91 91 OSG_INFO << "ReaderWriterSTL::writeNode: Files are separated written" << std::endl; 92 92 } else { 93 m_f = new osgDB::ofstream(m_fout.c_str()); 93 m_f = new osgDB::ofstream(m_fout.c_str()); 94 94 *m_f << "solid " << counter << std::endl; 95 95 } … … 102 102 } 103 103 104 virtual void apply( osg::Geode& node ){ 104 virtual void apply( osg::Geode& node ){ 105 105 osg::Matrix mat = osg::computeLocalToWorld( getNodePath() ); 106 106 107 107 if (m_options && (m_options->getOptionString() == "separateFiles")) { 108 108 std::string sepFile = m_fout + i2s(counter); … … 110 110 *m_f << "solid " << std::endl; 111 111 } 112 112 113 113 for ( unsigned int i = 0; i < node.getNumDrawables(); ++i ) { 114 114 osg::TriangleFunctor<PushPoints> tf; … … 117 117 node.getDrawable( i )->accept( tf ); 118 118 } 119 119 120 120 if (m_options && (m_options->getOptionString() == "separateFiles")) { 121 121 *m_f << "endsolid " << std::endl; … … 123 123 delete m_f; 124 124 } 125 125 126 126 ++counter; 127 127 traverse(node); 128 128 129 129 } 130 130 // nHandle->SetLocation( Frame( mat ) ); … … 138 138 } 139 139 } 140 140 141 141 const std::string& getErrorString() const { return m_ErrorString; } 142 142 143 143 private: 144 144 int counter; … … 147 147 osgDB::ReaderWriter::Options const * m_options; 148 148 std::string m_ErrorString; 149 150 149 150 151 151 struct PushPoints { 152 152 std::ofstream* m_stream; … … 167 167 *m_stream << "endfacet " << std::endl; 168 168 } 169 169 170 170 }; 171 172 171 172 173 173 }; 174 175 176 174 175 176 177 177 }; 178 178 … … 239 239 } 240 240 off_t expectLen = sizeof_StlHeader + expectFacets * sizeof_StlFacet; 241 241 242 242 struct stat stb; 243 243 if (fstat(fileno(fp), &stb) < 0) … … 265 265 } 266 266 267 if (!isBinary) 267 if (!isBinary) 268 268 { 269 269 fclose(fp); … … 280 280 return ReadResult::FILE_NOT_HANDLED; 281 281 } 282 282 283 283 OSG_INFO << "STL loader found " << readerObject._numFacets << " facets" << std::endl; 284 284 … … 302 302 osg::Geode* geode = new osg::Geode; 303 303 geode->addDrawable(geom); 304 304 305 305 if (options && (options->getOptionString() == "smooth")) { 306 306 osgUtil::SmoothingVisitor smooter; … … 477 477 return WriteResult::FILE_NOT_HANDLED; 478 478 } 479 479 480 480 CreateStlVisitor createStlVisitor( fileName, opts ); 481 481 const_cast<osg::Node&>(node).accept( createStlVisitor );
