24 ColdetModel::ColdetModel()
29 dataSet->neighbor.clear();
36 isValid_(org.isValid_)
165 Opcode::OPCODECREATE OPCC;
171 OPCC.mIMesh = &
iMesh;
173 OPCC.mNoLeaf =
false;
174 OPCC.mQuantized =
false;
175 OPCC.mKeepOriginal =
false;
181 for(
int j=0; j<
i; j++)
192 if(minNumofBB <= dataSet->getNumofBB(
i))
207 (
const Opcode::AABBCollisionNode* node,
unsigned int currentDepth,
unsigned int depth, std::vector<Vector3>& out_data){
208 if(currentDepth == depth || node->IsLeaf() ){
209 const IceMaths::Point& p = node->mAABB.mCenter;
210 out_data.push_back(
Vector3(p.x, p.y, p.z));
211 const IceMaths::Point& q = node->mAABB.mExtents;
212 out_data.push_back(
Vector3(q.x, q.y, q.z));
215 if(currentDepth > depth)
return;
224 const Opcode::AABBCollisionNode* rootNode=((Opcode::AABBCollisionTree*)
dataSet->
model.GetTree())->GetNodes();
241 if(
max < currentDepth){
260 transform->Set((
float)R(0,0), (
float)R(1,0), (
float)R(2,0), 0.0
f,
261 (
float)R(0,1), (
float)R(1,1), (
float)R(2,1), 0.0
f,
262 (
float)R(0,2), (
float)R(1,2), (
float)R(2,2), 0.0
f,
263 (
float)p(0), (
float)p(1), (
float)p(2), 1.0
f);
269 transform->Set((
float)R[0], (
float)R[3], (
float)R[6], 0.0
f,
270 (
float)R[1], (
float)R[4], (
float)R[7], 0.0
f,
271 (
float)R[2], (
float)R[5], (
float)R[8], 0.0
f,
272 (
float)p[0], (
float)p[1], (
float)p[2], 1.0
f);
308 pTransform->Set((
float)R[0], (
float)R[3], (
float)R[6], 0.0
f,
309 (
float)R[1], (
float)R[4], (
float)R[7], 0.0
f,
310 (
float)R[2], (
float)R[5], (
float)R[8], 0.0
f,
311 (
float)p[0], (
float)p[1], (
float)p[2], 1.0
f);
317 Opcode::RayCollider RC;
318 Ray world_ray(Point(point[0], point[1], point[2]),
319 Point(dir[0], dir[1], dir[2]));
320 Opcode::CollisionFace CF;
321 Opcode::SetupClosestHit(RC, CF);
324 if (CF.mDistance == FLT_MAX){
333 Opcode::SphereCollider SC;
334 SC.SetFirstContact(
true);
335 Opcode::SphereCache Cache;
336 IceMaths::Point p(0,0,0);
337 IceMaths::Sphere sphere(p, i_radius);
338 IceMaths::Matrix4x4 sphereTrans(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1);
339 for (
unsigned int i=0;
i<i_cloud.size();
i++){
341 sphereTrans.m[3][0] = p[0];
342 sphereTrans.m[3][1] = p[1];
343 sphereTrans.m[3][2] = p[2];
345 if (!isOk) std::cerr <<
"SphereCollider::Collide() failed" << std::endl;
346 if (SC.GetContactStatus())
return true;
358 Edge edge(vertex0, vertex1);
359 EdgeToTriangleMap::iterator p =
triangleMap.find(edge);
366 if( triangles.
t[1] != -1 ){
375 triangles.
t[1] = triangle;