summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-02-01 17:29:08 +0000
committerTofu Linden <tofu.linden@lindenlab.com>2010-02-01 17:29:08 +0000
commite8899c4f4c2ae95f108b9bbf543e401debc9c588 (patch)
treee21e17e0f666b00b1868f619b4faecca9b99e60d
parent04bfd00a5d8ae7326211d867af7c3f577ff06763 (diff)
start to abstract-out the 'is a spotlight' question so one day we can perhaps make the UI hurt less.
-rw-r--r--indra/llprimitive/llprimitive.h1
-rw-r--r--indra/newview/llpanelvolume.cpp4
-rw-r--r--indra/newview/llvovolume.cpp7
-rw-r--r--indra/newview/llvovolume.h1
-rw-r--r--indra/newview/pipeline.cpp6
5 files changed, 14 insertions, 5 deletions
diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h
index 4db7aa7261..c25f9cf4a8 100644
--- a/indra/llprimitive/llprimitive.h
+++ b/indra/llprimitive/llprimitive.h
@@ -286,6 +286,7 @@ public:
void setLightTexture(const LLUUID& id) { mLightTexture = id; }
LLUUID getLightTexture() const { return mLightTexture; }
+ bool isLightSpotlight() const { return !mLightTexture.isNull(); }
void setParams(const LLVector3& params) { mParams = params; }
LLVector3 getParams() const { return mParams; }
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index fbe68b4d92..8b01637239 100644
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -574,7 +574,7 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )
LLUUID id = LightTextureCtrl->getImageAssetID();
if (id.notNull())
{
- if (volobjp->getLightTextureID().isNull())
+ if (!volobjp->isLightSpotlight())
{ //this commit is making this a spot light, set UI to default params
volobjp->setLightTextureID(id);
LLVector3 spot_params = volobjp->getSpotLightParams();
@@ -591,7 +591,7 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata )
volobjp->setSpotLightParams(spot_params);
}
}
- else if (volobjp->getLightTextureID().notNull())
+ else if (volobjp->isLightSpotlight())
{ //no longer a spot light
volobjp->setLightTextureID(id);
//self->childDisable("Light FOV");
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 3f1ddc0ee7..305c0a19d6 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -2462,6 +2462,13 @@ void LLVOVolume::updateSpotLightPriority()
}
+bool LLVOVolume::isLightSpotlight()
+{
+ LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE);
+ return params->isLightSpotlight();
+}
+
+
LLViewerTexture* LLVOVolume::getLightTexture()
{
LLUUID id = getLightTextureID();
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index e414d9da4d..280ffea76d 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -218,6 +218,7 @@ public:
LLColor3 getLightBaseColor() const; // not scaled by intensity
LLColor3 getLightColor() const; // scaled by intensity
LLUUID getLightTextureID() const;
+ bool isLightSpotlight() const;
LLVector3 getSpotLightParams() const;
void updateSpotLightPriority();
F32 getSpotLightPriority() const;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 2ad0bad11f..cb0baf77f1 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4584,7 +4584,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
glLightf (gllight, GL_CONSTANT_ATTENUATION, 0.0f);
glLightf (gllight, GL_LINEAR_ATTENUATION, linatten);
glLightf (gllight, GL_QUADRATIC_ATTENUATION, 0.0f);
- if (light->getLightTexture()) // directional (spot-)light
+ if (light->isLightSpotlight()) // directional (spot-)light
{
LLVector3 spotparams = light->getSpotLightParams();
LLQuaternion quat = light->getRenderRotation();
@@ -6693,7 +6693,7 @@ void LLPipeline::renderDeferredLighting()
{ //draw box if camera is outside box
if (render_local)
{
- if (volume->getLightTexture())
+ if (volume->isLightSpotlight())
{
drawablep->getVOVolume()->updateSpotLightPriority();
spot_lights.push_back(drawablep);
@@ -6710,7 +6710,7 @@ void LLPipeline::renderDeferredLighting()
}
else if (render_fullscreen)
{
- if (volume->getLightTexture())
+ if (volume->isLightSpotlight())
{
drawablep->getVOVolume()->updateSpotLightPriority();
fullscreen_spot_lights.push_back(drawablep);