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

Method Initialize

TombEngine/Game/effects/hair.cpp:335–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333 }
334
335 void HairEffectController::Initialize()
336 {
337 constexpr auto DEFAULT_ORIENT = EulerAngles(ANGLE(-90.0f), 0, 0);
338
339 bool isYoung = (g_GameFlow->GetLevel(CurrentLevel)->GetLaraType() == LaraType::Young);
340
341 // Initialize hair units.
342 for (int i = 0; i < Units.size(); i++)
343 {
344 auto& unit = Units[i];
345
346 auto objectID = (i == 0) ? ID_HAIR_PRIMARY : ID_HAIR_SECONDARY;
347 const auto& object = Objects[objectID];
348
349 unit.IsEnabled = (object.loaded && (i == 0 || (i == 1 && isYoung)));
350 unit.IsInitialized = false;
351 unit.ObjectID = objectID;
352 unit.Segments.resize(object.nmeshes + 1);
353
354 // Initialize segments.
355 for (auto& segment : unit.Segments)
356 {
357 segment.Position = GetJointOffset(objectID, 0, true);
358 segment.Velocity = Vector3::Zero;
359 segment.Orientation = DEFAULT_ORIENT.ToQuaternion();
360 }
361 }
362 }
363
364 void HairEffectController::Update(ItemInfo& item)
365 {

Callers 3

ResetHairFunction · 0.45
DoLevelFunction · 0.45
InitializeLaraFunction · 0.45

Calls 8

ANGLEFunction · 0.85
GetJointOffsetFunction · 0.85
GetLaraTypeMethod · 0.80
GetLevelMethod · 0.80
EulerAnglesClass · 0.50
sizeMethod · 0.45
resizeMethod · 0.45
ToQuaternionMethod · 0.45

Tested by

no test coverage detected