IMesh* tmpIMesh;
aiMatrix4x4* aimat;
mat4 tmpModelMat, tmpModelMatClean;
+ btTransform tmpModelMatBT;
//vec3 BBmin, BBmax, tmpMin, tmpMax;
btCompoundShape* tmp_shape = new btCompoundShape;
tmpModelMat = mat4(aimat->a1, aimat->c1, -aimat->b1, aimat->d1, aimat->a2, aimat->c2, -aimat->b2, aimat->d2, aimat->a3, aimat->c3, -aimat->b3, aimat->d3, aimat->a4, aimat->c4, -aimat->b4, aimat->d4);
tmpModelMatClean = removeScale(tmpModelMat);
+ tmpModelMatBT.setFromOpenGLMatrix(value_ptr(tmpModelMatClean));
tmpIMesh = new IMesh(scene->mMeshes[0], tmpModelMatClean, _scale* getScale(tmpModelMat));
models.push_back(std::pair<IMesh*,mat4>(tmpIMesh,tmpModelMatClean));
setBB(tmpIMesh->getBBox());
-
-
- tmp_shape->addChildShape(btTransform(),*tmpIMesh);
+ tmp_shape->addChildShape(tmpModelMatBT,*tmpIMesh);
for (uint i = 1; i < scene->mNumMeshes; i++)
{
tmpModelMat = mat4(aimat->a1, aimat->c1, -aimat->b1, aimat->d1, aimat->a2, aimat->c2, -aimat->b2, aimat->d2, aimat->a3, aimat->c3, -aimat->b3, aimat->d3, aimat->a4, aimat->c4, -aimat->b4, aimat->d4);
tmpModelMatClean = removeScale(tmpModelMat);
+ tmpModelMatBT.setFromOpenGLMatrix(value_ptr(tmpModelMatClean));
tmpIMesh = new IMesh(scene->mMeshes[i], tmpModelMatClean, _scale* getScale(tmpModelMat));
models.push_back(std::pair<IMesh*, mat4>(tmpIMesh, tmpModelMatClean));
updateBB(tmpIMesh->getBBox());
- tmp_shape->addChildShape(btTransform(), *tmpIMesh);
+ tmp_shape->addChildShape(tmpModelMatBT, *tmpIMesh);
//tmpIMesh->getBBmm(tmpMin, tmpMax);
//for (auto j = 0; j < 3; ++j)
//{
if (models.size() == 1)
{
auto i = models.front();
- i.first->drawBBox(_modelMat* i.second, _color);
+ i.first->drawBBox(_modelMat, _color);
}
else
{
{
for (auto i = models.begin(); i != models.end(); ++i)
{
- i->first->drawBBox(_modelMat* i->second, _color*0.8f);
+ i->first->drawBBox(_modelMat, _color*0.8f);
}
}
}