start to abstract-out the 'is a spotlight' question so one day we can perhaps make the UI hurt less.

meow-7.2.2
Tofu Linden 2010-02-01 17:29:08 +00:00
parent 04bfd00a5d
commit e8899c4f4c
5 changed files with 14 additions and 5 deletions

View File

@ -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; }

View File

@ -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");

View File

@ -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();

View File

@ -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;

View File

@ -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);