MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / DrawCameraAnimation

Method DrawCameraAnimation

src/Renderer/Renderer.cpp:642–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

640}
641
642void Renderer::DrawCameraAnimation() {
643 if (track->tag != NFS_3_PS1) {
644 for (uint8_t can_Idx = 0; can_Idx < track->camera_animations.size(); ++can_Idx) {
645 if (can_Idx < track->camera_animations.size() - 1) {
646 // Draw CAN positions
647 SHARED::CANPT refPt = track->camera_animations[can_Idx];
648 SHARED::CANPT refPtNext = track->camera_animations[can_Idx + 1];
649 glm::vec3 vroadPoint = glm::normalize(glm::quat(glm::vec3(-SIMD_PI / 2, 0, 0))) *
650 glm::vec3((refPt.x / 65536.0f) / 10.f, ((refPt.y / 65536.0f) / 10.f),
651 (refPt.z / 65536.0f) / 10.f);
652 glm::vec3 vroadPointNext = glm::normalize(glm::quat(glm::vec3(-SIMD_PI / 2, 0, 0))) *
653 glm::vec3((refPtNext.x / 65536.0f) / 10.f,
654 ((refPtNext.y / 65536.0f) / 10.f),
655 (refPtNext.z / 65536.0f) / 10.f);
656 vroadPoint.y += 0.2f;
657 vroadPointNext.y += 0.2f;
658 physicsEngine.mydebugdrawer.drawLine(
659 Utils::glmToBullet(vroadPoint + mainCamera.initialPosition),
660 Utils::glmToBullet(vroadPointNext + mainCamera.initialPosition), btVector3(0, 1, 1));
661
662 // Draw Rotations
663 glm::quat RotationMatrix =
664 glm::normalize(glm::quat(glm::vec3(glm::radians(0.f), glm::radians(-90.f), 0))) *
665 glm::normalize(
666 glm::quat(refPt.od1 / 65536.0f, refPt.od2 / 65536.0f, refPt.od3 / 65536.0f,
667 refPt.od4 / 65536.0f));
668 glm::vec3 direction = glm::normalize(vroadPoint * glm::inverse(RotationMatrix));
669 physicsEngine.mydebugdrawer.drawLine(
670 Utils::glmToBullet(vroadPoint + mainCamera.initialPosition),
671 Utils::glmToBullet(vroadPoint + mainCamera.initialPosition + direction),
672 btVector3(0, 0.5, 0.5));
673 }
674 }
675 }
676}
677
678

Callers

nothing calls this directly

Calls 2

glmToBulletFunction · 0.85
drawLineMethod · 0.80

Tested by

no test coverage detected