mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
lunatic/test/shadexfog.lua: add function create_brightpass_trans().
Also hook it up in the [;]+[F] menu. git-svn-id: https://svn.eduke32.com/eduke32@4479 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0c2776e7fc
commit
b9b0b3f79b
2 changed files with 45 additions and 3 deletions
|
@ -202,8 +202,8 @@ end
|
|||
|
||||
|
||||
local function check_colcomp(a)
|
||||
if (type(a) ~= "number" or not (a >= 0 and a <= 63)) then
|
||||
error("color component must be in the range [0 .. 63]", 3)
|
||||
if (type(a) ~= "number" or not (a >= 0 and a < 64)) then
|
||||
error("color component must be in the range [0 .. 64)", 3)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -340,7 +340,9 @@ end
|
|||
-- shadexfog.create_trans(startblendidx, func [, numtables [, fullbrightsOK]])
|
||||
--
|
||||
-- <func>: must be
|
||||
-- rr, gg, bb = f(r, g, b, R, G, B, level, numtables)
|
||||
-- rr, gg, bb = f(r,g,b, R,G,B, level, numtables)
|
||||
-- If reverse translucency bit clear, (r,g,b) is background and (R,G,B) is
|
||||
-- foreground (incoming).
|
||||
-- ('level' is the table index, from 1 to <numtables>)
|
||||
-- <numtables>: number of tables to create, from <startblendidx> on. Default: 1
|
||||
function shadexfog.create_trans(startblendidx, func, numtables, fullbrightsOK)
|
||||
|
@ -411,6 +413,22 @@ function shadexfog.create_additive_trans(startblendidx, numtables, fullbrightsOK
|
|||
)
|
||||
end
|
||||
|
||||
-- shadexfog.create_brightpass_trans(startblendidx [, numtables [, fullbrightsOK]])
|
||||
function shadexfog.create_brightpass_trans(startblendidx, numtables, fullbrightsOK)
|
||||
shadexfog.create_trans(
|
||||
startblendidx,
|
||||
|
||||
function(r,g,b, R,G,B, alpha, numtabs)
|
||||
local a = alpha/numtabs
|
||||
local F = 1 - min(a, (R+G+B) / (3*63))
|
||||
local f = 1 - F
|
||||
return f*r+F*R, f*g+F*G, f*b+F*B
|
||||
end,
|
||||
|
||||
numtables, fullbrightsOK
|
||||
)
|
||||
end
|
||||
|
||||
if (not ismapster32) then
|
||||
return shadexfog
|
||||
end
|
||||
|
@ -589,6 +607,30 @@ starting with the blending number <startbl>, with fractions
|
|||
]=]
|
||||
)
|
||||
|
||||
engine.registerMenuFunc(
|
||||
"Create bri.pass tr. tabs",
|
||||
CreateMenuFunction{
|
||||
[0] = shadexfog.create_brightpass_trans,
|
||||
{ "Starting blendnum", 1, 255 },
|
||||
{ "Number of blending tables", 32, 255 },
|
||||
{ "Fullbright result colors OK?", 0, 1, GNF_BOOL },
|
||||
},
|
||||
|
||||
formatHelp
|
||||
[=[
|
||||
<shadexfog.create_brightpass_trans(startbl [, numtabs [, fullbriOK]])>
|
||||
<____________________________________________________________________>
|
||||
|
||||
Creates <numtabs> blending tables of "brightpass" translucency,
|
||||
starting with the blending number <startbl>, with fractions
|
||||
|
||||
1/<numtables>, 2/<numtables> ... <numtables>/<numtables>.
|
||||
|
||||
<fullbriOK>: should fullbright color indices (>= 240) be permitted as
|
||||
the blending result of two color indices?
|
||||
]=]
|
||||
)
|
||||
|
||||
engine.registerMenuFunc(
|
||||
"Create base shade table",
|
||||
CreateMenuFunction{
|
||||
|
|
Loading…
Reference in a new issue