| 465 | } |
| 466 | |
| 467 | void SimpleOpenGL3App::drawText3D(const char* txt, float position[3], float orientation[4], float color[4], float size, int optionFlag) |
| 468 | { |
| 469 | B3_PROFILE("SimpleOpenGL3App::drawText3D"); |
| 470 | float viewMat[16]; |
| 471 | float projMat[16]; |
| 472 | CommonCameraInterface* cam = m_instancingRenderer->getActiveCamera(); |
| 473 | |
| 474 | cam->getCameraViewMatrix(viewMat); |
| 475 | cam->getCameraProjectionMatrix(projMat); |
| 476 | |
| 477 | float camPos[4]; |
| 478 | cam->getCameraPosition(camPos); |
| 479 | //b3Vector3 cp= b3MakeVector3(camPos[0],camPos[2],camPos[1]); |
| 480 | //b3Vector3 p = b3MakeVector3(worldPosX,worldPosY,worldPosZ); |
| 481 | //float dist = (cp-p).length(); |
| 482 | //float dv = 0;//dist/1000.f; |
| 483 | // |
| 484 | //printf("str = %s\n",unicodeText); |
| 485 | |
| 486 | float dx = 0; |
| 487 | |
| 488 | //int measureOnly=0; |
| 489 | |
| 490 | glEnable(GL_BLEND); |
| 491 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 492 | int viewport[4] = {0, 0, m_instancingRenderer->getScreenWidth(), m_instancingRenderer->getScreenHeight()}; |
| 493 | |
| 494 | float posX = position[0]; |
| 495 | float posY = position[1]; |
| 496 | float posZ = position[2]; |
| 497 | float winx, winy, winz; |
| 498 | |
| 499 | if (optionFlag & CommonGraphicsApp::eDrawText3D_OrtogonalFaceCamera) |
| 500 | { |
| 501 | if (!projectWorldCoordToScreen(position[0], position[1], position[2], viewMat, projMat, viewport, &winx, &winy, &winz)) |
| 502 | { |
| 503 | return; |
| 504 | } |
| 505 | posX = winx; |
| 506 | posY = m_instancingRenderer->getScreenHeight() / 2 + (m_instancingRenderer->getScreenHeight() / 2) - winy; |
| 507 | posZ = 0.f; |
| 508 | } |
| 509 | |
| 510 | if (optionFlag & CommonGraphicsApp::eDrawText3D_TrueType) |
| 511 | { |
| 512 | bool measureOnly = false; |
| 513 | |
| 514 | float fontSize = 64; //512;//128; |
| 515 | |
| 516 | if (optionFlag & CommonGraphicsApp::eDrawText3D_OrtogonalFaceCamera) |
| 517 | { |
| 518 | sth_draw_text(m_data->m_fontStash, |
| 519 | m_data->m_droidRegular, fontSize, posX, posY, |
| 520 | txt, &dx, this->m_instancingRenderer->getScreenWidth(), this->m_instancingRenderer->getScreenHeight(), measureOnly, m_window->getRetinaScale(), color); |
| 521 | sth_end_draw(m_data->m_fontStash); |
| 522 | sth_flush_draw(m_data->m_fontStash); |
| 523 | } |
| 524 | else |
nothing calls this directly
no test coverage detected