summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llmaterialmgr.cpp4
-rw-r--r--indra/newview/llmaterialmgr.h6
-rwxr-xr-xindra/newview/llselectmgr.cpp163
-rwxr-xr-xindra/newview/llselectmgr.h2
-rwxr-xr-xindra/newview/llvovolume.cpp33
-rwxr-xr-xindra/newview/llvovolume.h5
6 files changed, 90 insertions, 123 deletions
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index 5c0173c7a7..fdc1dfd749 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -217,7 +217,6 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL
return connection;
}
-#if USE_TE_SPECIFIC_REGISTRATION
boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb)
{
boost::signals2::connection connection;
@@ -262,7 +261,6 @@ boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const
return connection;
}
-#endif
bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const
{
@@ -343,7 +341,6 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
if (isGetPending(region_id, material_id))
{
- #if USE_TE_SPECIFIC_REGISTRATION
TEMaterialPair te_mat_pair;
te_mat_pair.materialID = material_id;
@@ -359,7 +356,6 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
mGetTECallbacks.erase(itCallbackTE);
}
}
- #endif
get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
if (itCallback != mGetCallbacks.end())
diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h
index 8a2a9be255..e317a791ad 100644
--- a/indra/newview/llmaterialmgr.h
+++ b/indra/newview/llmaterialmgr.h
@@ -31,8 +31,6 @@
#include "llmaterialid.h"
#include "llsingleton.h"
-#define USE_TE_SPECIFIC_REGISTRATION 1
-
class LLViewerRegion;
class LLMaterialMgr : public LLSingleton<LLMaterialMgr>
@@ -49,10 +47,8 @@ public:
const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id);
boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb);
-#if USE_TE_SPECIFIC_REGISTRATION
typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr, U32 te)> get_callback_te_t;
boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb);
-#endif
typedef boost::signals2::signal<void (const LLUUID&, const material_map_t&)> getall_callback_t;
void getAll(const LLUUID& region_id);
@@ -86,7 +82,6 @@ protected:
typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t;
get_callback_map_t mGetCallbacks;
-#if USE_TE_SPECIFIC_REGISTRATION
// struct for TE-specific material ID query
class TEMaterialPair
{
@@ -115,7 +110,6 @@ protected:
typedef boost::unordered_map<TEMaterialPair, get_callback_te_t*, TEMaterialPairHasher> get_callback_te_map_t;
get_callback_te_map_t mGetTECallbacks;
-#endif
typedef std::set<LLUUID> getall_queue_t;
getall_queue_t mGetAllQueue;
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 1bb12e495d..372dfb0f0c 100755
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2501,57 +2501,41 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
continue;
}
- LLVector3 scale_ratio = selectNode->mTextureScaleRatios[te_num];
LLVector3 object_scale = object->getScale();
+ LLVector3 diffuse_scale_ratio = selectNode->mTextureScaleRatios[LLRender::DIFFUSE_MAP][te_num];
+ LLVector3 normal_scale_ratio = selectNode->mTextureScaleRatios[LLRender::NORMAL_MAP][te_num];
+ LLVector3 specular_scale_ratio = selectNode->mTextureScaleRatios[LLRender::SPECULAR_MAP][te_num];
// Apply new scale to face
if (planar)
{
- F32 scale_s = scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
- F32 scale_t = scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
+ F32 diffuse_scale_s = diffuse_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
+ F32 diffuse_scale_t = diffuse_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
- switch (mTextureChannel)
+ F32 normal_scale_s = normal_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
+ F32 normal_scale_t = normal_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
+
+ F32 specular_scale_s = specular_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
+ F32 specular_scale_t = specular_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
+
+
+ object->setTEScale(te_num, diffuse_scale_s, diffuse_scale_t);
+
+ LLTextureEntry* tep = object->getTE(te_num);
+
+ if (tep && !tep->getMaterialParams().isNull())
{
- case LLRender::DIFFUSE_MAP:
- {
- object->setTEScale(te_num, scale_s, scale_t);
- }
- break;
-
- case LLRender::NORMAL_MAP:
- {
- LLTextureEntry* tep = object->getTE(te_num);
- if (tep && !tep->getMaterialParams().isNull())
- {
- LLMaterialPtr orig = tep->getMaterialParams();
- LLMaterialPtr p = new LLMaterial(orig->asLLSD());
- p->setNormalRepeat(scale_s * 0.5f, scale_t * 0.5f);
- selectionSetMaterial( p );
- }
- }
- break;
-
- case LLRender::SPECULAR_MAP:
- {
- LLTextureEntry* tep = object->getTE(te_num);
- if (tep && !tep->getMaterialParams().isNull())
- {
- LLMaterialPtr orig = tep->getMaterialParams();
- LLMaterialPtr p = new LLMaterial(orig->asLLSD());
- p->setSpecularRepeat(scale_s * 0.5f, scale_t * 0.5f);
- selectionSetMaterial( p );
- }
- }
- break;
- default:
- break;
+ LLMaterialPtr orig = tep->getMaterialParams();
+ LLMaterialPtr p = new LLMaterial(orig->asLLSD());
+ p->setNormalRepeat(normal_scale_s, normal_scale_t);
+ p->setSpecularRepeat(specular_scale_s, specular_scale_t);
+ selectionSetMaterial( p );
}
-
}
else
{
- object->setTEScale(te_num, scale_ratio.mV[s_axis]*object_scale.mV[s_axis],
- scale_ratio.mV[t_axis]*object_scale.mV[t_axis]);
+ object->setTEScale(te_num, diffuse_scale_ratio.mV[s_axis]*object_scale.mV[s_axis],
+ diffuse_scale_ratio.mV[t_axis]*object_scale.mV[t_axis]);
}
send = send_to_sim;
}
@@ -5876,7 +5860,10 @@ void LLSelectNode::saveTextures(const uuid_vec_t& textures)
void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
{
- mTextureScaleRatios.clear();
+ mTextureScaleRatios[LLRender::DIFFUSE_MAP].clear();
+ mTextureScaleRatios[LLRender::NORMAL_MAP].clear();
+ mTextureScaleRatios[LLRender::SPECULAR_MAP].clear();
+
if (mObject.notNull())
{
@@ -5884,9 +5871,15 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
for (U8 i = 0; i < mObject->getNumTEs(); i++)
{
- F32 s = 1.0f;
- F32 t = 1.0f;
+ F32 diffuse_s = 1.0f;
+ F32 diffuse_t = 1.0f;
+ F32 normal_s = 1.0f;
+ F32 normal_t = 1.0f;
+
+ F32 specular_s = 1.0f;
+ F32 specular_t = 1.0f;
+
LLVector3 v;
const LLTextureEntry* tep = mObject->getTE(i);
@@ -5899,60 +5892,54 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
U32 t_axis = VY;
LLPrimitive::getTESTAxes(i, &s_axis, &t_axis);
- switch(index_to_query)
+ tep->getScale(&diffuse_s,&diffuse_t);
+
+ if (mat)
{
- case LLRender::DIFFUSE_MAP:
- {
- tep->getScale(&s,&t);
- }
- break;
-
- case LLRender::NORMAL_MAP:
- {
- if (mat)
- {
- mat->getNormalRepeat(s, t);
- }
- else
- {
- tep->getScale(&s,&t);
- }
-
- }
- break;
-
- case LLRender::SPECULAR_MAP:
- {
- if (mat)
- {
- mat->getSpecularRepeat(s, t);
- }
- else
- {
- tep->getScale(&s,&t);
- }
- }
- break;
-
- default:
- // should never be.
- //
- llassert_always(false);
- break;
+ mat->getNormalRepeat(normal_s, normal_t);
+ }
+ else
+ {
+ tep->getScale(&normal_s,&normal_t);
}
- if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR)
+ if (mat)
{
- v.mV[s_axis] = s*scale.mV[s_axis];
- v.mV[t_axis] = t*scale.mV[t_axis];
+ mat->getSpecularRepeat(specular_s, specular_t);
}
else
{
- v.mV[s_axis] = s/scale.mV[s_axis];
- v.mV[t_axis] = t/scale.mV[t_axis];
+ tep->getScale(&specular_s,&specular_t);
}
- mTextureScaleRatios.push_back(v);
+ if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR)
+ {
+ v.mV[s_axis] = diffuse_s*scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t*scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::DIFFUSE_MAP].push_back(v);
+
+ v.mV[s_axis] = diffuse_s*scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t*scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::NORMAL_MAP].push_back(v);
+
+ v.mV[s_axis] = diffuse_s*scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t*scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::SPECULAR_MAP].push_back(v);
+ }
+ else
+ {
+ v.mV[s_axis] = diffuse_s/scale.mV[s_axis];
+ v.mV[t_axis] = diffuse_t/scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::DIFFUSE_MAP].push_back(v);
+
+ v.mV[s_axis] = normal_s/scale.mV[s_axis];
+ v.mV[t_axis] = normal_t/scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::NORMAL_MAP].push_back(v);
+
+ v.mV[s_axis] = specular_s/scale.mV[s_axis];
+ v.mV[t_axis] = specular_t/scale.mV[t_axis];
+ mTextureScaleRatios[LLRender::SPECULAR_MAP].push_back(v);
+ }
}
}
}
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index f9b97cebdd..a750d8ce72 100755
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -183,7 +183,7 @@ public:
U64 mCreationDate;
std::vector<LLColor4> mSavedColors;
uuid_vec_t mSavedTextures;
- std::vector<LLVector3> mTextureScaleRatios;
+ std::vector<LLVector3> mTextureScaleRatios[LLRender::NUM_TEXTURE_CHANNELS];
std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object
std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object
BOOL mSilhouetteExists; // need to generate silhouette?
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 5663d474bd..7ce0343022 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1973,27 +1973,19 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow)
return res;
}
-void LLVOVolume::setTEMaterialParamsCallbackTE(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te)
+void LLVOVolume::setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams, U32 te)
{
- LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL;
- if (te >= getNumTEs())
- return;
-
- LLTextureEntry* texture_entry = getTE(te);
- if (texture_entry && (texture_entry->getMaterialID() == pMaterialID))
+ LLVOVolume* pVol = (LLVOVolume*)gObjectList.findObject(objectID);
+ if (pVol && pVol->getVolume())
{
- setTEMaterialParams(te, pMaterialParams);
- }
-}
+ LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << " to TE " << te << LL_ENDL;
+ if (te >= pVol->getNumTEs())
+ return;
-void LLVOVolume::setTEMaterialParamsCallback(const LLMaterialID &pMaterialID, const LLMaterialPtr pMaterialParams)
-{
- LL_DEBUGS("MaterialTEs") << "materialid " << pMaterialID.asString() << LL_ENDL;
- for (U8 i = 0; i < getNumTEs(); i++)
- {
- if (getTE(i) && (getTE(i)->getMaterialID().isNull() || (getTE(i)->getMaterialID() == pMaterialID)))
+ LLTextureEntry* texture_entry = pVol->getTE(te);
+ if (texture_entry && (texture_entry->getMaterialID() == pMaterialID))
{
- setTEMaterialParams(i, pMaterialParams);
+ pVol->setTEMaterialParams(te, pMaterialParams);
}
}
}
@@ -2008,11 +2000,8 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID)
LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL;
if (res)
{
-#if USE_TE_SPECIFIC_REGISTRATION
- LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, this, _1, _2, _3));
-#else
- LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2));
-#endif
+ LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallbackTE, getID(), _1, _2, _3));
+
setChanged(TEXTURE);
if (!mDrawable.isNull())
{
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 52539ab8d5..56c552ab9f 100755
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -187,8 +187,9 @@ public:
/*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags);
/*virtual*/ S32 setTEGlow(const U8 te, const F32 glow);
/*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
- void setTEMaterialParamsCallback(const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams);
- void setTEMaterialParamsCallbackTE(const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams, U32 te);
+
+ static void setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams, U32 te);
+
/*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams);
/*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t);
/*virtual*/ S32 setTEScaleS(const U8 te, const F32 s);