summaryrefslogtreecommitdiff
path: root/indra/newview/llagentbenefits.cpp
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-06-11 13:38:43 +0200
committerAnsariel <ansariel.hiller@phoenixviewer.com>2024-06-11 13:38:43 +0200
commitd9789bfaf230e301873bd700f6f360d306dc2486 (patch)
tree4b2dd2680905ca9821e2b11b36aa63dfe7af4f84 /indra/newview/llagentbenefits.cpp
parent9f6b8484dfb7dfa981d8a8ac3693d3f68e32bc12 (diff)
parenta73773bc1abdac6bc3beea36fd4ba58eba686e13 (diff)
Merge branch 'main' of https://github.com/secondlife/viewer into DRTVWR-600-maint-A
# Conflicts: # indra/llappearance/llavatarappearance.h # indra/llimage/llimage.cpp # indra/llmath/llvolume.cpp # indra/llmath/llvolume.h # indra/llprimitive/llgltfmaterial.h # indra/llrender/llrendertarget.cpp # indra/llrender/llshadermgr.cpp # indra/newview/lldynamictexture.cpp # indra/newview/llenvironment.cpp # indra/newview/llfetchedgltfmaterial.cpp # indra/newview/llfloaterimagepreview.cpp # indra/newview/llfloaterimagepreview.h # indra/newview/llfloaterregioninfo.cpp # indra/newview/llfloaterregioninfo.h # indra/newview/llmaniprotate.cpp # indra/newview/llmaniptranslate.cpp # indra/newview/llpanelvolume.cpp # indra/newview/llselectmgr.cpp # indra/newview/llselectmgr.h # indra/newview/llsurface.cpp # indra/newview/llsurface.h # indra/newview/llsurfacepatch.cpp # indra/newview/lltexturectrl.cpp # indra/newview/lltexturectrl.h # indra/newview/lltinygltfhelper.cpp # indra/newview/llviewertexture.cpp # indra/newview/llviewerwindow.cpp # indra/newview/llviewerwindow.h # indra/newview/llvlcomposition.cpp # indra/newview/llvlcomposition.h # indra/newview/llvocache.cpp # indra/newview/llvovolume.cpp # indra/newview/pipeline.cpp
Diffstat (limited to 'indra/newview/llagentbenefits.cpp')
-rw-r--r--indra/newview/llagentbenefits.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/indra/newview/llagentbenefits.cpp b/indra/newview/llagentbenefits.cpp
index c2a1589682..e9f00f6556 100644
--- a/indra/newview/llagentbenefits.cpp
+++ b/indra/newview/llagentbenefits.cpp
@@ -25,6 +25,7 @@
#include "llviewerprecompiledheaders.h"
#include "llagentbenefits.h"
+#include "llviewertexture.h"
LLAgentBenefits::LLAgentBenefits():
m_initalized(false),
@@ -95,6 +96,26 @@ bool LLAgentBenefits::init(const LLSD& benefits_sd)
return false;
}
+ if (benefits_sd.has("large_texture_upload_cost"))
+ {
+ LLSD large_texture_cost = benefits_sd.get("large_texture_upload_cost");
+ if (large_texture_cost.isArray())
+ {
+ LLSD::array_const_iterator end = large_texture_cost.endArray();
+ LLSD::array_const_iterator it = large_texture_cost.beginArray();
+ for (; it != end; ++it)
+ {
+ m_2k_texture_upload_cost.push_back(it->asInteger());
+ }
+ std::sort(m_2k_texture_upload_cost.begin(), m_2k_texture_upload_cost.end());
+ }
+ }
+
+ if (m_2k_texture_upload_cost.empty())
+ {
+ m_2k_texture_upload_cost.push_back(m_texture_upload_cost);
+ }
+
// FIXME PREMIUM - either use this field or get rid of it
m_initalized = true;
return true;
@@ -140,6 +161,49 @@ S32 LLAgentBenefits::getTextureUploadCost() const
return m_texture_upload_cost;
}
+S32 LLAgentBenefits::getTextureUploadCost(const LLViewerTexture* tex) const
+{
+ if (tex)
+ {
+ S32 area = tex->getFullHeight() * tex->getFullWidth();
+ if (area >= MIN_2K_TEXTURE_AREA)
+ {
+ return get2KTextureUploadCost(area);
+ }
+ else
+ {
+ return getTextureUploadCost();
+ }
+ }
+ return 0;
+}
+
+S32 LLAgentBenefits::getTextureUploadCost(const LLImageBase* tex) const
+{
+ if (tex)
+ {
+ S32 area = tex->getHeight() * tex->getWidth();
+ if (area >= MIN_2K_TEXTURE_AREA)
+ {
+ return get2KTextureUploadCost(area);
+ }
+ else
+ {
+ return getTextureUploadCost();
+ }
+ }
+ return getTextureUploadCost();
+}
+
+S32 LLAgentBenefits::get2KTextureUploadCost(S32 area) const
+{
+ if (m_2k_texture_upload_cost.empty())
+ {
+ return m_texture_upload_cost;
+ }
+ return m_2k_texture_upload_cost[0];
+}
+
bool LLAgentBenefits::findUploadCost(LLAssetType::EType& asset_type, S32& cost) const
{
bool succ = false;