MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / GetSpheres

Method GetSpheres

TombEngine/Renderer/RendererHelper.cpp:422–463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420 }
421
422 std::vector<BoundingSphere> Renderer::GetSpheres(int itemNumber)
423 {
424 auto& itemToDraw = _items[itemNumber];
425 itemToDraw.ItemNumber = itemNumber;
426
427 const auto* nativeItem = &g_Level.Items[itemNumber];
428 if (nativeItem == nullptr)
429 return {};
430
431 if (!itemToDraw.DoneAnimations)
432 {
433 if (itemNumber == LaraItem->Index)
434 {
435 UpdateLaraAnimations(false);
436 }
437 else
438 {
439 UpdateItemAnimations(itemNumber, false);
440 }
441 }
442
443 auto translationMatrix = Matrix::CreateTranslation(nativeItem->Pose.Position.ToVector3());
444 auto rotMatrix = nativeItem->Pose.Orientation.ToRotationMatrix();
445 auto worldMatrix = rotMatrix * translationMatrix;
446
447 const auto& moveable = GetRendererObject(nativeItem->ObjectNumber);
448
449 // Collect spheres.
450 auto spheres = std::vector<BoundingSphere>{};
451 for (int i = 0; i < moveable.ObjectMeshes.size(); i++)
452 {
453 const auto& mesh = *moveable.ObjectMeshes[i];
454
455 const auto& translationMatrix = itemToDraw.AnimTransforms[i];
456 auto pos = Vector3::Transform(mesh.Sphere.Center, translationMatrix * worldMatrix);
457
458 auto sphere = BoundingSphere(pos, mesh.Sphere.Radius);
459 spheres.push_back(sphere);
460 }
461
462 return spheres;
463 }
464
465 void Renderer::GetBoneMatrix(short itemNumber, int jointIndex, Matrix* outMatrix)
466 {

Callers

nothing calls this directly

Calls 4

ToVector3Method · 0.45
ToRotationMatrixMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected