Rework @setsphere into a visual effect and consolidate all the code
parent
8529ba2eb6
commit
5a9c548020
|
|
@ -116,6 +116,7 @@
|
|||
#include "llprogressview.h"
|
||||
#include "llcleanup.h"
|
||||
// [RLVa:KB] - Checked: RLVa-2.0.0
|
||||
#include "llvisualeffect.h"
|
||||
#include "rlvactions.h"
|
||||
#include "rlvlocks.h"
|
||||
// [/RLVa:KB]
|
||||
|
|
@ -9081,58 +9082,15 @@ void LLPipeline::renderDeferredLighting()
|
|||
}
|
||||
}
|
||||
|
||||
mScreen.flush();
|
||||
|
||||
// [RLVa:KB] - @setsphere
|
||||
if (RlvActions::hasBehaviour(RLV_BHVR_SETSPHERE))
|
||||
{
|
||||
LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_RLV);
|
||||
|
||||
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
|
||||
|
||||
//mScreen.bindTarget();
|
||||
gDeferredRlvProgram.bind();
|
||||
|
||||
S32 nDiffuseChannel = gDeferredRlvProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
|
||||
if (nDiffuseChannel > -1)
|
||||
{
|
||||
mScreen.bindTexture(0, nDiffuseChannel);
|
||||
gGL.getTexUnit(nDiffuseChannel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
}
|
||||
|
||||
S32 nDepthChannel = gDeferredRlvProgram.enableTexture(LLShaderMgr::DEFERRED_DEPTH, mDeferredDepth.getUsage());
|
||||
if (nDepthChannel > -1)
|
||||
{
|
||||
gGL.getTexUnit(nDepthChannel)->bind(&mDeferredDepth, TRUE);
|
||||
}
|
||||
|
||||
RlvActions::setEffectSphereShaderUniforms(&gDeferredRlvProgram, &mScreen);
|
||||
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadIdentity();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(gGLModelView);
|
||||
|
||||
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.popMatrix();
|
||||
|
||||
gDeferredRlvProgram.disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mScreen.getUsage());
|
||||
gDeferredRlvProgram.disableTexture(LLShaderMgr::DEFERRED_DEPTH, mScreen.getUsage());
|
||||
gDeferredRlvProgram.unbind();
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(0)->activate();
|
||||
|
||||
//mScreen.flush();
|
||||
LLVfxManager::instance().runEffect(EVisualEffect::RlvSphere);
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
|
||||
mScreen.flush();
|
||||
|
||||
}
|
||||
|
||||
void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llagent.h"
|
||||
#include "llimview.h"
|
||||
#include "llshadermgr.h"
|
||||
#include "llviewercamera.h"
|
||||
#include "llvoavatarself.h"
|
||||
#include "llworld.h"
|
||||
|
|
@ -258,38 +257,6 @@ EChatType RlvActions::checkChatVolume(EChatType chatType)
|
|||
return chatType;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Effects
|
||||
//
|
||||
|
||||
// static
|
||||
void RlvActions::setEffectSphereShaderUniforms(LLGLSLShader* pShader, LLRenderTarget* pRenderTarget)
|
||||
{
|
||||
if (!pShader || !pRenderTarget)
|
||||
return;
|
||||
|
||||
pShader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, glh_get_current_projection().inverse().m);
|
||||
pShader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, pRenderTarget->getWidth(), pRenderTarget->getHeight());
|
||||
|
||||
// Pass the center of the sphere to the shader
|
||||
const LLVector4 posSphereOrigin(isAgentAvatarValid() ? gAgentAvatarp->getRenderPosition() : gAgent.getPositionAgent() , 1.0f);
|
||||
glh::vec4f posSphereOriginGl(posSphereOrigin.mV);
|
||||
const glh::matrix4f& mvMatrix = gGL.getModelviewMatrix();
|
||||
mvMatrix.mult_matrix_vec(posSphereOriginGl);
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_AVPOSLOCAL, 1, posSphereOriginGl.v);
|
||||
|
||||
const RlvBehaviourDictionary& rlvBhvrDict = RlvBehaviourDictionary::instance();
|
||||
|
||||
// Pack min/max distance and alpha together
|
||||
pShader->uniform4f(LLShaderMgr::RLV_EFFECT_PARAM1,
|
||||
rlvBhvrDict.getModifier(RLV_MODIFIER_EFFECT_SPHERE_MINALPHA)->getValue<float>(), rlvBhvrDict.getModifier(RLV_MODIFIER_EFFECT_SPHERE_MINDIST)->getValue<float>(),
|
||||
rlvBhvrDict.getModifier(RLV_MODIFIER_EFFECT_SPHERE_MAXALPHA)->getValue<float>(), rlvBhvrDict.getModifier(RLV_MODIFIER_EFFECT_SPHERE_MAXDIST)->getValue<float>());
|
||||
|
||||
// Pass color
|
||||
const glh::vec4f sphereColor(rlvBhvrDict.getModifier(RLV_MODIFIER_EFFECT_SPHERE_COLOR)->getValue<LLVector3>().mV, 1.0);
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM2, 1, sphereColor.v);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Inventory
|
||||
//
|
||||
|
|
|
|||
|
|
@ -142,15 +142,6 @@ protected:
|
|||
// Backwards logic so that we can initialize to 0 and it won't block when we forget to/don't check if RLVa is disabled
|
||||
static bool s_BlockNamesContexts[SNC_COUNT];
|
||||
|
||||
// =======
|
||||
// Effects
|
||||
// =======
|
||||
public:
|
||||
/*
|
||||
* Sets the uniform values needed by the 'vision spheres' effect
|
||||
*/
|
||||
static void setEffectSphereShaderUniforms(LLGLSLShader* pShader, LLRenderTarget* renderTarget);
|
||||
|
||||
// =========
|
||||
// Inventory
|
||||
// =========
|
||||
|
|
|
|||
|
|
@ -242,13 +242,6 @@ enum ERlvBehaviour {
|
|||
|
||||
// Effects
|
||||
RLV_BHVR_SETSPHERE, // Gives an object exclusive control of the 'vision spheres' effect
|
||||
RLV_BHVR_SETSPHERE_COLOR,
|
||||
RLV_BHVR_SETSPHERE_DENSITY,
|
||||
RLV_BHVR_SETSPHERE_MAXALPHA,
|
||||
RLV_BHVR_SETSPHERE_MAXDIST,
|
||||
RLV_BHVR_SETSPHERE_MINALPHA,
|
||||
RLV_BHVR_SETSPHERE_MINDIST,
|
||||
|
||||
RLV_BHVR_SETOVERLAY, // Gives an object exclusive control of the overlay
|
||||
RLV_BHVR_SETOVERLAY_TWEEN, // Animate between the current overlay settings and the supplied values
|
||||
|
||||
|
|
@ -258,24 +251,13 @@ enum ERlvBehaviour {
|
|||
|
||||
enum ERlvBehaviourModifier
|
||||
{
|
||||
// "Vision spheres" post processing effect
|
||||
RLV_MODIFIER_EFFECT_SPHERE_COLOR, // Colour to mix with the actual pixel colour (alpha depends non-linerally )
|
||||
RLV_MODIFIER_EFFECT_SPHERE_DENSITY, // Not exposed at the moment
|
||||
RLV_MODIFIER_EFFECT_SPHERE_MAXALPHA,// Alpha of the mix colour at maximum distance
|
||||
RLV_MODIFIER_EFFECT_SPHERE_MAXDIST, // Distance at which the blending stops ; or colour = mix(colour, sphere_colour, max_alpha)
|
||||
RLV_MODIFIER_EFFECT_SPHERE_MINALPHA,// Alpha of the mix colour at minimum distance
|
||||
RLV_MODIFIER_EFFECT_SPHERE_MINDIST, // Distance at which the gradual blending starts; or colour = mix(colour, sphere_colour, min_alpha)
|
||||
|
||||
RLV_MODIFIER_FARTOUCHDIST, // Radius of a sphere around the user in which they can interact with the world
|
||||
|
||||
|
||||
RLV_MODIFIER_RECVIMDISTMIN, // Minimum distance to receive an IM from an otherwise restricted sender (squared value)
|
||||
RLV_MODIFIER_RECVIMDISTMAX, // Maximum distance to receive an IM from an otherwise restricted sender (squared value)
|
||||
RLV_MODIFIER_SENDIMDISTMIN, // Minimum distance to send an IM to an otherwise restricted recipient (squared value)
|
||||
RLV_MODIFIER_SENDIMDISTMAX, // Maximum distance to send an IM to an otherwise restricted recipient (squared value)
|
||||
RLV_MODIFIER_STARTIMDISTMIN, // Minimum distance to start an IM to an otherwise restricted recipient (squared value)
|
||||
RLV_MODIFIER_STARTIMDISTMAX, // Maximum distance to start an IM to an otherwise restricted recipient (squared value)
|
||||
|
||||
RLV_MODIFIER_SETCAM_AVDIST, // Distance at which nearby avatars turn into a silhouette (normal value)
|
||||
RLV_MODIFIER_SETCAM_AVDISTMIN, // Minimum distance between the camera position and the user's avatar (normal value)
|
||||
RLV_MODIFIER_SETCAM_AVDISTMAX, // Maximum distance between the camera position and the user's avatar (normal value)
|
||||
|
|
@ -287,10 +269,8 @@ enum ERlvBehaviourModifier
|
|||
RLV_MODIFIER_SETCAM_FOVMIN, // Minimum value for the camera's field of view (angle in radians)
|
||||
RLV_MODIFIER_SETCAM_FOVMAX, // Maximum value for the camera's field of view (angle in radians)
|
||||
RLV_MODIFIER_SETCAM_TEXTURE, // Specifies the UUID of the texture used to texture the world view
|
||||
|
||||
RLV_MODIFIER_SITTPDIST,
|
||||
RLV_MODIFIER_TPLOCALDIST,
|
||||
|
||||
RLV_MODIFIER_COUNT,
|
||||
RLV_MODIFIER_UNKNOWN
|
||||
};
|
||||
|
|
@ -301,6 +281,11 @@ enum class ERlvLocalBhvrModifier
|
|||
OverlayTexture, // Specifies the UUID of the overlay texture
|
||||
OverlayTint, // The tint that's applied to the overlay texture
|
||||
OverlayTouch, // Determines whether the overlay texture's alpha channel will be used to allow/block world interaction
|
||||
SphereColor, // Colour to mix with the actual pixel colour (alpha depends non-linerally )
|
||||
SphereMaxAlpha, // Alpha of the mix colour at maximum distance
|
||||
SphereMaxDist, // Distance at which the blending stops ; or colour = mix(colour, sphere_colour, max_alpha)
|
||||
SphereMinAlpha, // Alpha of the mix colour at minimum distance
|
||||
SphereMinDist, // Distance at which the gradual blending starts; or colour = mix(colour, sphere_colour, min_alpha)
|
||||
|
||||
Unknown,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,10 +16,14 @@
|
|||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llglslshader.h"
|
||||
#include "llrender2dutils.h"
|
||||
#include "llviewershadermgr.h"
|
||||
#include "llviewertexturelist.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llvoavatarself.h"
|
||||
#include "pipeline.h"
|
||||
|
||||
#include "rlveffects.h"
|
||||
#include "rlvhandler.h"
|
||||
|
|
@ -173,3 +177,157 @@ void RlvOverlayEffect::run()
|
|||
}
|
||||
|
||||
// ====================================================================================
|
||||
// RlvSphereEffect class
|
||||
//
|
||||
|
||||
const float c_SphereDefaultAlpha = 1.0f;
|
||||
const float c_SphereDefaultDistance = 0.0f;
|
||||
const float c_SphereDefaultColor[3] = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
RlvSphereEffect::RlvSphereEffect(const LLUUID& idRlvObj)
|
||||
: LLVisualEffect(idRlvObj, EVisualEffect::RlvSphere, EVisualEffectType::PostProcessShader)
|
||||
, m_Color(LLColor3(c_SphereDefaultColor))
|
||||
, m_nMinAlpha(c_SphereDefaultAlpha), m_nMaxAlpha(c_SphereDefaultAlpha)
|
||||
, m_nMinDistance(c_SphereDefaultDistance), m_nMaxDistance(c_SphereDefaultDistance)
|
||||
{
|
||||
if (RlvObject* pRlvObj = gRlvHandler.getObject(idRlvObj))
|
||||
{
|
||||
LLVector3 vecColor;
|
||||
if (pRlvObj->getModifierValue<LLVector3>(ERlvLocalBhvrModifier::SphereColor, vecColor))
|
||||
m_Color = LLColor3(vecColor.mV);
|
||||
|
||||
float nValue;
|
||||
if (pRlvObj->getModifierValue<float>(ERlvLocalBhvrModifier::SphereMinAlpha, nValue))
|
||||
m_nMinAlpha = nValue;
|
||||
if (pRlvObj->getModifierValue<float>(ERlvLocalBhvrModifier::SphereMaxAlpha, nValue))
|
||||
m_nMaxAlpha = nValue;
|
||||
|
||||
if (pRlvObj->getModifierValue<float>(ERlvLocalBhvrModifier::SphereMinDist, nValue))
|
||||
m_nMinDistance = nValue;
|
||||
if (pRlvObj->getModifierValue<float>(ERlvLocalBhvrModifier::SphereMaxDist, nValue))
|
||||
m_nMaxDistance = nValue;
|
||||
}
|
||||
}
|
||||
|
||||
RlvSphereEffect::~RlvSphereEffect()
|
||||
{
|
||||
}
|
||||
|
||||
// static
|
||||
ERlvCmdRet RlvSphereEffect::onColorChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
|
||||
{
|
||||
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
|
||||
{
|
||||
pEffect->m_Color = LLColor3((newValue) ? boost::get<LLVector3>(newValue.value()).mV : c_SphereDefaultColor);
|
||||
}
|
||||
return RLV_RET_SUCCESS;
|
||||
}
|
||||
|
||||
// static
|
||||
ERlvCmdRet RlvSphereEffect::onMinAlphaChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
|
||||
{
|
||||
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
|
||||
{
|
||||
pEffect->m_nMinAlpha = (newValue) ? boost::get<float>(newValue.value()) : c_SphereDefaultAlpha;
|
||||
}
|
||||
return RLV_RET_SUCCESS;
|
||||
}
|
||||
|
||||
// static
|
||||
ERlvCmdRet RlvSphereEffect::onMaxAlphaChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
|
||||
{
|
||||
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
|
||||
{
|
||||
pEffect->m_nMaxAlpha = (newValue) ? boost::get<float>(newValue.value()) : c_SphereDefaultAlpha;
|
||||
}
|
||||
return RLV_RET_SUCCESS;
|
||||
}
|
||||
|
||||
// static
|
||||
ERlvCmdRet RlvSphereEffect::onMinDistChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
|
||||
{
|
||||
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
|
||||
{
|
||||
pEffect->m_nMinDistance = (newValue) ? boost::get<float>(newValue.value()) : c_SphereDefaultDistance;
|
||||
}
|
||||
return RLV_RET_SUCCESS;
|
||||
}
|
||||
|
||||
// static
|
||||
ERlvCmdRet RlvSphereEffect::onMaxDistChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue)
|
||||
{
|
||||
if (RlvSphereEffect* pEffect = dynamic_cast<RlvSphereEffect*>(LLVfxManager::instance().getEffect(idRlvObj)))
|
||||
{
|
||||
pEffect->m_nMaxDistance = (newValue) ? boost::get<float>(newValue.value()) : c_SphereDefaultDistance;
|
||||
}
|
||||
return RLV_RET_SUCCESS;
|
||||
}
|
||||
|
||||
void RlvSphereEffect::setShaderUniforms(LLGLSLShader* pShader, LLRenderTarget* pRenderTarget)
|
||||
{
|
||||
pShader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, glh_get_current_projection().inverse().m);
|
||||
pShader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, pRenderTarget->getWidth(), pRenderTarget->getHeight());
|
||||
|
||||
// Pass the sphere origin to the shader
|
||||
const LLVector4 posSphereOrigin(isAgentAvatarValid() ? gAgentAvatarp->getRenderPosition() : gAgent.getPositionAgent(), 1.0f);
|
||||
glh::vec4f posSphereOriginGl(posSphereOrigin.mV);
|
||||
const glh::matrix4f& mvMatrix = gGL.getModelviewMatrix();
|
||||
mvMatrix.mult_matrix_vec(posSphereOriginGl);
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_AVPOSLOCAL, 1, posSphereOriginGl.v);
|
||||
|
||||
// Pack min/max distance and alpha together
|
||||
const glh::vec4f sphereParams(m_nMinAlpha, m_nMinDistance, m_nMaxAlpha, m_nMaxDistance);
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM1, 1, sphereParams.v);
|
||||
|
||||
// Pass color
|
||||
const glh::vec4f sphereColor(m_Color.mV, 1.0);
|
||||
pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM2, 1, sphereColor.v);
|
||||
}
|
||||
|
||||
void RlvSphereEffect::run()
|
||||
{
|
||||
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
|
||||
|
||||
gPipeline.mScreen.bindTarget();
|
||||
gDeferredRlvProgram.bind();
|
||||
|
||||
S32 nDiffuseChannel = gDeferredRlvProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, gPipeline.mScreen.getUsage());
|
||||
if (nDiffuseChannel > -1)
|
||||
{
|
||||
gPipeline.mScreen.bindTexture(0, nDiffuseChannel);
|
||||
gGL.getTexUnit(nDiffuseChannel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
}
|
||||
|
||||
S32 nDepthChannel = gDeferredRlvProgram.enableTexture(LLShaderMgr::DEFERRED_DEPTH, gPipeline.mDeferredDepth.getUsage());
|
||||
if (nDepthChannel > -1)
|
||||
{
|
||||
gGL.getTexUnit(nDepthChannel)->bind(&gPipeline.mDeferredDepth, TRUE);
|
||||
}
|
||||
|
||||
setShaderUniforms(&gDeferredRlvProgram, &gPipeline.mScreen);
|
||||
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadIdentity();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.pushMatrix();
|
||||
gGL.loadMatrix(gGLModelView);
|
||||
|
||||
gPipeline.mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
gPipeline.mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
|
||||
gGL.matrixMode(LLRender::MM_PROJECTION);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.popMatrix();
|
||||
|
||||
gDeferredRlvProgram.disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, gPipeline.mScreen.getUsage());
|
||||
gDeferredRlvProgram.disableTexture(LLShaderMgr::DEFERRED_DEPTH, gPipeline.mScreen.getUsage());
|
||||
gDeferredRlvProgram.unbind();
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(0)->activate();
|
||||
|
||||
gPipeline.mScreen.flush();
|
||||
}
|
||||
|
||||
// ====================================================================================
|
||||
|
|
|
|||
|
|
@ -36,9 +36,10 @@ public:
|
|||
~RlvOverlayEffect();
|
||||
|
||||
public:
|
||||
bool hitTest(const LLCoordGL& ptMouse) const;
|
||||
void run() override;
|
||||
void tweenAlpha(float endAlpha, double duration) { m_nAlpha.start(endAlpha, duration); }
|
||||
void tweenColor(LLColor3 endColor, double duration) { m_Color.start(endColor, duration); }
|
||||
bool hitTest(const LLCoordGL& ptMouse) const;
|
||||
static ERlvCmdRet onAlphaValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
|
||||
static ERlvCmdRet onBlockTouchValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
|
||||
static ERlvCmdRet onColorValueChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
|
||||
|
|
@ -47,8 +48,6 @@ protected:
|
|||
void clearImage();
|
||||
void setImage(const LLUUID& idTexture);
|
||||
|
||||
void run() override;
|
||||
|
||||
/*
|
||||
* Member variables
|
||||
*/
|
||||
|
|
@ -62,3 +61,34 @@ protected:
|
|||
};
|
||||
|
||||
// ====================================================================================
|
||||
// RlvSphereEffect class
|
||||
//
|
||||
|
||||
class RlvSphereEffect : public LLVisualEffect
|
||||
{
|
||||
public:
|
||||
RlvSphereEffect(const LLUUID& idRlvObj);
|
||||
~RlvSphereEffect();
|
||||
|
||||
public:
|
||||
void run() override;
|
||||
static ERlvCmdRet onColorChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
|
||||
static ERlvCmdRet onMinAlphaChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
|
||||
static ERlvCmdRet onMaxAlphaChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
|
||||
static ERlvCmdRet onMinDistChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
|
||||
static ERlvCmdRet onMaxDistChanged(const LLUUID& idRlvObj, const boost::optional<RlvBehaviourModifierValue> newValue);
|
||||
protected:
|
||||
void setShaderUniforms(LLGLSLShader* pShader, LLRenderTarget* pRenderTarget);
|
||||
|
||||
/*
|
||||
* Member variables
|
||||
*/
|
||||
protected:
|
||||
LLColor3 m_Color;
|
||||
float m_nMinAlpha;
|
||||
float m_nMaxAlpha;
|
||||
float m_nMinDistance;
|
||||
float m_nMaxDistance;
|
||||
};
|
||||
|
||||
// ====================================================================================
|
||||
|
|
|
|||
|
|
@ -2059,6 +2059,21 @@ void RlvBehaviourToggleHandler<RLV_BHVR_SETOVERLAY>::onCommandToggle(ERlvBehavio
|
|||
LLVfxManager::instance().removeEffect(gRlvHandler.getCurrentObject());
|
||||
}
|
||||
|
||||
// Handles: @setsphere=n|y
|
||||
template<> template<>
|
||||
ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SETSPHERE>::onCommand(const RlvCommand& rlvCmd, bool& fRefCount)
|
||||
{
|
||||
ERlvCmdRet eRet = RlvBehaviourGenericHandler<RLV_OPTION_NONE_OR_MODIFIER>::onCommand(rlvCmd, fRefCount);
|
||||
if ( (RLV_RET_SUCCESS == eRet) && (!rlvCmd.isModifier()) )
|
||||
{
|
||||
if (gRlvHandler.hasBehaviour(rlvCmd.getObjectID(), rlvCmd.getBehaviourType()))
|
||||
LLVfxManager::instance().addEffect(new RlvSphereEffect(rlvCmd.getObjectID()));
|
||||
else
|
||||
LLVfxManager::instance().removeEffect(gRlvHandler.getCurrentObject());
|
||||
}
|
||||
return RLV_RET_SUCCESS;
|
||||
}
|
||||
|
||||
// Handles: @sendchannel[:<channel>]=n|y and @sendchannel_except[:<channel>]=n|y
|
||||
template<> template<>
|
||||
ERlvCmdRet RlvBehaviourSendChannelHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount)
|
||||
|
|
|
|||
|
|
@ -215,19 +215,6 @@ RlvBehaviourDictionary::RlvBehaviourDictionary()
|
|||
addEntry(new RlvBehaviourProcessor<RLV_BHVR_CAMZOOMMAX, RlvBehaviourCamZoomMinMaxHandler>("camzoommax", RlvBehaviourInfo::BHVR_DEPRECATED));
|
||||
addEntry(new RlvBehaviourGenericToggleProcessor<RLV_BHVR_SETCAM_UNLOCK, RLV_OPTION_NONE>("camunlock", RlvBehaviourInfo::BHVR_SYNONYM | RlvBehaviourInfo::BHVR_DEPRECATED));
|
||||
|
||||
// Effect: "vision spheres"
|
||||
addEntry(new RlvBehaviourGenericProcessor<RLV_OPTION_NONE>("setsphere", RLV_BHVR_SETSPHERE, RlvBehaviourInfo::BHVR_EXPERIMENTAL));
|
||||
addModifier(new RlvForceGenericProcessor<RLV_OPTION_MODIFIER>("setsphere_color", RLV_BHVR_SETSPHERE_COLOR, RlvBehaviourInfo::BHVR_EXPERIMENTAL),
|
||||
RLV_MODIFIER_EFFECT_SPHERE_COLOR, new RlvBehaviourModifier("Effect: Vision spheres - Color", LLVector3(.0f, .0f, .0f), true, new RlvBehaviourModifierComp()));
|
||||
addModifier(new RlvForceGenericProcessor<RLV_OPTION_MODIFIER>("setsphere_maxdist", RLV_BHVR_SETSPHERE_MAXDIST, RlvBehaviourInfo::BHVR_EXPERIMENTAL),
|
||||
RLV_MODIFIER_EFFECT_SPHERE_MAXDIST, new RlvBehaviourModifier("Effect: Vision spheres - Max distance", 0.f, false, new RlvBehaviourModifierCompMin()));
|
||||
addModifier(new RlvForceGenericProcessor<RLV_OPTION_MODIFIER>("setsphere_maxalpha", RLV_BHVR_SETSPHERE_MAXALPHA, RlvBehaviourInfo::BHVR_EXPERIMENTAL),
|
||||
RLV_MODIFIER_EFFECT_SPHERE_MAXALPHA, new RlvBehaviourModifier("Effect: Vision spheres - Max distance alpha", 1.0f, false, new RlvBehaviourModifierCompMax()));
|
||||
addModifier(new RlvForceGenericProcessor<RLV_OPTION_MODIFIER>("setsphere_mindist", RLV_BHVR_SETSPHERE_MINDIST, RlvBehaviourInfo::BHVR_EXPERIMENTAL),
|
||||
RLV_MODIFIER_EFFECT_SPHERE_MINDIST, new RlvBehaviourModifier("Effect: Vision spheres - Min distance", 0.f, false, new RlvBehaviourModifierCompMin()));
|
||||
addModifier(new RlvForceGenericProcessor<RLV_OPTION_MODIFIER>("setsphere_minalpha", RLV_BHVR_SETSPHERE_MINALPHA, RlvBehaviourInfo::BHVR_EXPERIMENTAL),
|
||||
RLV_MODIFIER_EFFECT_SPHERE_MINALPHA, new RlvBehaviourModifier("Effect: Vision spheres - Min distance alpha", 1.0f, false, new RlvBehaviourModifierCompMax()));
|
||||
|
||||
// Overlay
|
||||
RlvBehaviourInfo* pSetOverlayBhvr = new RlvBehaviourGenericToggleProcessor<RLV_BHVR_SETOVERLAY, RLV_OPTION_NONE_OR_MODIFIER>("setoverlay");
|
||||
pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayAlpha, typeid(float), "alpha", &RlvOverlayEffect::onAlphaValueChanged);
|
||||
|
|
@ -237,6 +224,15 @@ RlvBehaviourDictionary::RlvBehaviourDictionary()
|
|||
addEntry(pSetOverlayBhvr);
|
||||
addEntry(new RlvForceProcessor<RLV_BHVR_SETOVERLAY_TWEEN>("setoverlay_tween", RlvBehaviourInfo::BHVR_EXPERIMENTAL));
|
||||
|
||||
// Sphere
|
||||
RlvBehaviourInfo* pSetSphereBhvr = new RlvBehaviourProcessor<RLV_BHVR_SETSPHERE>("setsphere", RlvBehaviourInfo::BHVR_EXPERIMENTAL);
|
||||
pSetSphereBhvr->addModifier(ERlvLocalBhvrModifier::SphereColor, typeid(LLVector3), "color", &RlvSphereEffect::onColorChanged);
|
||||
pSetSphereBhvr->addModifier(ERlvLocalBhvrModifier::SphereMinAlpha, typeid(float), "minalpha", &RlvSphereEffect::onMinAlphaChanged);
|
||||
pSetSphereBhvr->addModifier(ERlvLocalBhvrModifier::SphereMaxAlpha, typeid(float), "maxalpha", &RlvSphereEffect::onMaxAlphaChanged);
|
||||
pSetSphereBhvr->addModifier(ERlvLocalBhvrModifier::SphereMinDist, typeid(float), "mindist", &RlvSphereEffect::onMinDistChanged);
|
||||
pSetSphereBhvr->addModifier(ERlvLocalBhvrModifier::SphereMaxDist, typeid(float), "maxdist", &RlvSphereEffect::onMaxDistChanged);
|
||||
addEntry(pSetSphereBhvr);
|
||||
|
||||
//
|
||||
// Force-wear
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in New Issue