Last active
February 15, 2024 02:50
-
-
Save niquedegraaff/a241bd736a75c3acb900 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------------------ | |
-- S3D TRANSPARENCY.LUA - By Nique de Graaff -- | |
-- You MUST install luaforwindows in the default installation folder for -- | |
-- this to work! Then run this in the ILives Reader on your sc4model -- | |
------------------------------------------------------------------------------------ | |
-- This script will: -- | |
-- Enable framebuffer blending -- | |
-- Set Alpha Func to "Always" -- | |
-- Set Src Blend to "Source alpha" -- | |
-- Set Dest Blend to "one minus source alpha" -- | |
------------------------------------------------------------------------------------ | |
dir = "C:/Program Files (x86)/Lua/5.1/clibs" | |
package.cpath = dir.."?.dll" | |
require("bit") | |
function reader.main (this) | |
pos = reader:entries_GetHeadPosition() | |
while pos ~= 0 do | |
entry,pos = reader:entries_GetNext(pos) | |
flag = reader:entry_GetFlag(entry) | |
if (flag == 2) then | |
s3d = reader:s3d_Decode(entry) | |
block = reader:s3d_GetBlock(s3d, 4, 0) | |
s3dpos = reader:s3dtext_GetHeadPosition(block) | |
while s3dpos ~= 0 do | |
s3dtext, s3dpos = reader:s3dtext_GetNext(block,s3dpos) | |
flags, alphafunc, depthfunc,srcBlendFactor,dstBlendFactor,alphaThreshold = reader:s3dmat_GetInfo(block) | |
flags = bit.bor(flags, 0x0010) | |
alphafunc = 7 | |
srcBlendFactor = 4 | |
dstBlendFactor = 5 | |
reader:s3dmat_SetInfo(block, flags, alphafunc, depthfunc,srcBlendFactor, dstBlendFactor,alphaThreshold) | |
end | |
reader:s3d_SetBlock(s3d, 4, 0, block) | |
reader:s3d_Encode(entry,s3d) | |
end | |
end | |
io.write("\nDone!") | |
reader:refresh() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment