btCollisionShape* RigidBody::loadShapeFromModel(RigidBody* body) {//Visual* visual) { DEBUG_M("Entering function..."); #warning ['TODO']: Store shapes like models... Visual& visual = body->getVisual(); /*if(!visual) { return NULL; }*/ btCompoundShape* shape = new btCompoundShape(); /*Visual& visual = getVisual();*/ VModel* vmodel = dynamic_cast<VModel*>(&visual); if(!vmodel) { //return NULL; return NULL; } ResourceManager temprm; Model* model = temprm.loadModel(vmodel->getFilename()); if(!model) { return NULL; } SceneNode* sn = model->visual_scene; if(!sn) { return NULL; } return loadShapeFromModel_ProcessNodes_(sn, shape); /*Model* model = rm->loadModel(vmodel.getFilename()) ; btTriangleIndexVertexArray* indexVertexArrays = new btTriangleIndexVertexArray(model->count*/ }
/** * Retrieves the model data from the resource manager and rraws the * Model to screen using RCBC. * @param rm The ResourceManager to use to load the model */ void VModel::draw(Interface* interface) { if(!interface) { return; } if(!isVisible() && interface->getEditMode() == MODE_NONE) { return; } ResourceManager* rm = interface->getResourceManager(); if(!rm) { return; } Model* model = rm->loadModel(filename_); bool selected; Object* object = interface->getSelectedObject(); if(object) { Visual* visual = &object->getVisual(); selected = (this == visual); glEnable(GL_COLOR_MATERIAL); glColor3f(1.0f, 0.2f, 0.2f); //DEBUG_H("Drawing selected. %s", object->getTag().c_str()); //glEnable } if(!selected) { //DEBUG_H("Drawing selected. %s", object->getTag().c_str()); glColor3f(1.0f, 1.0f, 1.0f); // If we are editing, draw visible objects if(!isVisible() && interface->getEditMode() != MODE_NONE) { glColor4f(0.5f, 0.5f, 1.0f, 0.5f); } else glDisable(GL_COLOR_MATERIAL); } preDraw(interface); RCBC_Render(model); postDraw(interface); }