////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// * Generic collision query for generic OPCODE models. After the call, access the results: * - with GetContactStatus() * - with GetNbTouchedPrimitives() * - with GetTouchedPrimitives() * * \param cache
| 87 | */ |
| 88 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 89 | bool LSSCollider::Collide(LSSCache& cache, const LSS& lss, const Model& model, const Matrix4x4* worldl, const Matrix4x4* worldm) |
| 90 | { |
| 91 | // Checkings |
| 92 | if(!Setup(&model)) return false; |
| 93 | |
| 94 | // Init collision query |
| 95 | if(InitQuery(cache, lss, worldl, worldm)) return true; |
| 96 | |
| 97 | if(!model.HasLeafNodes()) |
| 98 | { |
| 99 | if(model.IsQuantized()) |
| 100 | { |
| 101 | const AABBQuantizedNoLeafTree* Tree = (const AABBQuantizedNoLeafTree*)model.GetTree(); |
| 102 | |
| 103 | // Setup dequantization coeffs |
| 104 | mCenterCoeff = Tree->mCenterCoeff; |
| 105 | mExtentsCoeff = Tree->mExtentsCoeff; |
| 106 | |
| 107 | // Perform collision query |
| 108 | if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes()); |
| 109 | else _Collide(Tree->GetNodes()); |
| 110 | } |
| 111 | else |
| 112 | { |
| 113 | const AABBNoLeafTree* Tree = (const AABBNoLeafTree*)model.GetTree(); |
| 114 | |
| 115 | // Perform collision query |
| 116 | if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes()); |
| 117 | else _Collide(Tree->GetNodes()); |
| 118 | } |
| 119 | } |
| 120 | else |
| 121 | { |
| 122 | if(model.IsQuantized()) |
| 123 | { |
| 124 | const AABBQuantizedTree* Tree = (const AABBQuantizedTree*)model.GetTree(); |
| 125 | |
| 126 | // Setup dequantization coeffs |
| 127 | mCenterCoeff = Tree->mCenterCoeff; |
| 128 | mExtentsCoeff = Tree->mExtentsCoeff; |
| 129 | |
| 130 | // Perform collision query |
| 131 | if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes()); |
| 132 | else _Collide(Tree->GetNodes()); |
| 133 | } |
| 134 | else |
| 135 | { |
| 136 | const AABBCollisionTree* Tree = (const AABBCollisionTree*)model.GetTree(); |
| 137 | |
| 138 | // Perform collision query |
| 139 | if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes()); |
| 140 | else _Collide(Tree->GetNodes()); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | return true; |
| 145 | } |
| 146 |
nothing calls this directly
no test coverage detected