summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-05-29 19:10:53 -0700
committerGraham Madarasz <graham@lindenlab.com>2013-05-29 19:10:53 -0700
commit8d4594cd11b290562510bda7c09e3b3eec192ba6 (patch)
tree0583bda4a99eca5a78b4f500ce844536994b8fcc
parentf3def8fce601bb29634667ab215cc5f00408ffa9 (diff)
NORSPEC-96 diff/norm/spec tex scale ratio rodeo, yo
-rwxr-xr-xindra/newview/llselectmgr.cpp85
-rwxr-xr-xindra/newview/llselectmgr.h2
2 files changed, 32 insertions, 55 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);
}
}
}
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index a750d8ce72..f9b97cebdd 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[LLRender::NUM_TEXTURE_CHANNELS];
+ std::vector<LLVector3> mTextureScaleRatios;
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?