LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, LLHost request_from_host) { if(!mInitialized) { return NULL ; } // Return the image with ID image_id // If the image is not found, creates new image and // enqueues a request for transmission if ((&image_id == NULL) || image_id.isNull()) { return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLViewerTexture::BOOST_UI)); } LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id); if (imagep.isNull()) { imagep = createImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; } imagep->setGLTextureCreated(true); return imagep; }
LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& url, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, const LLUUID& force_id) { // generate UUID based on hash of filename LLUUID new_id; if (force_id.notNull()) { new_id = force_id; } else { new_id.generate(url); } LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id); if (imagep.isNull()) { switch(texture_type) { case LLViewerTexture::FETCHED_TEXTURE: imagep = new LLViewerFetchedTexture(url, new_id, usemipmaps); break ; case LLViewerTexture::LOD_TEXTURE: imagep = new LLViewerLODTexture(url, new_id, usemipmaps); break ; default: llerrs << "Invalid texture type " << texture_type << llendl ; } if (internal_format && primary_format) { imagep->setExplicitFormat(internal_format, primary_format); } addImage(imagep); if (boost_priority != 0) { if (boost_priority == LLViewerFetchedTexture::BOOST_UI || boost_priority == LLViewerFetchedTexture::BOOST_ICON) { imagep->dontDiscard(); } imagep->setBoostLevel(boost_priority); } } imagep->setGLTextureCreated(true); return imagep; }
LLViewerImage* LLViewerImageList::getImageFromUrl(const std::string& url, BOOL usemipmaps, BOOL level_immediate, LLGLint internal_format, LLGLenum primary_format, const LLUUID& force_id) { if (gNoRender) { // Never mind that this ignores image_set_id; // getImage() will handle that later. return getImage(IMG_DEFAULT, TRUE, TRUE); } // generate UUID based on hash of filename LLUUID new_id; if (force_id.notNull()) { new_id = force_id; } else { new_id.generate(url); } LLPointer<LLViewerImage> imagep = hasImage(new_id); if (imagep.isNull()) { imagep = new LLViewerImage(url, new_id, usemipmaps); if (internal_format && primary_format) { imagep->setExplicitFormat(internal_format, primary_format); } addImage(imagep); if (level_immediate) { imagep->dontDiscard(); imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI); } } imagep->setGLTextureCreated(true); return imagep; }
LLViewerImage* LLViewerImageList::getImage(const LLUUID &image_id, BOOL usemipmaps, BOOL level_immediate, LLGLint internal_format, LLGLenum primary_format, LLHost request_from_host) { // Return the image with ID image_id // If the image is not found, creates new image and // enqueues a request for transmission if ((&image_id == NULL) || image_id.isNull()) { return (getImage(IMG_DEFAULT, TRUE, TRUE)); } LLPointer<LLViewerImage> imagep = hasImage(image_id); if (imagep.isNull()) { imagep = new LLViewerImage(image_id, request_from_host, usemipmaps); if (internal_format && primary_format) { imagep->setExplicitFormat(internal_format, primary_format); } addImage(imagep); if (level_immediate) { imagep->dontDiscard(); imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_UI); } else { //by default, the texure can not be removed from memory even if it is not used. //here turn this off //if this texture should be set to NO_DELETE, either pass level_immediate == TRUE here, or call setNoDelete() afterwards. imagep->forceActive() ; } } imagep->setGLTextureCreated(true); return imagep; }