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
a19d7c92
Commit
a19d7c92
authored
6 years ago
by
andreykproductengine
Browse files
Options
Downloads
Patches
Plain Diff
temp fog
parent
b5a7874b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/lldrawpoolwater.cpp
+68
-3
68 additions, 3 deletions
indra/newview/lldrawpoolwater.cpp
with
68 additions
and
3 deletions
indra/newview/lldrawpoolwater.cpp
+
68
−
3
View file @
a19d7c92
...
...
@@ -59,6 +59,65 @@ BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE;
BOOL
LLDrawPoolWater
::
sNeedsDistortionUpdate
=
TRUE
;
F32
LLDrawPoolWater
::
sWaterFogEnd
=
0.
f
;
class
LLFastLn
{
public:
LLFastLn
()
{
mTable
[
0
]
=
0
;
for
(
S32
i
=
1
;
i
<
257
;
i
++
)
{
mTable
[
i
]
=
log
((
F32
)
i
);
}
}
F32
ln
(
F32
x
)
{
const
F32
OO_255
=
0.003921568627450980392156862745098
f
;
const
F32
LN_255
=
5.5412635451584261462455391880218
f
;
if
(
x
<
OO_255
)
{
return
log
(
x
);
}
else
if
(
x
<
1
)
{
x
*=
255.
f
;
S32
index
=
llfloor
(
x
);
F32
t
=
x
-
index
;
F32
low
=
mTable
[
index
];
F32
high
=
mTable
[
index
+
1
];
return
low
+
t
*
(
high
-
low
)
-
LN_255
;
}
else
if
(
x
<=
255
)
{
S32
index
=
llfloor
(
x
);
F32
t
=
x
-
index
;
F32
low
=
mTable
[
index
];
F32
high
=
mTable
[
index
+
1
];
return
low
+
t
*
(
high
-
low
);
}
else
{
return
log
(
x
);
}
}
F32
pow
(
F32
x
,
F32
y
)
{
return
(
F32
)
LL_FAST_EXP
(
y
*
ln
(
x
));
}
private
:
F32
mTable
[
257
];
// index 0 is unused
};
static
LLFastLn
gFastLn
;
LLDrawPoolWater
::
LLDrawPoolWater
()
:
LLFacePool
(
POOL_WATER
)
{
}
...
...
@@ -536,17 +595,23 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li
shader
->
uniform1f
(
LLShaderMgr
::
BLEND_FACTOR
,
blend_factor
);
F32
density
=
pwater
->
getWaterFogDensity
();
F32
density_2
=
gFastLn
.
pow
(
2.
f
,
density
);
shader
->
uniform3fv
(
LLShaderMgr
::
WATER_FOGCOLOR
,
1
,
pwater
->
getWaterFogColor
().
mV
);
shader
->
uniform1f
(
LLShaderMgr
::
WATER_FOGDENSITY
,
pwater
->
getWaterFogD
ensity
()
);
shader
->
uniform1f
(
LLShaderMgr
::
WATER_FOGDENSITY
,
d
ensity
_2
);
// bind reflection texture from RenderTarget
S32
screentex
=
shader
->
enableTexture
(
LLShaderMgr
::
WATER_SCREENTEX
);
gGL
.
getTexUnit
(
screentex
)
->
bind
(
&
gPipeline
.
mWaterDis
);
if
(
mShaderLevel
==
1
)
{
{
density
=
llclamp
(
density
,
0.
f
,
10.
f
);
density
/=
10.0
f
;
density
=
1.0
f
-
density
;
density
*=
density
*
density
;
LLColor4
fog_color
(
pwater
->
getWaterFogColor
(),
0.
f
);
fog_color
[
3
]
=
pwater
->
getWaterFogD
ensity
()
;
fog_color
[
3
]
=
d
ensity
;
shader
->
uniform4fv
(
LLShaderMgr
::
WATER_FOGCOLOR
,
1
,
fog_color
.
mV
);
}
...
...
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