-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRS_AntiAliasingPicture.rb
64 lines (61 loc) · 1.73 KB
/
RS_AntiAliasingPicture.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#================================================================
# The MIT License
# Copyright (c) 2020 biud436
# ---------------------------------------------------------------
# Free for commercial and non commercial use.
#================================================================
# ======================================================================
# Name : Anti-Aliasing Picture
# Author : biud436
# Desc :
# This script allows you to apply the anti-aliasing to your picture.
#
# Notice that this script must require below stuff.
#
# DirectX Implementation of RGSS3
# Link : https://forums.rpgmakerweb.com/index.php?threads/rgd-directx-implementation-of-rgss3.95228/
#
# ======================================================================
Graphics.add_shader("
texture my_tex;
sampler2D mySampler = sampler_state
{
Texture = <my_tex>;
AddressU = Wrap;
AddressV = Wrap;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
};
PS_OUTPUT PS_AntiAliasing(float4 color : COLOR0,
float2 tex : TEXCOORD0) : COLOR
{
float4 res = tex2D(mySampler, tex);
return GetOutput(res * color);
}", "
pass AntiAliasing
{
AlphaBlendEnable = true;
SeparateAlphaBlendEnable = false;
BlendOp = MAX;
SrcBlend = ONE;
DestBlend = ONE;
PixelShader = compile ps_2_0 PS_AntiAliasing();
}
")
class Sprite_Picture < Sprite
alias iuiu_initialize initialize
def initialize(viewport, picture)
iuiu_initialize(viewport, picture)
self.effect_name = "AntiAliasing"
end
def update_bitmap
if @picture.name.empty?
self.bitmap = nil
else
self.bitmap = Cache.picture(@picture.name)
bitmap = Cache.picture(@picture.name)
self.set_effect_param("my_tex", bitmap)
end
end
end