| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | #include <osgUtil/IntersectionVisitor> |
|---|
| 16 | #include <osgUtil/LineSegmentIntersector> |
|---|
| 17 | |
|---|
| 18 | #include <osg/PagedLOD> |
|---|
| 19 | #include <osg/Transform> |
|---|
| 20 | #include <osg/Projection> |
|---|
| 21 | #include <osg/Camera> |
|---|
| 22 | #include <osg/Geode> |
|---|
| 23 | #include <osg/Billboard> |
|---|
| 24 | #include <osg/Geometry> |
|---|
| 25 | #include <osg/Notify> |
|---|
| 26 | #include <osg/io_utils> |
|---|
| 27 | |
|---|
| 28 | using namespace osgUtil; |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | IntersectorGroup::IntersectorGroup() |
|---|
| 37 | { |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | void IntersectorGroup::addIntersector(Intersector* intersector) |
|---|
| 41 | { |
|---|
| 42 | _intersectors.push_back(intersector); |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | void IntersectorGroup::clear() |
|---|
| 46 | { |
|---|
| 47 | _intersectors.clear(); |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | Intersector* IntersectorGroup::clone(osgUtil::IntersectionVisitor& iv) |
|---|
| 51 | { |
|---|
| 52 | IntersectorGroup* ig = new IntersectorGroup; |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | for(Intersectors::iterator itr = _intersectors.begin(); |
|---|
| 56 | itr != _intersectors.end(); |
|---|
| 57 | ++itr) |
|---|
| 58 | { |
|---|
| 59 | if (!(*itr)->disabled()) |
|---|
| 60 | { |
|---|
| 61 | ig->addIntersector( (*itr)->clone(iv) ); |
|---|
| 62 | } |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | return ig; |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | bool IntersectorGroup::enter(const osg::Node& node) |
|---|
| 69 | { |
|---|
| 70 | if (disabled()) return false; |
|---|
| 71 | |
|---|
| 72 | bool foundIntersections = false; |
|---|
| 73 | |
|---|
| 74 | for(Intersectors::iterator itr = _intersectors.begin(); |
|---|
| 75 | itr != _intersectors.end(); |
|---|
| 76 | ++itr) |
|---|
| 77 | { |
|---|
| 78 | if ((*itr)->disabled()) (*itr)->incrementDisabledCount(); |
|---|
| 79 | else if ((*itr)->enter(node)) foundIntersections = true; |
|---|
| 80 | else (*itr)->incrementDisabledCount(); |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | if (!foundIntersections) |
|---|
| 84 | { |
|---|
| 85 | |
|---|
| 86 | leave(); |
|---|
| 87 | return false; |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | return true; |
|---|
| 92 | } |
|---|
| 93 | |
|---|
| 94 | void IntersectorGroup::leave() |
|---|
| 95 | { |
|---|
| 96 | for(Intersectors::iterator itr = _intersectors.begin(); |
|---|
| 97 | itr != _intersectors.end(); |
|---|
| 98 | ++itr) |
|---|
| 99 | { |
|---|
| 100 | if ((*itr)->disabled()) (*itr)->decrementDisabledCount(); |
|---|
| 101 | } |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | void IntersectorGroup::intersect(osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable) |
|---|
| 105 | { |
|---|
| 106 | if (disabled()) return; |
|---|
| 107 | |
|---|
| 108 | unsigned int numTested = 0; |
|---|
| 109 | for(Intersectors::iterator itr = _intersectors.begin(); |
|---|
| 110 | itr != _intersectors.end(); |
|---|
| 111 | ++itr) |
|---|
| 112 | { |
|---|
| 113 | if (!(*itr)->disabled()) |
|---|
| 114 | { |
|---|
| 115 | (*itr)->intersect(iv, drawable); |
|---|
| 116 | |
|---|
| 117 | ++numTested; |
|---|
| 118 | } |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | void IntersectorGroup::reset() |
|---|
| 126 | { |
|---|
| 127 | Intersector::reset(); |
|---|
| 128 | |
|---|
| 129 | for(Intersectors::iterator itr = _intersectors.begin(); |
|---|
| 130 | itr != _intersectors.end(); |
|---|
| 131 | ++itr) |
|---|
| 132 | { |
|---|
| 133 | (*itr)->reset(); |
|---|
| 134 | } |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | bool IntersectorGroup::containsIntersections() |
|---|
| 138 | { |
|---|
| 139 | for(Intersectors::iterator itr = _intersectors.begin(); |
|---|
| 140 | itr != _intersectors.end(); |
|---|
| 141 | ++itr) |
|---|
| 142 | { |
|---|
| 143 | if ((*itr)->containsIntersections()) return true; |
|---|
| 144 | } |
|---|
| 145 | return false; |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | IntersectionVisitor::IntersectionVisitor(Intersector* intersector, ReadCallback* readCallback) |
|---|
| 155 | { |
|---|
| 156 | |
|---|
| 157 | setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); |
|---|
| 158 | |
|---|
| 159 | _useKdTreesWhenAvailable = true; |
|---|
| 160 | _dummyTraversal = false; |
|---|
| 161 | |
|---|
| 162 | _lodSelectionMode = USE_HIGHEST_LEVEL_OF_DETAIL; |
|---|
| 163 | _eyePointDirty = true; |
|---|
| 164 | |
|---|
| 165 | LineSegmentIntersector* ls = dynamic_cast<LineSegmentIntersector*>(intersector); |
|---|
| 166 | if (ls) |
|---|
| 167 | { |
|---|
| 168 | setReferenceEyePoint(ls->getStart()); |
|---|
| 169 | setReferenceEyePointCoordinateFrame(ls->getCoordinateFrame()); |
|---|
| 170 | } |
|---|
| 171 | else |
|---|
| 172 | { |
|---|
| 173 | setReferenceEyePoint(osg::Vec3(0.0f,0.0f,0.0f)); |
|---|
| 174 | setReferenceEyePointCoordinateFrame(Intersector::VIEW); |
|---|
| 175 | } |
|---|
| 176 | |
|---|
| 177 | setIntersector(intersector); |
|---|
| 178 | |
|---|
| 179 | setReadCallback(readCallback); |
|---|
| 180 | } |
|---|
| 181 | |
|---|
| 182 | void IntersectionVisitor::setIntersector(Intersector* intersector) |
|---|
| 183 | { |
|---|
| 184 | |
|---|
| 185 | osg::ref_ptr<Intersector> temp = intersector; |
|---|
| 186 | |
|---|
| 187 | _intersectorStack.clear(); |
|---|
| 188 | |
|---|
| 189 | if (intersector) _intersectorStack.push_back(intersector); |
|---|
| 190 | } |
|---|
| 191 | |
|---|
| 192 | void IntersectionVisitor::reset() |
|---|
| 193 | { |
|---|
| 194 | if (!_intersectorStack.empty()) |
|---|
| 195 | { |
|---|
| 196 | osg::ref_ptr<Intersector> intersector = _intersectorStack.front(); |
|---|
| 197 | intersector->reset(); |
|---|
| 198 | |
|---|
| 199 | _intersectorStack.clear(); |
|---|
| 200 | _intersectorStack.push_back(intersector); |
|---|
| 201 | } |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | void IntersectionVisitor::apply(osg::Node& node) |
|---|
| 205 | { |
|---|
| 206 | |
|---|
| 207 | |
|---|
| 208 | if (!enter(node)) return; |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | traverse(node); |
|---|
| 213 | |
|---|
| 214 | leave(); |
|---|
| 215 | } |
|---|
| 216 | |
|---|
| 217 | void IntersectionVisitor::apply(osg::Group& group) |
|---|
| 218 | { |
|---|
| 219 | if (!enter(group)) return; |
|---|
| 220 | |
|---|
| 221 | traverse(group); |
|---|
| 222 | |
|---|
| 223 | leave(); |
|---|
| 224 | } |
|---|
| 225 | |
|---|
| 226 | void IntersectionVisitor::apply(osg::Geode& geode) |
|---|
| 227 | { |
|---|
| 228 | |
|---|
| 229 | |
|---|
| 230 | if (!enter(geode)) return; |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | for(unsigned int i=0; i<geode.getNumDrawables(); ++i) |
|---|
| 235 | { |
|---|
| 236 | intersect( geode.getDrawable(i) ); |
|---|
| 237 | } |
|---|
| 238 | |
|---|
| 239 | leave(); |
|---|
| 240 | } |
|---|
| 241 | |
|---|
| 242 | void IntersectionVisitor::apply(osg::Billboard& billboard) |
|---|
| 243 | { |
|---|
| 244 | if (!enter(billboard)) return; |
|---|
| 245 | |
|---|
| 246 | #if 1 |
|---|
| 247 | |
|---|
| 248 | osg::Vec3 eye_local = getEyePoint(); |
|---|
| 249 | |
|---|
| 250 | for(unsigned int i = 0; i < billboard.getNumDrawables(); i++ ) |
|---|
| 251 | { |
|---|
| 252 | const osg::Vec3& pos = billboard.getPosition(i); |
|---|
| 253 | osg::ref_ptr<osg::RefMatrix> billboard_matrix = new osg::RefMatrix; |
|---|
| 254 | if (getViewMatrix()) |
|---|
| 255 | { |
|---|
| 256 | if (getModelMatrix()) billboard_matrix->mult( *getModelMatrix(), *getViewMatrix() ); |
|---|
| 257 | else billboard_matrix->set( *getViewMatrix() ); |
|---|
| 258 | } |
|---|
| 259 | else if (getModelMatrix()) billboard_matrix->set( *getModelMatrix() ); |
|---|
| 260 | |
|---|
| 261 | billboard.computeMatrix(*billboard_matrix,eye_local,pos); |
|---|
| 262 | |
|---|
| 263 | if (getViewMatrix()) billboard_matrix->postMult( osg::Matrix::inverse(*getViewMatrix()) ); |
|---|
| 264 | pushModelMatrix(billboard_matrix.get()); |
|---|
| 265 | |
|---|
| 266 | |
|---|
| 267 | push_clone(); |
|---|
| 268 | |
|---|
| 269 | intersect( billboard.getDrawable(i) ); |
|---|
| 270 | |
|---|
| 271 | |
|---|
| 272 | pop_clone(); |
|---|
| 273 | |
|---|
| 274 | popModelMatrix(); |
|---|
| 275 | |
|---|
| 276 | } |
|---|
| 277 | #else |
|---|
| 278 | |
|---|
| 279 | for(unsigned int i=0; i<billboard.getNumDrawables(); ++i) |
|---|
| 280 | { |
|---|
| 281 | intersect( billboard.getDrawable(i) ); |
|---|
| 282 | } |
|---|
| 283 | #endif |
|---|
| 284 | |
|---|
| 285 | leave(); |
|---|
| 286 | } |
|---|
| 287 | |
|---|
| 288 | void IntersectionVisitor::apply(osg::LOD& lod) |
|---|
| 289 | { |
|---|
| 290 | if (!enter(lod)) return; |
|---|
| 291 | |
|---|
| 292 | traverse(lod); |
|---|
| 293 | |
|---|
| 294 | leave(); |
|---|
| 295 | } |
|---|
| 296 | |
|---|
| 297 | |
|---|
| 298 | void IntersectionVisitor::apply(osg::PagedLOD& plod) |
|---|
| 299 | { |
|---|
| 300 | if (!enter(plod)) return; |
|---|
| 301 | |
|---|
| 302 | if (plod.getNumFileNames()>0) |
|---|
| 303 | { |
|---|
| 304 | #if 1 |
|---|
| 305 | |
|---|
| 306 | float targetRangeValue; |
|---|
| 307 | if( plod.getRangeMode() == osg::LOD::DISTANCE_FROM_EYE_POINT ) |
|---|
| 308 | targetRangeValue = 1e6; |
|---|
| 309 | else |
|---|
| 310 | targetRangeValue = 0; |
|---|
| 311 | |
|---|
| 312 | const osg::LOD::RangeList rl = plod.getRangeList(); |
|---|
| 313 | osg::LOD::RangeList::const_iterator rit; |
|---|
| 314 | for( rit = rl.begin(); |
|---|
| 315 | rit != rl.end(); |
|---|
| 316 | rit++ ) |
|---|
| 317 | { |
|---|
| 318 | if( plod.getRangeMode() == osg::LOD::DISTANCE_FROM_EYE_POINT ) |
|---|
| 319 | { |
|---|
| 320 | if( rit->first < targetRangeValue ) |
|---|
| 321 | targetRangeValue = rit->first; |
|---|
| 322 | } |
|---|
| 323 | else |
|---|
| 324 | { |
|---|
| 325 | if( rit->first > targetRangeValue ) |
|---|
| 326 | targetRangeValue = rit->first; |
|---|
| 327 | } |
|---|
| 328 | } |
|---|
| 329 | |
|---|
| 330 | |
|---|
| 331 | |
|---|
| 332 | unsigned int childIndex; |
|---|
| 333 | for( rit = rl.begin(), childIndex = 0; |
|---|
| 334 | rit != rl.end(); |
|---|
| 335 | rit++, childIndex++ ) |
|---|
| 336 | { |
|---|
| 337 | if( rit->first != targetRangeValue ) |
|---|
| 338 | |
|---|
| 339 | continue; |
|---|
| 340 | |
|---|
| 341 | osg::ref_ptr<osg::Node> child( NULL ); |
|---|
| 342 | if( plod.getNumChildren() > childIndex ) |
|---|
| 343 | child = plod.getChild( childIndex ); |
|---|
| 344 | |
|---|
| 345 | if( (!child.valid()) && (_readCallback.valid()) ) |
|---|
| 346 | { |
|---|
| 347 | |
|---|
| 348 | unsigned int validIndex( childIndex ); |
|---|
| 349 | if (plod.getNumFileNames() <= childIndex) |
|---|
| 350 | validIndex = plod.getNumFileNames()-1; |
|---|
| 351 | |
|---|
| 352 | child = _readCallback->readNodeFile( plod.getDatabasePath() + plod.getFileName( validIndex ) ); |
|---|
| 353 | } |
|---|
| 354 | |
|---|
| 355 | if ( !child.valid() && plod.getNumChildren()>0) |
|---|
| 356 | { |
|---|
| 357 | |
|---|
| 358 | child = plod.getChild( plod.getNumChildren()-1 ); |
|---|
| 359 | } |
|---|
| 360 | |
|---|
| 361 | if (child.valid()) |
|---|
| 362 | { |
|---|
| 363 | child->accept(*this); |
|---|
| 364 | } |
|---|
| 365 | } |
|---|
| 366 | #else |
|---|
| 367 | |
|---|
| 368 | |
|---|
| 369 | |
|---|
| 370 | osg::ref_ptr<osg::Node> highestResChild; |
|---|
| 371 | |
|---|
| 372 | if (plod.getNumFileNames() != plod.getNumChildren() && _readCallback.valid()) |
|---|
| 373 | { |
|---|
| 374 | highestResChild = _readCallback->readNodeFile( plod.getDatabasePath() + plod.getFileName(plod.getNumFileNames()-1) ); |
|---|
| 375 | } |
|---|
| 376 | |
|---|
| 377 | if ( !highestResChild.valid() && plod.getNumChildren()>0) |
|---|
| 378 | { |
|---|
| 379 | highestResChild = plod.getChild( plod.getNumChildren()-1 ); |
|---|
| 380 | } |
|---|
| 381 | |
|---|
| 382 | if (highestResChild.valid()) |
|---|
| 383 | { |
|---|
| 384 | highestResChild->accept(*this); |
|---|
| 385 | } |
|---|
| 386 | #endif |
|---|
| 387 | } |
|---|
| 388 | |
|---|
| 389 | leave(); |
|---|
| 390 | } |
|---|
| 391 | |
|---|
| 392 | |
|---|
| 393 | void IntersectionVisitor::apply(osg::Transform& transform) |
|---|
| 394 | { |
|---|
| 395 | if (!enter(transform)) return; |
|---|
| 396 | |
|---|
| 397 | osg::ref_ptr<osg::RefMatrix> matrix = _modelStack.empty() ? new osg::RefMatrix() : new osg::RefMatrix(*_modelStack.back()); |
|---|
| 398 | transform.computeLocalToWorldMatrix(*matrix,this); |
|---|
| 399 | |
|---|
| 400 | pushModelMatrix(matrix.get()); |
|---|
| 401 | |
|---|
| 402 | |
|---|
| 403 | push_clone(); |
|---|
| 404 | |
|---|
| 405 | traverse(transform); |
|---|
| 406 | |
|---|
| 407 | |
|---|
| 408 | pop_clone(); |
|---|
| 409 | |
|---|
| 410 | popModelMatrix(); |
|---|
| 411 | |
|---|
| 412 | |
|---|
| 413 | leave(); |
|---|
| 414 | } |
|---|
| 415 | |
|---|
| 416 | |
|---|
| 417 | void IntersectionVisitor::apply(osg::Projection& projection) |
|---|
| 418 | { |
|---|
| 419 | if (!enter(projection)) return; |
|---|
| 420 | |
|---|
| 421 | pushProjectionMatrix(new osg::RefMatrix(projection.getMatrix()) ); |
|---|
| 422 | |
|---|
| 423 | |
|---|
| 424 | push_clone(); |
|---|
| 425 | |
|---|
| 426 | traverse(projection); |
|---|
| 427 | |
|---|
| 428 | |
|---|
| 429 | pop_clone(); |
|---|
| 430 | |
|---|
| 431 | popProjectionMatrix(); |
|---|
| 432 | |
|---|
| 433 | leave(); |
|---|
| 434 | } |
|---|
| 435 | |
|---|
| 436 | |
|---|
| 437 | void IntersectionVisitor::apply(osg::Camera& camera) |
|---|
| 438 | { |
|---|
| 439 | |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | |
|---|
| 446 | osg::RefMatrix* projection = NULL; |
|---|
| 447 | osg::RefMatrix* view = NULL; |
|---|
| 448 | osg::RefMatrix* model = NULL; |
|---|
| 449 | |
|---|
| 450 | if (camera.getReferenceFrame()==osg::Transform::RELATIVE_RF && getProjectionMatrix() && getViewMatrix()) |
|---|
| 451 | { |
|---|
| 452 | if (camera.getTransformOrder()==osg::Camera::POST_MULTIPLY) |
|---|
| 453 | { |
|---|
| 454 | projection = new osg::RefMatrix(*getProjectionMatrix()*camera.getProjectionMatrix()); |
|---|
| 455 | view = new osg::RefMatrix(*getViewMatrix()*camera.getViewMatrix()); |
|---|
| 456 | model = new osg::RefMatrix(*getModelMatrix()); |
|---|
| 457 | } |
|---|
| 458 | else |
|---|
| 459 | { |
|---|
| 460 | projection = new osg::RefMatrix(camera.getProjectionMatrix()*(*getProjectionMatrix())); |
|---|
| 461 | view = new osg::RefMatrix(*getViewMatrix()); |
|---|
| 462 | model = new osg::RefMatrix(camera.getViewMatrix()*(*getModelMatrix())); |
|---|
| 463 | } |
|---|
| 464 | } |
|---|
| 465 | else |
|---|
| 466 | { |
|---|
| 467 | |
|---|
| 468 | projection = new osg::RefMatrix(camera.getProjectionMatrix()); |
|---|
| 469 | view = new osg::RefMatrix(camera.getViewMatrix()); |
|---|
| 470 | model = new osg::RefMatrix(); |
|---|
| 471 | } |
|---|
| 472 | |
|---|
| 473 | if (camera.getViewport()) pushWindowMatrix( camera.getViewport() ); |
|---|
| 474 | pushProjectionMatrix(projection); |
|---|
| 475 | pushViewMatrix(view); |
|---|
| 476 | pushModelMatrix(model); |
|---|
| 477 | |
|---|
| 478 | |
|---|
| 479 | push_clone(); |
|---|
| 480 | |
|---|
| 481 | traverse(camera); |
|---|
| 482 | |
|---|
| 483 | |
|---|
| 484 | pop_clone(); |
|---|
| 485 | |
|---|
| 486 | popModelMatrix(); |
|---|
| 487 | popViewMatrix(); |
|---|
| 488 | popProjectionMatrix(); |
|---|
| 489 | if (camera.getViewport()) popWindowMatrix(); |
|---|
| 490 | |
|---|
| 491 | |
|---|
| 492 | } |
|---|
| 493 | |
|---|
| 494 | osg::Vec3 IntersectionVisitor::getEyePoint() const |
|---|
| 495 | { |
|---|
| 496 | if (!_eyePointDirty) return _eyePoint; |
|---|
| 497 | |
|---|
| 498 | osg::Matrix matrix; |
|---|
| 499 | switch (_referenceEyePointCoordinateFrame) |
|---|
| 500 | { |
|---|
| 501 | case(Intersector::WINDOW): |
|---|
| 502 | if (getWindowMatrix()) matrix.preMult( *getWindowMatrix() ); |
|---|
| 503 | if (getProjectionMatrix()) matrix.preMult( *getProjectionMatrix() ); |
|---|
| 504 | if (getViewMatrix()) matrix.preMult( *getViewMatrix() ); |
|---|
| 505 | if (getModelMatrix()) matrix.preMult( *getModelMatrix() ); |
|---|
| 506 | break; |
|---|
| 507 | case(Intersector::PROJECTION): |
|---|
| 508 | if (getProjectionMatrix()) matrix.preMult( *getProjectionMatrix() ); |
|---|
| 509 | if (getViewMatrix()) matrix.preMult( *getViewMatrix() ); |
|---|
| 510 | if (getModelMatrix()) matrix.preMult( *getModelMatrix() ); |
|---|
| 511 | break; |
|---|
| 512 | case(Intersector::VIEW): |
|---|
| 513 | if (getViewMatrix()) matrix.preMult( *getViewMatrix() ); |
|---|
| 514 | if (getModelMatrix()) matrix.preMult( *getModelMatrix() ); |
|---|
| 515 | break; |
|---|
| 516 | case(Intersector::MODEL): |
|---|
| 517 | if (getModelMatrix()) matrix = *getModelMatrix(); |
|---|
| 518 | break; |
|---|
| 519 | } |
|---|
| 520 | |
|---|
| 521 | osg::Matrix inverse; |
|---|
| 522 | inverse.invert(matrix); |
|---|
| 523 | |
|---|
| 524 | _eyePoint = _referenceEyePoint * inverse; |
|---|
| 525 | _eyePointDirty = false; |
|---|
| 526 | |
|---|
| 527 | return _eyePoint; |
|---|
| 528 | } |
|---|
| 529 | |
|---|
| 530 | float IntersectionVisitor::getDistanceToEyePoint(const osg::Vec3& pos, bool ) const |
|---|
| 531 | { |
|---|
| 532 | if (_lodSelectionMode==USE_EYE_POINT_FOR_LOD_LEVEL_SELECTION) |
|---|
| 533 | { |
|---|
| 534 | return (pos-getEyePoint()).length(); |
|---|
| 535 | } |
|---|
| 536 | else |
|---|
| 537 | { |
|---|
| 538 | return 0.0f; |
|---|
| 539 | } |
|---|
| 540 | } |
|---|