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