ResourceWrapper OgreResourceProvider::getResource(const std::string& name) { Ogre::DataStreamPtr input = Ogre::ResourceGroupManager::getSingleton().openResource(name, mGroupName); if (input.isNull()) { throw Exception("Unable to open resource file '" + name + "' in resource group '" + name + "'."); } OgreResourceWrapper* wrapper = new OgreResourceWrapper(input); input->close(); return ResourceWrapper(wrapper, name); // Ogre::String buf = input->getAsString(); // const size_t memBuffSize = buf.length(); // // unsigned char* mem = new unsigned char[memBuffSize]; // memcpy(mem, buf.c_str(), memBuffSize); // // output.setData(mem); // output.setSize(memBuffSize); }
ResourceWrapper FileResourceProvider::getResource(const std::string& name) { std::ifstream stream(mBaseDirectory + name, std::ios::binary | std::ios::in); return ResourceWrapper(new FileResourceWrapper(stream), name); }