MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / AddElementRecursive

Method AddElementRecursive

ogsr_engine/xrGame/PHShell.cpp:577–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575}
576ICF bool no_physics_shape(const SBoneShape& shape) { return shape.type == SBoneShape::stNone || shape.flags.test(SBoneShape::sfNoPhysics); }
577void CPHShell::AddElementRecursive(CPhysicsElement* root_e, u16 id, Fmatrix global_parent, u16 element_number, bool* vis_check)
578{
579 // CBoneInstance& B = m_pKinematics->LL_GetBoneInstance(u16(id));
580 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
581
582 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
583
584 CBoneData& bone_data = m_pKinematics->LL_GetData(u16(id));
585 SJointIKData& joint_data = bone_data.IK_data;
586 Fmatrix fm_position;
587 fm_position.set(bone_data.bind_transform);
588 fm_position.mulA_43(global_parent);
589 VisMask mask = m_pKinematics->LL_GetBonesVisible();
590 bool no_visible = !mask.is(id);
591 bool lvis_check = false;
592 if (no_visible)
593 {
594 for (vecBonesIt it = bone_data.children.begin(); bone_data.children.end() != it; ++it)
595 AddElementRecursive(root_e, (*it)->GetSelfID(), fm_position, element_number, &lvis_check);
596 return;
597 }
598
599 CPhysicsElement* E = 0;
600 CPhysicsJoint* J = 0;
601 bool breakable = joint_data.ik_flags.test(SJointIKData::flBreakable) && root_e && !(no_physics_shape(bone_data.shape) && joint_data.type == jtRigid);
602
603 ///////////////////////////////////////////////////////////////
604 lvis_check = (check_obb_sise(bone_data.obb));
605
606 bool* arg_check = vis_check;
607 if (breakable || !root_e)
608 {
609 arg_check = &lvis_check;
610 }
611 else
612 {
613 *vis_check = *vis_check || lvis_check;
614 }
615 /////////////////////////////////////////////////////////////////////
616
617 bool element_added = false; // set true when if elemen created and added by this call
618 u16 splitter_position = 0;
619 u16 fracture_num = u16(-1);
620
621 if (!no_physics_shape(bone_data.shape) || !root_e) //
622 {
623 if (joint_data.type == jtRigid && root_e) //
624 {
625 Fmatrix vs_root_position;
626 vs_root_position.set(root_e->mXFORM);
627 vs_root_position.invert();
628 vs_root_position.mulB_43(fm_position);
629
630 E = root_e;
631 if (breakable)
632 {
633 CPHFracture fracture;
634 fracture.m_bone_id = id;

Callers

nothing calls this directly

Calls 15

no_physics_shapeFunction · 0.85
check_obb_siseFunction · 0.85
P_create_ElementFunction · 0.85
P_create_JointFunction · 0.85
fsimilarFunction · 0.85
MsgFunction · 0.85
LogFunction · 0.85
mulA_43Method · 0.80
LL_GetBonesVisibleMethod · 0.80
isMethod · 0.80
mulB_43Method · 0.80
MassSetFirstMethod · 0.80

Tested by

no test coverage detected