---------------------------------------------------------------------
| 365 | } |
| 366 | //--------------------------------------------------------------------- |
| 367 | void Grid2DPageStrategy::updateDebugDisplay(Page* p, SceneNode* sn) |
| 368 | { |
| 369 | uint8 dbglvl = mManager->getDebugDisplayLevel(); |
| 370 | if (dbglvl) |
| 371 | { |
| 372 | // we could try to avoid updating the geometry every time here, but this |
| 373 | // wouldn't easily deal with paging parameter changes. There shouldn't |
| 374 | // be that many pages anyway, and this is debug after all, so update every time |
| 375 | int32 x, y; |
| 376 | Grid2DPageStrategyData* stratData = static_cast<Grid2DPageStrategyData*>( |
| 377 | p->getParentSection()->getStrategyData()); |
| 378 | stratData->calculateCell(p->getID(), &x, &y); |
| 379 | |
| 380 | Grid2DPageStrategyData* data = static_cast<Grid2DPageStrategyData*>(p->getParentSection()->getStrategyData()); |
| 381 | |
| 382 | // Determine our centre point, we'll anchor here |
| 383 | // Note that world points are initialised to ZERO since only 2 dimensions |
| 384 | // are updated by the grid data (we could display this grid anywhere) |
| 385 | Vector2 gridMidPoint; |
| 386 | Vector3 worldMidPoint = Vector3::ZERO; |
| 387 | data->getMidPointGridSpace(x, y, gridMidPoint); |
| 388 | data->convertGridToWorldSpace(gridMidPoint, worldMidPoint); |
| 389 | |
| 390 | sn->setPosition(worldMidPoint); |
| 391 | |
| 392 | Vector2 gridCorners[4]; |
| 393 | Vector3 worldCorners[4]; |
| 394 | |
| 395 | data->getCornersGridSpace(x, y, gridCorners); |
| 396 | for (int i = 0; i < 4; ++i) |
| 397 | { |
| 398 | worldCorners[i] = Vector3::ZERO; |
| 399 | data->convertGridToWorldSpace(gridCorners[i], worldCorners[i]); |
| 400 | // make relative to mid point |
| 401 | worldCorners[i] -= worldMidPoint; |
| 402 | } |
| 403 | |
| 404 | String matName = "Ogre/G2D/Debug"; |
| 405 | MaterialPtr mat = MaterialManager::getSingleton().getByName(matName); |
| 406 | if (!mat) |
| 407 | { |
| 408 | mat = MaterialManager::getSingleton().create(matName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); |
| 409 | Pass* pass = mat->getTechnique(0)->getPass(0); |
| 410 | pass->setLightingEnabled(false); |
| 411 | pass->setVertexColourTracking(TVC_AMBIENT); |
| 412 | pass->setDepthWriteEnabled(false); |
| 413 | mat->load(); |
| 414 | } |
| 415 | |
| 416 | |
| 417 | ManualObject* mo = 0; |
| 418 | if (sn->numAttachedObjects() == 0) |
| 419 | { |
| 420 | mo = p->getParentSection()->getSceneManager()->createManualObject(); |
| 421 | mo->begin(matName, RenderOperation::OT_LINE_STRIP); |
| 422 | } |
| 423 | else |
| 424 | { |
nothing calls this directly
no test coverage detected