-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathOutputShadow.lua
121 lines (63 loc) · 1.57 KB
/
OutputShadow.lua
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
module("shadows.OutputShadow", package.seeall)
Object = require("shadows.Object")
OutputShadow = setmetatable( {}, Object )
OutputShadow.__index = OutputShadow
OutputShadow.__type = "OutputShadow"
OutputShadow.Type = "draw"
function OutputShadow:new(Type, Mode, ...)
local self = setmetatable( {}, OutputShadow )
self.ShaderValue = {}
self:SetType(Type)
self:SetMode(Mode)
self:Pack(...)
return self
end
function OutputShadow:Draw(Layer)
if not self.Layer or self.Layer == Layer then
if self.Shader then
for Variable, Value in pairs(self.ShaderValue) do
self.Shader:send(Variable, Value)
end
end
love.graphics.setShader(self.Shader)
if self.Mode then
love.graphics[self.Type](self.Mode, self:UnPack())
else
love.graphics[self.Type](self:UnPack())
end
end
end
function OutputShadow:SetShader(Shader)
self.Shader = Shader
end
function OutputShadow:GetShader()
return self.Shader
end
function OutputShadow:SendShader(Variable, Value)
self.ShaderValue[Variable] = Value
end
function OutputShadow:SetType(Type)
self.Type = Type
end
function OutputShadow:GetType()
return self.Type
end
function OutputShadow:Pack(...)
self.Input = {...}
end
function OutputShadow:UnPack()
return unpack(self.Input)
end
function OutputShadow:SetMode(Mode)
self.Mode = Mode
end
function OutputShadow:GetMode()
return self.Mode
end
function OutputShadow:SetLayer(Layer)
self.Layer = Layer
end
function OutputShadow:GetLayer()
return self.Layer
end
return OutputShadow