osg::Node* OSGTerrainEngineNode::createTile( const TileKey& key ) { if ( !_tileBuilder.valid() ) return 0L; osg::ref_ptr<Tile> tile; bool hasRealData, hasLodBlendedLayers; _tileBuilder->createTile( key, false, tile, hasRealData, hasLodBlendedLayers ); if ( !tile.valid() ) return 0L; // code block required in order to properly manage the ref count of the transform SinglePassTerrainTechnique* tech = new SinglePassTerrainTechnique( _texCompositor.get() ); // prepare the interpolation technique for generating triangles: if ( getMap()->getMapOptions().elevationInterpolation() == INTERP_TRIANGULATE ) tech->setOptimizeTriangleOrientation( false ); tile->setTerrainTechnique( tech ); tile->init(); return tech->takeTransform(); }
void OSGTerrainEngineNode::installTerrainTechnique() { if ( _texCompositor->getTechnique() == TerrainOptions::COMPOSITING_MULTIPASS ) { _terrain->setTechniquePrototype( new MultiPassTerrainTechnique( _texCompositor.get() ) ); OE_INFO << LC << "Compositing technique = MULTIPASS" << std::endl; } else { SinglePassTerrainTechnique* tech = new SinglePassTerrainTechnique( _texCompositor.get() ); tech->setClearDataAfterCompile( !_isStreaming ); if ( getMap()->getMapOptions().elevationInterpolation() == INTERP_TRIANGULATE ) tech->setOptimizeTriangleOrientation( false ); _terrain->setTechniquePrototype( tech ); } }
void OSGTerrainEngineNode::installTerrainTechnique() { if ( _texCompositor->getTechnique() == TerrainOptions::COMPOSITING_MULTIPASS ) { //If we are using multipass mode, disable GLSL on it, it is using straight FFP _terrain->getOrCreateStateSet()->setAttributeAndModes( new osg::Program(), osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED ); _terrain->setTechniquePrototype( new MultiPassTerrainTechnique( _texCompositor.get() ) ); OE_INFO << LC << "Compositing technique = MULTIPASS" << std::endl; } else { SinglePassTerrainTechnique* tech = new SinglePassTerrainTechnique( _texCompositor.get() ); tech->setClearDataAfterCompile( !_isStreaming ); if ( getMap()->getMapOptions().elevationInterpolation() == INTERP_TRIANGULATE ) tech->setOptimizeTriangleOrientation( false ); _terrain->setTechniquePrototype( tech ); } }