bool MountDefaults() { String path = getAssetDir(); bool mounted = Mount( "game", createNativeFS( path )); if ( !mounted ) return false; // [8/31/2009 tomb] Disabling this for T3D 1.0 due to issues with script namespace corruption when running from zips // Note that the VirtualMountSystem must be enabled in volume.cpp for zip support to work. //return MountZips("game"); return true; }
GLuint loadTexture(const std::string &filename) { GLuint textureID = 0; std::vector<unsigned char> buffer; unsigned int width, height; unsigned int error = lodepng::decode(buffer, width, height, getAssetDir() + filename); if(error) { std::cout << "ERROR: could not load " << filename << ": " << lodepng_error_text(error) << std::endl; ready = false; return textureID; } glGenTextures(1, &textureID); glBindTexture(GL_TEXTURE_2D, textureID); glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &(buffer[0])); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); return textureID; }
/* * Convert an image url e.g. "asset:///images/Blue_20Nose_20Thumb.png" * into a full path that can be opened with routines that don't know asset:// */ QString PictureHelper::getImagePath(QString imageUrl) { /*QString resourceText = imageUrl.toString();*/ int index = imageUrl.indexOf("/images/"); return (index > 0)? getAssetDir() + imageUrl.mid(index) : imageUrl; }
/* * Convert an image url e.g. "asset:///images/Blue_20Nose_20Thumb.png" * into a full path that can be opened with routines that don't know asset:// */ QString getImagePath(QUrl imageUrl) { QString resourceText = imageUrl.toString(); int index = resourceText.indexOf("/images/"); return (index > 0)? getAssetDir() + resourceText.mid(index) : resourceText; }