summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rwxr-xr-xindra/newview/llselectmgr.cpp85
1 files changed, 31 insertions, 54 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 372dfb0f0c..37c11bd027 100755
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2502,9 +2502,12 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
}
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];
+ LLVector3 diffuse_scale_ratio = selectNode->mTextureScaleRatios[te_num];
+
+ // We like these to track together. NORSPEC-96
+ //
+ LLVector3 normal_scale_ratio = diffuse_scale_ratio;
+ LLVector3 specular_scale_ratio = diffuse_scale_ratio;
// Apply new scale to face
if (planar)
@@ -2518,7 +2521,6 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
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);
@@ -2534,8 +2536,28 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
}
else
{
- 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]);
+
+ 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];
+
+ 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())
+ {
+ 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 );
+ }
}
send = send_to_sim;
}
@@ -5860,9 +5882,7 @@ void LLSelectNode::saveTextures(const uuid_vec_t& textures)
void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
{
- mTextureScaleRatios[LLRender::DIFFUSE_MAP].clear();
- mTextureScaleRatios[LLRender::NORMAL_MAP].clear();
- mTextureScaleRatios[LLRender::SPECULAR_MAP].clear();
+ mTextureScaleRatios.clear();
if (mObject.notNull())
{
@@ -5874,71 +5894,28 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
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);
if (!tep)
continue;
- LLMaterialPtr mat = tep->getMaterialParams();
-
U32 s_axis = VX;
U32 t_axis = VY;
LLPrimitive::getTESTAxes(i, &s_axis, &t_axis);
tep->getScale(&diffuse_s,&diffuse_t);
- if (mat)
- {
- mat->getNormalRepeat(normal_s, normal_t);
- }
- else
- {
- tep->getScale(&normal_s,&normal_t);
- }
-
- if (mat)
- {
- mat->getSpecularRepeat(specular_s, specular_t);
- }
- else
- {
- tep->getScale(&specular_s,&specular_t);
- }
-
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);
+ mTextureScaleRatios.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);
+ mTextureScaleRatios.push_back(v);
}
}
}