Changeset 13041 for OpenSceneGraph/trunk/src/osgTerrain/TerrainTile.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgTerrain/TerrainTile.cpp
r11479 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 */ … … 79 79 _blendingPolicy(terrain._blendingPolicy) 80 80 { 81 if (terrain.getTerrainTechnique()) 81 if (terrain.getTerrainTechnique()) 82 82 { 83 83 setTerrainTechnique(dynamic_cast<TerrainTechnique*>(terrain.getTerrainTechnique()->cloneType())); … … 98 98 { 99 99 if (_terrain == ts) return; 100 100 101 101 if (_terrain) _terrain->unregisterTerrainTile(this); 102 102 103 103 _terrain = ts; 104 104 … … 132 132 { 133 133 osgTerrain::Terrain* ts = dynamic_cast<Terrain*>(*itr); 134 if (ts) 134 if (ts) 135 135 { 136 136 OSG_INFO<<"Assigning terrain system "<<ts<<std::endl; … … 170 170 { 171 171 if (_terrain && _terrain->getTerrainTechniquePrototype()) 172 { 172 { 173 173 osg::ref_ptr<osg::Object> object = _terrain->getTerrainTechniquePrototype()->clone(osg::CopyOp::DEEP_COPY_ALL); 174 174 setTerrainTechnique(dynamic_cast<TerrainTechnique*>(object.get())); … … 188 188 void TerrainTile::setTerrainTechnique(TerrainTechnique* terrainTechnique) 189 189 { 190 if (_terrainTechnique == terrainTechnique) return; 190 if (_terrainTechnique == terrainTechnique) return; 191 191 192 192 int dirtyDelta = (_dirtyMask==NOT_DIRTY) ? 0 : -1; 193 193 194 if (_terrainTechnique.valid()) 194 if (_terrainTechnique.valid()) 195 195 { 196 196 _terrainTechnique->setTerrainTile(0); … … 198 198 199 199 _terrainTechnique = terrainTechnique; 200 201 if (_terrainTechnique.valid()) 200 201 if (_terrainTechnique.valid()) 202 202 { 203 203 _terrainTechnique->setTerrainTile(this); 204 ++dirtyDelta; 205 } 206 204 ++dirtyDelta; 205 } 206 207 207 if (dirtyDelta>0) setDirtyMask(ALL_DIRTY); 208 208 else if (dirtyDelta<0) setDirtyMask(NOT_DIRTY); … … 249 249 { 250 250 if (_colorLayers.size() <= i) _colorLayers.resize(i+1); 251 251 252 252 _colorLayers[i] = layer; 253 253 } … … 256 256 { 257 257 osg::BoundingSphere bs; 258 258 259 259 if (_elevationLayer.valid()) 260 260 { … … 270 270 } 271 271 } 272 272 273 273 return bs; 274 274 } … … 301 301 bool WhiteListTileLoadedCallback::readImageLayer(osgTerrain::ImageLayer* imageLayer, const osgDB::ReaderWriter::Options* options) const 302 302 { 303 if (!imageLayer->getImage() && 303 if (!imageLayer->getImage() && 304 304 !imageLayer->getFileName().empty()) 305 305 { … … 341 341 { 342 342 if (readImageLayer(imageLayer, options)) 343 { 344 // replace SwitchLayer by 343 { 344 // replace SwitchLayer by 345 345 if (_replaceSwitchLayer) tile->setColorLayer(i, imageLayer); 346 346 else if (switchLayer->getActiveLayer()<0) switchLayer->setActiveLayer(si);
