Changeset 13041 for OpenSceneGraph/trunk/src/osgPlugins/txp/TileMapper.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/txp/TileMapper.cpp
r12536 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 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 */ … … 44 44 const osg::Matrix& matrix = *_modelviewStack.back(); 45 45 float dist = distance(pos,matrix); 46 46 47 47 if (withLODScale) 48 48 return dist*getLODScale(); … … 53 53 void TileMapper::apply(osg::Node& node) 54 54 { 55 if (node.getName()=="TileContent") 55 if (node.getName()=="TileContent") 56 56 { 57 57 _containsGeode = true; … … 73 73 void TileMapper::apply(osg::Group& node) 74 74 { 75 if (node.getName()=="TileContent") 75 if (node.getName()=="TileContent") 76 76 { 77 77 _containsGeode = true; … … 86 86 87 87 TileIdentifier* tid = dynamic_cast<TileIdentifier*>(node.getUserData()); 88 88 89 89 if (tid) 90 90 { … … 103 103 104 104 } 105 105 106 106 } 107 107 … … 172 172 } 173 173 TileIdentifier parent_tid(tid.x/2,tid.y/2,tid.lod-1); 174 174 175 175 bool parentHasNorthNeighour = _tileMap.count(TileIdentifier(parent_tid.x, parent_tid.y+1,parent_tid.lod))!=0; 176 176 bool parentHasEastNeighour = _tileMap.count(TileIdentifier(parent_tid.x+1,parent_tid.y, parent_tid.lod))!=0; 177 177 bool parentHasSouthNeighour = _tileMap.count(TileIdentifier(parent_tid.x, parent_tid.y-1,parent_tid.lod))!=0; 178 178 bool parentHasWestNeighour = _tileMap.count(TileIdentifier(parent_tid.x-1,parent_tid.y, parent_tid.lod))!=0; 179 179 180 180 181 181 // identify whether the tile is a NE/SE/SW/NW tile relative to its parent. 182 182 osg::Vec3 delta(tid.x%2,tid.y%2,0); 183 183 184 184 if (delta.y()>0.0f) // noth side 185 { 185 { 186 186 if (delta.x()>0.0f) 187 187 { … … 192 192 return parentHasEastNeighour; 193 193 } 194 else 194 else 195 195 { 196 196 // NW … … 211 211 return parentHasEastNeighour; 212 212 } 213 else 213 else 214 214 { 215 215 // SW … … 220 220 } 221 221 } 222 222 223 223 return false; 224 224 }
