summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelvolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelvolume.cpp')
-rw-r--r--indra/newview/llpanelvolume.cpp125
1 files changed, 125 insertions, 0 deletions
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index ce16b95bc0..4ac109bf3d 100644
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -52,6 +52,7 @@
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "llcolorswatch.h"
+#include "lltexturectrl.h"
#include "llcombobox.h"
#include "llfirstuse.h"
#include "llfocusmgr.h"
@@ -72,6 +73,7 @@
#include "llvovolume.h"
#include "llworld.h"
#include "pipeline.h"
+#include "llviewershadermgr.h"
#include "lldrawpool.h"
#include "lluictrlfactory.h"
@@ -110,12 +112,28 @@ BOOL LLPanelVolume::postBuild()
LightColorSwatch->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectColor, this, _2));
childSetCommitCallback("colorswatch",onCommitLight,this);
}
+
+ LLTextureCtrl* LightTexPicker = getChild<LLTextureCtrl>("light texture control");
+ if (LightTexPicker)
+ {
+ LightTexPicker->setOnCancelCallback(boost::bind(&LLPanelVolume::onLightCancelTexture, this, _2));
+ LightTexPicker->setOnSelectCallback(boost::bind(&LLPanelVolume::onLightSelectTexture, this, _2));
+ childSetCommitCallback("light texture control", onCommitLight, this);
+ }
+
childSetCommitCallback("Light Intensity",onCommitLight,this);
childSetValidate("Light Intensity",precommitValidate);
childSetCommitCallback("Light Radius",onCommitLight,this);
childSetValidate("Light Radius",precommitValidate);
childSetCommitCallback("Light Falloff",onCommitLight,this);
childSetValidate("Light Falloff",precommitValidate);
+
+ childSetCommitCallback("Light FOV", onCommitLight, this);
+ childSetValidate("Light FOV", precommitValidate);
+ childSetCommitCallback("Light Focus", onCommitLight, this);
+ childSetValidate("Light Focus", precommitValidate);
+ childSetCommitCallback("Light Ambiance", onCommitLight, this);
+ childSetValidate("Light Ambiance", precommitValidate);
}
// Start with everyone disabled
@@ -220,14 +238,32 @@ void LLPanelVolume::getState( )
LightColorSwatch->setValid( TRUE );
LightColorSwatch->set(volobjp->getLightBaseColor());
}
+
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ if (LightTextureCtrl)
+ {
+ LightTextureCtrl->setEnabled(TRUE);
+ LightTextureCtrl->setValid(TRUE);
+ LightTextureCtrl->setImageAssetID(volobjp->getLightTextureID());
+ }
+
childSetEnabled("Light Intensity",true);
childSetEnabled("Light Radius",true);
childSetEnabled("Light Falloff",true);
+ childSetEnabled("Light FOV", true);
+ childSetEnabled("Light Focus", true);
+ childSetEnabled("Light Ambiance", true);
+
childSetValue("Light Intensity",volobjp->getLightIntensity());
childSetValue("Light Radius",volobjp->getLightRadius());
childSetValue("Light Falloff",volobjp->getLightFalloff());
+ LLVector3 params = volobjp->getSpotLightParams();
+ childSetValue("Light FOV", params.mV[0]);
+ childSetValue("Light Focus", params.mV[1]);
+ childSetValue("Light Ambiance", params.mV[2]);
+
mLightSavedColor = volobjp->getLightColor();
}
else
@@ -243,9 +279,20 @@ void LLPanelVolume::getState( )
LightColorSwatch->setEnabled( FALSE );
LightColorSwatch->setValid( FALSE );
}
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ if (LightTextureCtrl)
+ {
+ LightTextureCtrl->setEnabled(FALSE);
+ LightTextureCtrl->setValid(FALSE);
+ }
+
childSetEnabled("Light Intensity",false);
childSetEnabled("Light Radius",false);
childSetEnabled("Light Falloff",false);
+
+ childSetEnabled("Light FOV",false);
+ childSetEnabled("Light Focus",false);
+ childSetEnabled("Light Ambiance",false);
}
// Flexible properties
@@ -335,6 +382,15 @@ void LLPanelVolume::refresh()
{
mRootObject = NULL;
}
+
+ BOOL visible = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 0 ? TRUE : FALSE;
+
+ childSetVisible("label texture", visible);
+ childSetVisible("Light FOV", visible);
+ childSetVisible("Light Focus", visible);
+ childSetVisible("Light Ambiance", visible);
+ childSetVisible("light texture control", visible);
+
}
@@ -361,6 +417,13 @@ void LLPanelVolume::clearCtrls()
LightColorSwatch->setEnabled( FALSE );
LightColorSwatch->setValid( FALSE );
}
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ if(LightTextureCtrl)
+ {
+ LightTextureCtrl->setEnabled( FALSE );
+ LightTextureCtrl->setValid( FALSE );
+ }
+
childSetEnabled("Light Intensity",false);
childSetEnabled("Light Radius",false);
childSetEnabled("Light Falloff",false);
@@ -436,6 +499,15 @@ void LLPanelVolume::onLightCancelColor(const LLSD& data)
onLightSelectColor(data);
}
+void LLPanelVolume::onLightCancelTexture(const LLSD& data)
+{
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ if (LightTextureCtrl)
+ {
+ LightTextureCtrl->setImageAssetID(mLightSavedTexture);
+ }
+}
+
void LLPanelVolume::onLightSelectColor(const LLSD& data)
{
LLViewerObject* objectp = mObject;
@@ -456,6 +528,24 @@ void LLPanelVolume::onLightSelectColor(const LLSD& data)
}
}
+void LLPanelVolume::onLightSelectTexture(const LLSD& data)
+{
+ if (mObject.isNull() || (mObject->getPCode() != LL_PCODE_VOLUME))
+ {
+ return;
+ }
+ LLVOVolume *volobjp = (LLVOVolume *) mObject.get();
+
+
+ LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control");
+ if(LightTextureCtrl)
+ {
+ LLUUID id = LightTextureCtrl->getImageAssetID();
+ volobjp->setLightTextureID(id);
+ mLightSavedTexture = id;
+ }
+}
+
// static
void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )
{
@@ -471,12 +561,47 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )
volobjp->setLightIntensity((F32)self->childGetValue("Light Intensity").asReal());
volobjp->setLightRadius((F32)self->childGetValue("Light Radius").asReal());
volobjp->setLightFalloff((F32)self->childGetValue("Light Falloff").asReal());
+
LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch");
if(LightColorSwatch)
{
LLColor4 clr = LightColorSwatch->get();
volobjp->setLightColor(LLColor3(clr));
}
+
+ LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control");
+ if(LightTextureCtrl)
+ {
+ LLUUID id = LightTextureCtrl->getImageAssetID();
+ if (id.notNull())
+ {
+ if (volobjp->getLightTextureID().isNull())
+ { //this commit is making this a spot light, set UI to default params
+ volobjp->setLightTextureID(id);
+ LLVector3 spot_params = volobjp->getSpotLightParams();
+ self->childSetValue("Light FOV", spot_params.mV[0]);
+ self->childSetValue("Light Focus", spot_params.mV[1]);
+ self->childSetValue("Light Ambiance", spot_params.mV[2]);
+ }
+ else
+ { //modifying existing params
+ LLVector3 spot_params;
+ spot_params.mV[0] = (F32) self->childGetValue("Light FOV").asReal();
+ spot_params.mV[1] = (F32) self->childGetValue("Light Focus").asReal();
+ spot_params.mV[2] = (F32) self->childGetValue("Light Ambiance").asReal();
+ volobjp->setSpotLightParams(spot_params);
+ }
+ }
+ else if (volobjp->getLightTextureID().notNull())
+ { //no longer a spot light
+ volobjp->setLightTextureID(id);
+ //self->childDisable("Light FOV");
+ //self->childDisable("Light Focus");
+ //self->childDisable("Light Ambiance");
+ }
+ }
+
+
}
// static