BasicRobot::BasicRobot() : Object(), PhysicsBulletInterface(), RenderOpenGLInterface() { // define collision type SetCollisionType (1 << 2); SetCollisionFilter (0x7FFFFFFF); }
void StaticMeshActorProxy::LoadFile(const std::string &fileName) { dtCore::Object *obj = static_cast<dtCore::Object*>(GetActor()); //First load the mesh (with cacheing on). if (obj->LoadFile(fileName,true) == NULL) { if (!fileName.empty()) LOG_ERROR("Error loading mesh file: " + fileName); return; } //We need this little hack to ensure that when a mesh is loaded, the collision //properties get updated properly. SetCollisionType(GetCollisionType()); //std::cout << "Writing node file." << std::endl; //osgDB::writeNodeFile(*obj->GetOSGNode(),"testtextures.osg"); //std::cout << "Done writing node file." << std::endl; //Next, run our visitor over the loaded mesh and extract the texture slots. // const std::string texGroupName = "Textures"; // const std::string texPropBaseName = "Channel"; // ExtractTexturesVisitor tv; // obj->GetOSGNode()->accept(tv); // // //Now dynamically add each texture attribute as a resource property. // ExtractTexturesVisitor::TextureList &texList = tv.GetTextureList(); // ExtractTexturesVisitor::TextureList::iterator texItor; // // std::ostringstream ss; // std::cout << "NumTextures: " << texList.size() << std::endl; // std::cout << "NumTexCoords: " << tv.GetMaxTexCoordCount() << std::endl; // for (texItor=texList.begin(); texItor!=texList.end(); ++texItor) { // ss.clear(); // ss.str(""); // ss << texPropBaseName << count++; // // //First see if we already have a resource // // TextureEntry *texEntry = new TextureEntry(const_cast<osg::Texture2D *>(texItor->get())); // this->mTextureSlots.push_back(texEntry); // ss << texPropBaseName << count++; // AddProperty(new dtDAL::ResourceActorProperty(*this,dtDAL::DataType::TEXTURE, // ss.str(),"Texture",dtDAL::MakeFunctor(*texEntry,&TextureEntry::LoadFile), // "A texture slot in the static mesh.",texGroupName)); // } }