diff options
author | b1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-07-03 08:37:09 +0000 |
---|---|---|
committer | b1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-07-03 08:37:09 +0000 |
commit | 7050f9d54fc4603a952c12efbab2e3331413865f (patch) | |
tree | b809fc3683773d686f30da4526a875a9af2cdef7 | |
parent | 9f6e3caffa80ce75ef845e30094a3baa568bab12 (diff) | |
download | usdx-7050f9d54fc4603a952c12efbab2e3331413865f.tar.gz usdx-7050f9d54fc4603a952c12efbab2e3331413865f.tar.xz usdx-7050f9d54fc4603a952c12efbab2e3331413865f.zip |
some tweaking of transparency handling for PNGs to make it look more as expected
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@272 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UTexture.pas | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index da603ec9..275f0748 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -206,6 +206,7 @@ var TempA: integer;
Error: integer;
SkipX: integer;
+ myAlpha: Real;
begin
Log.BenchmarkStart(4);
Mipmapping := true;
@@ -399,7 +400,16 @@ begin TextureD32[Pet*TexNewW + Pet2+1, 3] := Pix div (256*256);
// transparent png hack start (part 2 of 2)
if (Format = 'PNG') and (length(TextureAlpha) <> 0) then begin
- TextureD32[Pet*TexNewW+Pet2+1,4]:=TextureAlpha[Pet*TexOrygW+Pet2];
+ myAlpha:=TextureAlpha[Pet*TexOrygW+Pet2];
+
+ // the following calculations tweak transparency so that it really looks transparent
+ myAlpha:=myAlpha-75;
+ if myAlpha < 0 then myAlpha:=0;
+ myAlpha:=myAlpha/180;
+ myAlpha:=myAlpha*myAlpha*myAlpha;
+ myAlpha:=myAlpha*255;
+
+ TextureD32[Pet*TexNewW+Pet2+1,4]:=floor(myAlpha);
end else
// transparent png hack end
TextureD32[Pet*TexNewW + Pet2+1, 4] := 255;
|