summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llheroprobemanager.cpp87
-rw-r--r--indra/newview/llpanelface.cpp17
-rw-r--r--indra/newview/llpanelface.h2
-rw-r--r--indra/newview/llpanelvolume.cpp34
-rw-r--r--indra/newview/llpanelvolume.h2
-rw-r--r--indra/newview/llselectmgr.cpp41
-rw-r--r--indra/newview/llselectmgr.h1
-rw-r--r--indra/newview/llviewerobject.cpp28
-rw-r--r--indra/newview/llviewerobject.h1
-rw-r--r--indra/newview/llvovolume.cpp60
-rw-r--r--indra/newview/llvovolume.h5
-rw-r--r--indra/newview/skins/default/xui/en/floater_tools.xml10
12 files changed, 140 insertions, 148 deletions
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 729603e960..6374b10823 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -103,53 +103,71 @@ void LLHeroProbeManager::update()
llassert(mProbes[0] == mDefaultProbe);
- LLVector3 camera_pos = LLViewerCamera::instance().getOrigin();
-
LLVector4a probe_pos;
- LLVector3 focus_point;
-
- LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject();
- if (obj && obj->mDrawable && obj->isSelected())
- { // focus on selected media object
- S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace();
- if (obj && obj->mDrawable)
+ if (mHeroList.empty())
+ {
+ LLVector3 focus_point;
+
+ LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject();
+ if (obj && obj->mDrawable && obj->isSelected())
+ { // focus on selected media object
+ S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace();
+ if (obj && obj->mDrawable)
+ {
+ LLFace* face = obj->mDrawable->getFace(face_idx);
+ if (face)
+ {
+ focus_point = face->getPositionAgent();
+ }
+ }
+ }
+
+ if (focus_point.isExactlyZero())
{
- LLFace* face = obj->mDrawable->getFace(face_idx);
- if (face)
+ if (LLViewerJoystick::getInstance()->getOverrideCamera())
+ { // focus on point under cursor
+ focus_point.set(gDebugRaycastIntersection.getF32ptr());
+ }
+ else if (gAgentCamera.cameraMouselook())
+ { // focus on point under mouselook crosshairs
+ LLVector4a result;
+ result.clear();
+
+ gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, NULL, &result);
+
+ focus_point.set(result.getF32ptr());
+ }
+ else
{
- focus_point = face->getPositionAgent();
+ // focus on alt-zoom target
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ }
}
}
+
+ probe_pos.load3(((focus_point)).mV);
}
-
- if (focus_point.isExactlyZero())
+ else
{
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- { // focus on point under cursor
- focus_point.set(gDebugRaycastIntersection.getF32ptr());
- }
- else if (gAgentCamera.cameraMouselook())
- { // focus on point under mouselook crosshairs
- LLVector4a result;
- result.clear();
-
- gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, NULL, &result);
-
- focus_point.set(result.getF32ptr());
- }
- else
+ // Get the nearest hero.
+ float distance = F32_MAX;
+
+ for (auto drawable : mHeroList)
{
- // focus on alt-zoom target
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
+ if (drawable.notNull())
{
- focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ if (drawable->mDistanceWRTCamera < distance)
+ {
+ probe_pos.load3(drawable->mXform.getPosition().mV);
+ }
}
}
}
- probe_pos.load3(((focus_point + camera_pos) / 2).mV);
static LLCachedControl<S32> sDetail(gSavedSettings, "RenderHeroReflectionProbeDetail", -1);
static LLCachedControl<S32> sLevel(gSavedSettings, "RenderHeroReflectionProbeLevel", 3);
@@ -464,7 +482,7 @@ void LLHeroProbeManager::initReflectionMaps()
mDefaultProbe->mCubeIndex = 0;
mDefaultProbe->mCubeArray = mTexture;
- mDefaultProbe->mDistance = 64.f;
+ mDefaultProbe->mDistance = 12.f;
mDefaultProbe->mRadius = 4096.f;
mDefaultProbe->mProbeIndex = 0;
touch_default_probe(mDefaultProbe);
@@ -536,6 +554,7 @@ void LLHeroProbeManager::registerHeroDrawable(LLDrawable* drawablep)
if (mHeroList.find(drawablep) == mHeroList.end())
{
mHeroList.insert(drawablep);
+ LL_INFOS() << "Added hero drawable." << LL_ENDL;
}
}
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 9233ec6277..25f42e6dae 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -596,17 +596,6 @@ void LLPanelFace::sendFullbright()
LLSelectMgr::getInstance()->selectionSetFullbright( fullbright );
}
-void LLPanelFace::sendMirror()
-{
- LLCheckBoxCtrl* mCheckMirror = getChild<LLCheckBoxCtrl>("checkbox mirror");
-
- if (!mCheckMirror)
- return;
-
- LLTextureEntry::eRenderableTarget target = mCheckMirror->get() ? LLTextureEntry::RT_MIRROR : LLTextureEntry::RT_DISABLED;
- LLSelectMgr::getInstance()->selectionSetRenderableTarget(target);
-}
-
void LLPanelFace::sendColor()
{
@@ -3007,12 +2996,6 @@ void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata)
self->sendFullbright();
}
-void LLPanelFace::onCommitMirror(LLUICtrl* ctrl, void* userdata)
-{
- LLPanelFace* self = (LLPanelFace*) userdata;
- self->sendMirror();
-}
-
// static
void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata)
{
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index 0b7486232d..5cad8cefcf 100644
--- a/indra/newview/llpanelface.h
+++ b/indra/newview/llpanelface.h
@@ -139,7 +139,6 @@ protected:
void sendShiny(U32 shininess); // applies and sends shininess
void sendFullbright(); // applies and sends full bright
- void sendMirror();
void sendGlow();
void alignTestureLayer();
@@ -229,7 +228,6 @@ protected:
static void onCommitShiny( LLUICtrl* ctrl, void* userdata);
static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata);
static void onCommitFullbright( LLUICtrl* ctrl, void* userdata);
- static void onCommitMirror(LLUICtrl* ctrl, void* userdata);
static void onCommitGlow( LLUICtrl* ctrl, void *userdata);
static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata);
static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo);
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index ed244f773c..d62a640b5c 100644
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -114,6 +114,11 @@ BOOL LLPanelVolume::postBuild()
getChild<LLUICtrl>("FlexForceZ")->setValidateBeforeCommit(precommitValidate);
}
+ // Mirror Parameters
+ {
+ childSetCommitCallback("Mirror Checkbox Ctrl", onCommitIsMirror, this);
+ }
+
// LIGHT Parameters
{
childSetCommitCallback("Light Checkbox Ctrl",onCommitIsLight,this);
@@ -305,6 +310,10 @@ void LLPanelVolume::getState( )
getChildView("select_single")->setEnabled(true);
}
+ BOOL is_mirror = volobjp && volobjp->isMirror();
+ getChild<LLUICtrl>("Mirror Checkbox Ctrl")->setValue(is_mirror);
+ getChildView("Mirror Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp);
+
// Light properties
BOOL is_light = volobjp && volobjp->getIsLight();
getChild<LLUICtrl>("Light Checkbox Ctrl")->setValue(is_light);
@@ -737,6 +746,25 @@ void LLPanelVolume::sendIsLight()
LL_INFOS() << "update light sent" << LL_ENDL;
}
+void LLPanelVolume::sendIsMirror()
+{
+ LLViewerObject* objectp = mObject;
+ if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
+ }
+ LLVOVolume *volobjp = (LLVOVolume *)objectp;
+
+ // Quick hack to set the mirror locally.
+
+ gPipeline.mHeroProbeManager.registerHeroDrawable(volobjp->mDrawable);
+
+ BOOL value = getChild<LLUICtrl>("Mirror Checkbox Ctrl")->getValue();
+ volobjp->setIsMirror(value);
+ LL_INFOS() << "update mirror sent" << LL_ENDL;
+}
+
+
void LLPanelVolume::sendIsReflectionProbe()
{
LLViewerObject* objectp = mObject;
@@ -1403,6 +1431,12 @@ void LLPanelVolume::onCommitIsLight( LLUICtrl* ctrl, void* userdata )
self->sendIsLight();
}
+void LLPanelVolume::onCommitIsMirror( LLUICtrl* ctrl, void* userdata )
+{
+ LLPanelVolume* self = (LLPanelVolume*) userdata;
+ self->sendIsMirror();
+}
+
// static
void LLPanelVolume::setLightTextureID(const LLUUID &asset_id, const LLUUID &item_id, LLVOVolume* volobjp)
{
diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h
index 01b7ebb75c..a658351624 100644
--- a/indra/newview/llpanelvolume.h
+++ b/indra/newview/llpanelvolume.h
@@ -58,6 +58,7 @@ public:
void sendIsLight();
+ void sendIsMirror();
// when an object is becoming a refleciton probe, present a dialog asking for confirmation
// otherwise, send the reflection probe update immediately
void sendIsReflectionProbe();
@@ -71,6 +72,7 @@ public:
static void onCommitIsLight( LLUICtrl* ctrl, void* userdata);
static void onCommitLight( LLUICtrl* ctrl, void* userdata);
+ static void onCommitIsMirror( LLUICtrl* ctrl, void* userdata);
static void onCommitIsReflectionProbe(LLUICtrl* ctrl, void* userdata);
static void onCommitProbe(LLUICtrl* ctrl, void* userdata);
void onCommitIsFlexible( LLUICtrl* ctrl, void* userdata);
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 2b1b4b79b2..5c1a339570 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2355,47 +2355,6 @@ void LLSelectMgr::selectionSetFullbright(U8 fullbright)
getSelection()->applyToObjects(&sendfunc);
}
-void LLSelectMgr::selectionSetRenderableTarget(LLTextureEntry::eRenderableTarget target)
-{
- struct f : public LLSelectedTEFunctor
- {
- LLTextureEntry::eRenderableTarget mRenderableTarget;
-
- f(const LLTextureEntry::eRenderableTarget& t) : mRenderableTarget(t) {}
-
- bool apply(LLViewerObject* object, S32 te)
- {
- if (object->permModify())
- {
- object->setTERenderableTarget(te, mRenderableTarget);
- }
-
- return true;
- }
- } setfunc(target);
-
- getSelection()->applyToTEs(&setfunc);
-
- struct g : public LLSelectedObjectFunctor
- {
- LLTextureEntry::eRenderableTarget mRenderableTarget;
-
- g(const LLTextureEntry::eRenderableTarget& t) : mRenderableTarget(t) {}
-
- virtual bool apply(LLViewerObject* object)
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
-
- return true;
- }
- } sendfunc(target);
-
- getSelection()->applyToObjects(&sendfunc);
-}
-
// This function expects media_data to be a map containing relevant
// media data name/value pairs (e.g. home_url, etc.)
void LLSelectMgr::selectionSetMedia(U8 media_type, const LLSD &media_data)
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index 8ce59c6654..327134a487 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -653,7 +653,6 @@ public:
void selectionSetGlow(const F32 glow);
void selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func, int specific_te = -1);
void selectionRemoveMaterial();
- void selectionSetRenderableTarget(LLTextureEntry::eRenderableTarget target);
void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE);
void selectionSetObjectName(const std::string& name);
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 7871815fda..68162f83c0 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -5296,29 +5296,6 @@ S32 LLViewerObject::setTEFullbright(const U8 te, const U8 fullbright)
return retval;
}
-S32 LLViewerObject::setTERenderableTarget(const U8 te, const LLTextureEntry::eRenderableTarget target)
-{
- S32 retval = 0;
-
- const LLTextureEntry *tep = getTE(te);
- if (!tep)
- {
- LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL;
- }
- else if (target != tep->getRenderableTarget())
- {
- retval = LLPrimitive::setTERenderableTarget(te, target);
- setChanged(TEXTURE);
- if (mDrawable.notNull() && retval)
- {
- //gPipeline.markMirror(mDrawable);
- }
- }
-
- return retval;
-}
-
-
S32 LLViewerObject::setTEMediaFlags(const U8 te, const U8 media_flags)
{
// this might need work for media type
@@ -6252,6 +6229,11 @@ LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 para
new_block = new LLReflectionProbeParams();
break;
}
+ case LLNetworkData::PARAMS_MIRROR:
+ {
+ new_block = new LLMirrorParams();
+ break;
+ }
default:
{
llassert(false); // invalid parameter type
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index fe33047218..a87644476f 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -360,7 +360,6 @@ public:
/*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media ); // *FIXME: this confusingly acts upon a superset of setTETexGen's flags without absorbing its semantics
/*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny );
/*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright );
- /*virtual*/ S32 setTERenderableTarget(const U8 te, const LLTextureEntry::eRenderableTarget target);
/*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);
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 2589beefe9..175ce93b14 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1045,7 +1045,10 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline)
updateReflectionProbePtr();
}
- gPipeline.mHeroProbeManager.registerHeroDrawable(mDrawable);
+ if (isMirror())
+ {
+ gPipeline.mHeroProbeManager.registerHeroDrawable(mDrawable);
+ }
updateRadius();
bool force_update = true; // avoid non-alpha mDistance update being optimized away
@@ -2369,16 +2372,6 @@ S32 LLVOVolume::setTEFullbright(const U8 te, const U8 fullbright)
return res;
}
-S32 LLVOVolume::setTERenderableTarget(const U8 te, const LLTextureEntry::eRenderableTarget mirror)
-{
- S32 res = LLViewerObject::setTERenderableTarget(te, mirror);
- if (res)
- {
- //gPipeline.markMirror(mDrawable);
- }
- return res;
-}
-
S32 LLVOVolume::setTEBumpShinyFullbright(const U8 te, const U8 bump)
{
S32 res = LLViewerObject::setTEBumpShinyFullbright(te, bump);
@@ -3379,28 +3372,41 @@ F32 LLVOVolume::getLightCutoff() const
}
}
-BOOL LLVOVolume::isMirror() const
+bool LLVOVolume::setIsMirror(BOOL is_mirror)
{
- S32 faceCount = getNumFaces();
-
- // Temporary hack to set the object to mirror.
- for (int i = 0; i < faceCount; i++)
+ BOOL was_mirror = isMirror();
+ if (is_mirror != was_mirror)
{
- const LLTextureEntry* te = getTE(i);
-
- if (te->getMaterialParams().notNull())
+ if (is_mirror)
{
- LLViewerTexture* specularp = getTESpecularMap(0);
-
- if (specularp && specularp->getID() == "da7ecda1-e780-423f-ce27-26df7dc69cb6")
- {
- LL_INFOS() << "BELLADONNA OF SADNESS" << LL_ENDL;
- return TRUE;
- }
+ setParameterEntryInUse(LLNetworkData::PARAMS_MIRROR, TRUE, true);
+ }
+ else
+ {
+ setParameterEntryInUse(LLNetworkData::PARAMS_MIRROR, FALSE, true);
}
}
- return FALSE;
+ updateMirrorDrawable();
+
+ return was_mirror != is_mirror;
+}
+
+void LLVOVolume::updateMirrorDrawable()
+{
+ if (isMirror())
+ {
+ gPipeline.mHeroProbeManager.registerHeroDrawable(mDrawable);
+ }
+ else
+ {
+ gPipeline.mHeroProbeManager.unregisterHeroDrawable(mDrawable);
+ }
+}
+
+BOOL LLVOVolume::isMirror() const
+{
+ return getParameterEntryInUse(LLNetworkData::PARAMS_REFLECTION_PROBE);
}
BOOL LLVOVolume::isReflectionProbe() const
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index cecf726763..32c89ddae2 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -209,7 +209,6 @@ public:
/*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump) override;
/*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny) override;
/*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright) override;
- /*virtual*/ S32 setTERenderableTarget(const U8 te, const LLTextureEntry::eRenderableTarget target) override;
/*virtual*/ S32 setTEBumpShinyFullbright(const U8 te, const U8 bump) override;
/*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags) override;
/*virtual*/ S32 setTEGlow(const U8 te, const F32 glow) override;
@@ -295,6 +294,10 @@ public:
F32 getLightRadius() const;
F32 getLightFalloff(const F32 fudge_factor = 1.f) const;
F32 getLightCutoff() const;
+
+ // Mirrors
+ bool setIsMirror(BOOL is_mirror);
+ void updateMirrorDrawable();
// Reflection Probes
bool setIsReflectionProbe(BOOL is_probe);
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index 5e999ed245..4094a487a9 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -2406,7 +2406,15 @@ even though the user gets a free copy.
name="object_horizontal"
top_pad="10"
width="278" />
-
+ <check_box
+ height="16"
+ label="Mirror"
+ layout="topleft"
+ left="10"
+ name="Mirror Checkbox Ctrl"
+ tool_tip="Causes object to be a mirror"
+ top_pad="8"
+ width="60" />
<check_box
height="16"
label="Light"