Merge branch 'V2MultiWear' of git://github.com/Shyotl/SingularityViewer into V2MultiWear
This commit is contained in:
@@ -718,20 +718,33 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
}
|
||||
else if (major_version > 1 || minor_version >= 30)
|
||||
{ //switches are supported in GLSL 1.30 and later
|
||||
text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n");
|
||||
text[count++] = strdup("\tswitch (vary_texture_index.r)\n");
|
||||
text[count++] = strdup("\t{\n");
|
||||
|
||||
//switch body
|
||||
for (S32 i = 0; i < texture_index_channels; ++i)
|
||||
{
|
||||
std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i);
|
||||
text[count++] = strdup(case_str.c_str());
|
||||
if (gGLManager.mIsNVIDIA)
|
||||
{ //switches are unreliable on some NVIDIA drivers
|
||||
for (S32 i = 0; i < texture_index_channels; ++i)
|
||||
{
|
||||
std::string if_string = llformat("\t%sif (vary_texture_index.r == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i);
|
||||
text[count++] = strdup(if_string.c_str());
|
||||
}
|
||||
text[count++] = strdup("\treturn vec4(1,0,1,1);\n");
|
||||
text[count++] = strdup("}\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n");
|
||||
text[count++] = strdup("\tswitch (vary_texture_index.r)\n");
|
||||
text[count++] = strdup("\t{\n");
|
||||
|
||||
//switch body
|
||||
for (S32 i = 0; i < texture_index_channels; ++i)
|
||||
{
|
||||
std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i);
|
||||
text[count++] = strdup(case_str.c_str());
|
||||
}
|
||||
|
||||
text[count++] = strdup("\t}\n");
|
||||
text[count++] = strdup("\treturn ret;\n");
|
||||
text[count++] = strdup("}\n");
|
||||
text[count++] = strdup("\t}\n");
|
||||
text[count++] = strdup("\treturn ret;\n");
|
||||
text[count++] = strdup("}\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //should never get here. Indexed texture rendering requires GLSL 1.30 or later
|
||||
|
||||
@@ -858,12 +858,15 @@ void LLInventoryView::updateItemcountText()
|
||||
{
|
||||
std::ostringstream title;
|
||||
title << "Inventory";
|
||||
if (LLInventoryModelBackgroundFetch::instance().folderFetchActive())
|
||||
if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() || LLInventoryModelBackgroundFetch::instance().isEverythingFetched())
|
||||
{
|
||||
LLLocale locale(LLLocale::USER_LOCALE);
|
||||
std::string item_count_string;
|
||||
LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount());
|
||||
title << " (Fetched " << item_count_string << " items...)";
|
||||
if(LLInventoryModelBackgroundFetch::instance().folderFetchActive())
|
||||
title << " (Fetched " << item_count_string << " items...)";
|
||||
else
|
||||
title << " ("<< item_count_string << " items)";
|
||||
}
|
||||
title << mFilterText;
|
||||
setTitle(title.str());
|
||||
|
||||
@@ -1035,7 +1035,14 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
|
||||
}
|
||||
}
|
||||
// Add the texture item to the target object's inventory.
|
||||
hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
|
||||
if (LLAssetType::AT_TEXTURE == new_item->getType())
|
||||
{
|
||||
hit_obj->updateTextureInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
|
||||
}
|
||||
// TODO: Check to see if adding the item was successful; if not, then
|
||||
// we should return false here.
|
||||
}
|
||||
@@ -1050,7 +1057,14 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
|
||||
// *FIX: may want to make sure agent can paint hit_obj.
|
||||
|
||||
// Add the texture item to the target object's inventory.
|
||||
hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
|
||||
if (LLAssetType::AT_TEXTURE == new_item->getType())
|
||||
{
|
||||
hit_obj->updateTextureInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
|
||||
}
|
||||
// Force the object to update its refetch its inventory so it has this texture.
|
||||
hit_obj->fetchInventoryFromServer();
|
||||
// TODO: Check to see if adding the item was successful; if not, then
|
||||
|
||||
@@ -2984,6 +2984,33 @@ void LLViewerObject::removeInventory(const LLUUID& item_id)
|
||||
//gBuildView->refresh();
|
||||
}
|
||||
|
||||
bool LLViewerObject::isTextureInInventory(LLViewerInventoryItem* item)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (item && LLAssetType::AT_TEXTURE == item->getType())
|
||||
{
|
||||
std::list<LLUUID>::iterator begin = mPendingInventoryItemsIDs.begin();
|
||||
std::list<LLUUID>::iterator end = mPendingInventoryItemsIDs.end();
|
||||
|
||||
bool is_fetching = std::find(begin, end, item->getAssetUUID()) != end;
|
||||
bool is_fetched = getInventoryItemByAsset(item->getAssetUUID()) != NULL;
|
||||
|
||||
result = is_fetched || is_fetching;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void LLViewerObject::updateTextureInventory(LLViewerInventoryItem* item, U8 key, bool is_new)
|
||||
{
|
||||
if (item && !isTextureInInventory(item))
|
||||
{
|
||||
mPendingInventoryItemsIDs.push_back(item->getAssetUUID());
|
||||
updateInventory(item, key, is_new);
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerObject::updateInventory(
|
||||
LLViewerInventoryItem* item,
|
||||
U8 key,
|
||||
|
||||
@@ -444,12 +444,15 @@ public:
|
||||
// manager until we have better iterators.
|
||||
void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
|
||||
void updateInventoryLocal(LLInventoryItem* item, U8 key); // Update without messaging.
|
||||
void updateTextureInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
|
||||
LLInventoryObject* getInventoryObject(const LLUUID& item_id);
|
||||
void getInventoryContents(LLInventoryObject::object_list_t& objects);
|
||||
LLInventoryObject* getInventoryRoot();
|
||||
LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id);
|
||||
S16 getInventorySerial() const { return mInventorySerialNum; }
|
||||
|
||||
bool isTextureInInventory(LLViewerInventoryItem* item);
|
||||
|
||||
// These functions does viewer-side only object inventory modifications
|
||||
void updateViewerInventoryAsset(
|
||||
const LLViewerInventoryItem* item,
|
||||
@@ -698,6 +701,10 @@ protected:
|
||||
F32 mAppAngle; // Apparent visual arc in degrees
|
||||
F32 mPixelArea; // Apparent area in pixels
|
||||
|
||||
// IDs of of all items in the object's content which are added to the object's content,
|
||||
// but not updated on the server yet. After item was updated, its ID will be removed from this list.
|
||||
std::list<LLUUID> mPendingInventoryItemsIDs;
|
||||
|
||||
// This is the object's inventory from the viewer's perspective.
|
||||
LLInventoryObject::object_list_t* mInventory;
|
||||
class LLInventoryCallbackInfo
|
||||
|
||||
Reference in New Issue
Block a user