Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
1fd98d08
Commit
1fd98d08
authored
3 years ago
by
Kitty Barnett
Browse files
Options
Downloads
Patches
Plain Diff
Allow dynamic changes to effect priority
parent
70237de3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/newview/llvisualeffect.cpp
+14
-3
14 additions, 3 deletions
indra/newview/llvisualeffect.cpp
indra/newview/llvisualeffect.h
+6
-2
6 additions, 2 deletions
indra/newview/llvisualeffect.h
with
20 additions
and
5 deletions
indra/newview/llvisualeffect.cpp
+
14
−
3
View file @
1fd98d08
...
@@ -69,7 +69,6 @@ LLVector4 LLTweenableValueLerp<LLVector4>::get()
...
@@ -69,7 +69,6 @@ LLVector4 LLTweenableValueLerp<LLVector4>::get()
//
//
LLVfxManager
::
LLVfxManager
()
LLVfxManager
::
LLVfxManager
()
:
m_Effects
(
&
cmpEffect
)
{
{
}
}
...
@@ -81,7 +80,7 @@ bool LLVfxManager::addEffect(LLVisualEffect* pEffectInst)
...
@@ -81,7 +80,7 @@ bool LLVfxManager::addEffect(LLVisualEffect* pEffectInst)
if
(
m_Effects
.
end
()
!=
itEffect
)
if
(
m_Effects
.
end
()
!=
itEffect
)
return
false
;
return
false
;
m_Effects
.
insert
(
pEffectInst
);
m_Effects
.
insert
(
std
::
upper_bound
(
m_Effects
.
begin
(),
m_Effects
.
end
(),
pEffectInst
,
cmpEffect
),
pEffectInst
);
return
true
;
return
true
;
}
}
...
@@ -143,6 +142,18 @@ void LLVfxManager::runEffect(std::function<bool(const LLVisualEffect*)> predicat
...
@@ -143,6 +142,18 @@ void LLVfxManager::runEffect(std::function<bool(const LLVisualEffect*)> predicat
}
}
}
}
void
LLVfxManager
::
updateEffect
(
LLVisualEffect
*
pEffect
,
bool
fEnabled
,
U32
nPriority
)
{
llassert
(
m_Effects
.
end
()
!=
std
::
find
(
m_Effects
.
begin
(),
m_Effects
.
end
(),
pEffect
));
if
(
(
pEffect
->
getEnabled
()
!=
fEnabled
)
||
(
pEffect
->
getPriority
()
!=
nPriority
)
)
{
pEffect
->
setEnabled
(
fEnabled
);
pEffect
->
setPriority
(
nPriority
);
std
::
sort
(
m_Effects
.
begin
(),
m_Effects
.
end
(),
cmpEffect
);
}
}
// static
// static
bool
LLVfxManager
::
cmpEffect
(
const
LLVisualEffect
*
pLHS
,
const
LLVisualEffect
*
pRHS
)
bool
LLVfxManager
::
cmpEffect
(
const
LLVisualEffect
*
pLHS
,
const
LLVisualEffect
*
pRHS
)
{
{
...
@@ -150,7 +161,7 @@ bool LLVfxManager::cmpEffect(const LLVisualEffect* pLHS, const LLVisualEffect* p
...
@@ -150,7 +161,7 @@ bool LLVfxManager::cmpEffect(const LLVisualEffect* pLHS, const LLVisualEffect* p
{
{
// Sort by code, then priority, then memory address
// Sort by code, then priority, then memory address
return
(
pLHS
->
getCode
()
==
pRHS
->
getCode
())
?
(
pLHS
->
getPriority
()
==
pRHS
->
getPriority
()
?
pLHS
<
pRHS
return
(
pLHS
->
getCode
()
==
pRHS
->
getCode
())
?
(
pLHS
->
getPriority
()
==
pRHS
->
getPriority
()
?
pLHS
<
pRHS
:
pLHS
->
getPriority
()
<
pRHS
->
getPriority
())
:
pLHS
->
getPriority
()
>
pRHS
->
getPriority
())
:
pLHS
->
getCode
()
<
pRHS
->
getCode
();
:
pLHS
->
getCode
()
<
pRHS
->
getCode
();
}
}
return
(
pLHS
);
return
(
pLHS
);
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llvisualeffect.h
+
6
−
2
View file @
1fd98d08
...
@@ -71,6 +71,7 @@ struct LLShaderEffectParams : LLVisualEffectParams
...
@@ -71,6 +71,7 @@ struct LLShaderEffectParams : LLVisualEffectParams
class
LLVisualEffect
class
LLVisualEffect
{
{
friend
class
LLVfxManager
;
public:
public:
LLVisualEffect
(
LLUUID
id
,
EVisualEffect
eCode
,
EVisualEffectType
eType
)
LLVisualEffect
(
LLUUID
id
,
EVisualEffect
eCode
,
EVisualEffectType
eType
)
:
m_id
(
id
),
m_eCode
(
eCode
),
m_eType
(
eType
)
:
m_id
(
id
),
m_eCode
(
eCode
),
m_eType
(
eType
)
...
@@ -83,10 +84,12 @@ class LLVisualEffect
...
@@ -83,10 +84,12 @@ class LLVisualEffect
U32
getPriority
()
const
{
return
m_nPriority
;
}
U32
getPriority
()
const
{
return
m_nPriority
;
}
EVisualEffectType
getType
()
const
{
return
m_eType
;}
EVisualEffectType
getType
()
const
{
return
m_eType
;}
void
setEnabled
(
bool
enable
)
{
m_fEnabled
=
enable
;
}
void
setEnabled
(
bool
enable
)
{
m_fEnabled
=
enable
;
}
void
setPriority
(
U32
priority
)
{
m_nPriority
=
priority
;
}
virtual
void
run
(
const
LLVisualEffectParams
*
pParams
)
=
0
;
virtual
void
run
(
const
LLVisualEffectParams
*
pParams
)
=
0
;
protected
:
void
setPriority
(
U32
priority
)
{
m_nPriority
=
priority
;
}
/*
/*
* Member variables
* Member variables
*/
*/
...
@@ -172,6 +175,7 @@ class LLVfxManager : public LLSingleton<LLVfxManager>
...
@@ -172,6 +175,7 @@ class LLVfxManager : public LLSingleton<LLVfxManager>
template
<
typename
T
>
bool
removeEffect
(
const
LLUUID
&
idEffect
)
{
return
removeEffect
(
T
::
EffectCode
,
idEffect
);
}
template
<
typename
T
>
bool
removeEffect
(
const
LLUUID
&
idEffect
)
{
return
removeEffect
(
T
::
EffectCode
,
idEffect
);
}
void
runEffect
(
EVisualEffect
eCode
,
LLVisualEffectParams
*
pParams
=
nullptr
);
void
runEffect
(
EVisualEffect
eCode
,
LLVisualEffectParams
*
pParams
=
nullptr
);
void
runEffect
(
EVisualEffectType
eType
,
LLVisualEffectParams
*
pParams
=
nullptr
);
void
runEffect
(
EVisualEffectType
eType
,
LLVisualEffectParams
*
pParams
=
nullptr
);
void
updateEffect
(
LLVisualEffect
*
pEffect
,
bool
fEnabled
,
U32
nPriority
);
protected
:
protected
:
void
runEffect
(
std
::
function
<
bool
(
const
LLVisualEffect
*
)
>
fnFilter
,
LLVisualEffectParams
*
pParams
);
void
runEffect
(
std
::
function
<
bool
(
const
LLVisualEffect
*
)
>
fnFilter
,
LLVisualEffectParams
*
pParams
);
static
bool
cmpEffect
(
const
LLVisualEffect
*
pLHS
,
const
LLVisualEffect
*
pRHS
);
static
bool
cmpEffect
(
const
LLVisualEffect
*
pLHS
,
const
LLVisualEffect
*
pRHS
);
...
@@ -180,7 +184,7 @@ class LLVfxManager : public LLSingleton<LLVfxManager>
...
@@ -180,7 +184,7 @@ class LLVfxManager : public LLSingleton<LLVfxManager>
* Member variables
* Member variables
*/
*/
protected
:
protected
:
std
::
set
<
LLVisualEffect
*
,
decltype
(
&
cmpEffect
)
>
m_Effects
;
std
::
vector
<
LLVisualEffect
*>
m_Effects
;
};
};
// ============================================================================
// ============================================================================
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment