From 5a9c548020e2f2fcd251132c004a80d4e44a2a3c Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Tue, 5 Jan 2021 15:58:24 +0100 Subject: [PATCH] Rework @setsphere into a visual effect and consolidate all the code --- indra/newview/pipeline.cpp | 50 +---------- indra/newview/rlvactions.cpp | 33 -------- indra/newview/rlvactions.h | 9 -- indra/newview/rlvdefines.h | 25 ++---- indra/newview/rlveffects.cpp | 158 +++++++++++++++++++++++++++++++++++ indra/newview/rlveffects.h | 36 +++++++- indra/newview/rlvhandler.cpp | 15 ++++ indra/newview/rlvhelper.cpp | 22 ++--- 8 files changed, 224 insertions(+), 124 deletions(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f039a9575e..886d58e3b0 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -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) diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp index bb656372c3..e96fdbcf60 100644 --- a/indra/newview/rlvactions.cpp +++ b/indra/newview/rlvactions.cpp @@ -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(), rlvBhvrDict.getModifier(RLV_MODIFIER_EFFECT_SPHERE_MINDIST)->getValue(), - rlvBhvrDict.getModifier(RLV_MODIFIER_EFFECT_SPHERE_MAXALPHA)->getValue(), rlvBhvrDict.getModifier(RLV_MODIFIER_EFFECT_SPHERE_MAXDIST)->getValue()); - - // Pass color - const glh::vec4f sphereColor(rlvBhvrDict.getModifier(RLV_MODIFIER_EFFECT_SPHERE_COLOR)->getValue().mV, 1.0); - pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM2, 1, sphereColor.v); -} - // ============================================================================ // Inventory // diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h index 7525ef860b..122c2d4863 100644 --- a/indra/newview/rlvactions.h +++ b/indra/newview/rlvactions.h @@ -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 // ========= diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index d5e684b2e6..bb292d0d49 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -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, }; diff --git a/indra/newview/rlveffects.cpp b/indra/newview/rlveffects.cpp index 4750442089..842e0c27c9 100644 --- a/indra/newview/rlveffects.cpp +++ b/indra/newview/rlveffects.cpp @@ -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(ERlvLocalBhvrModifier::SphereColor, vecColor)) + m_Color = LLColor3(vecColor.mV); + + float nValue; + if (pRlvObj->getModifierValue(ERlvLocalBhvrModifier::SphereMinAlpha, nValue)) + m_nMinAlpha = nValue; + if (pRlvObj->getModifierValue(ERlvLocalBhvrModifier::SphereMaxAlpha, nValue)) + m_nMaxAlpha = nValue; + + if (pRlvObj->getModifierValue(ERlvLocalBhvrModifier::SphereMinDist, nValue)) + m_nMinDistance = nValue; + if (pRlvObj->getModifierValue(ERlvLocalBhvrModifier::SphereMaxDist, nValue)) + m_nMaxDistance = nValue; + } +} + +RlvSphereEffect::~RlvSphereEffect() +{ +} + +// static +ERlvCmdRet RlvSphereEffect::onColorChanged(const LLUUID& idRlvObj, const boost::optional newValue) +{ + if (RlvSphereEffect* pEffect = dynamic_cast(LLVfxManager::instance().getEffect(idRlvObj))) + { + pEffect->m_Color = LLColor3((newValue) ? boost::get(newValue.value()).mV : c_SphereDefaultColor); + } + return RLV_RET_SUCCESS; +} + +// static +ERlvCmdRet RlvSphereEffect::onMinAlphaChanged(const LLUUID& idRlvObj, const boost::optional newValue) +{ + if (RlvSphereEffect* pEffect = dynamic_cast(LLVfxManager::instance().getEffect(idRlvObj))) + { + pEffect->m_nMinAlpha = (newValue) ? boost::get(newValue.value()) : c_SphereDefaultAlpha; + } + return RLV_RET_SUCCESS; +} + +// static +ERlvCmdRet RlvSphereEffect::onMaxAlphaChanged(const LLUUID& idRlvObj, const boost::optional newValue) +{ + if (RlvSphereEffect* pEffect = dynamic_cast(LLVfxManager::instance().getEffect(idRlvObj))) + { + pEffect->m_nMaxAlpha = (newValue) ? boost::get(newValue.value()) : c_SphereDefaultAlpha; + } + return RLV_RET_SUCCESS; +} + +// static +ERlvCmdRet RlvSphereEffect::onMinDistChanged(const LLUUID& idRlvObj, const boost::optional newValue) +{ + if (RlvSphereEffect* pEffect = dynamic_cast(LLVfxManager::instance().getEffect(idRlvObj))) + { + pEffect->m_nMinDistance = (newValue) ? boost::get(newValue.value()) : c_SphereDefaultDistance; + } + return RLV_RET_SUCCESS; +} + +// static +ERlvCmdRet RlvSphereEffect::onMaxDistChanged(const LLUUID& idRlvObj, const boost::optional newValue) +{ + if (RlvSphereEffect* pEffect = dynamic_cast(LLVfxManager::instance().getEffect(idRlvObj))) + { + pEffect->m_nMaxDistance = (newValue) ? boost::get(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(); +} + +// ==================================================================================== diff --git a/indra/newview/rlveffects.h b/indra/newview/rlveffects.h index 181187fe9d..86a6f3e7c4 100644 --- a/indra/newview/rlveffects.h +++ b/indra/newview/rlveffects.h @@ -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 newValue); static ERlvCmdRet onBlockTouchValueChanged(const LLUUID& idRlvObj, const boost::optional newValue); static ERlvCmdRet onColorValueChanged(const LLUUID& idRlvObj, const boost::optional 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 newValue); + static ERlvCmdRet onMinAlphaChanged(const LLUUID& idRlvObj, const boost::optional newValue); + static ERlvCmdRet onMaxAlphaChanged(const LLUUID& idRlvObj, const boost::optional newValue); + static ERlvCmdRet onMinDistChanged(const LLUUID& idRlvObj, const boost::optional newValue); + static ERlvCmdRet onMaxDistChanged(const LLUUID& idRlvObj, const boost::optional 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; +}; + +// ==================================================================================== diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index a89338d5f9..af44f0dd15 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -2059,6 +2059,21 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehavio LLVfxManager::instance().removeEffect(gRlvHandler.getCurrentObject()); } +// Handles: @setsphere=n|y +template<> template<> +ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) +{ + ERlvCmdRet eRet = RlvBehaviourGenericHandler::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[:]=n|y and @sendchannel_except[:]=n|y template<> template<> ERlvCmdRet RlvBehaviourSendChannelHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 21c5c164be..da441cfffc 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -215,19 +215,6 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(new RlvBehaviourProcessor("camzoommax", RlvBehaviourInfo::BHVR_DEPRECATED)); addEntry(new RlvBehaviourGenericToggleProcessor("camunlock", RlvBehaviourInfo::BHVR_SYNONYM | RlvBehaviourInfo::BHVR_DEPRECATED)); - // Effect: "vision spheres" - addEntry(new RlvBehaviourGenericProcessor("setsphere", RLV_BHVR_SETSPHERE, RlvBehaviourInfo::BHVR_EXPERIMENTAL)); - addModifier(new RlvForceGenericProcessor("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("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("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("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("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("setoverlay"); pSetOverlayBhvr->addModifier(ERlvLocalBhvrModifier::OverlayAlpha, typeid(float), "alpha", &RlvOverlayEffect::onAlphaValueChanged); @@ -237,6 +224,15 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(pSetOverlayBhvr); addEntry(new RlvForceProcessor("setoverlay_tween", RlvBehaviourInfo::BHVR_EXPERIMENTAL)); + // Sphere + RlvBehaviourInfo* pSetSphereBhvr = new RlvBehaviourProcessor("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 //