aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorFoghrye4 <foghrye4@gmail.com>2016-11-14 18:09:59 +0400
committerZeno- <kde.psych@gmail.com>2016-11-15 00:09:59 +1000
commit93e3555eae2deaeca69ee252cfa9cc9c3e0e49ef (patch)
tree9b9b665b97c01f0b281652a85088b336cc4cefde /builtin
parent649448a2a91fbf3e944b2f2e739f4e2292af1df0 (diff)
downloadminetest-93e3555eae2deaeca69ee252cfa9cc9c3e0e49ef.tar.gz
minetest-93e3555eae2deaeca69ee252cfa9cc9c3e0e49ef.tar.bz2
minetest-93e3555eae2deaeca69ee252cfa9cc9c3e0e49ef.zip
Adding particle blend, glow and animation (#4705)
Diffstat (limited to 'builtin')
-rw-r--r--builtin/common/misc_helpers.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index c2dc7514d..a495058d9 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -238,6 +238,43 @@ function math.sign(x, tolerance)
end
--------------------------------------------------------------------------------
+-- Video enums and pack function
+
+-- E_BLEND_FACTOR
+minetest.ebf = {
+ zero = 0, -- src & dest (0, 0, 0, 0)
+ one = 1, -- src & dest (1, 1, 1, 1)
+ dst_color = 2, -- src (destR, destG, destB, destA)
+ one_minus_dst_color = 3, -- src (1-destR, 1-destG, 1-destB, 1-destA)
+ src_color = 4, -- dest (srcR, srcG, srcB, srcA)
+ one_minus_src_color = 5, -- dest (1-srcR, 1-srcG, 1-srcB, 1-srcA)
+ src_alpha = 6, -- src & dest (srcA, srcA, srcA, srcA)
+ one_minus_src_alpha = 7, -- src & dest (1-srcA, 1-srcA, 1-srcA, 1-srcA)
+ dst_alpha = 8, -- src & dest (destA, destA, destA, destA)
+ one_minus_dst_alpha = 9, -- src & dest (1-destA, 1-destA, 1-destA, 1-destA)
+ src_alpha_saturate = 10,-- src (min(srcA, 1-destA), idem, ...)
+}
+
+-- E_MODULATE_FUNC
+minetest.emfn = {
+ modulate_1x = 1,
+ modulate_2x = 2,
+ modulate_4x = 4,
+}
+
+-- E_ALPHA_SOURCE
+minetest.eas = {
+ none = 0,
+ vertex_color = 1,
+ texture = 2,
+}
+
+-- BlendFunc = source * sourceFactor + dest * destFactor
+function minetest.pack_texture_blend_func(srcFact, dstFact, modulate, alphaSource)
+ return alphaSource * 4096 + modulate * 256 + srcFact * 16 + dstFact
+end
+
+--------------------------------------------------------------------------------
function get_last_folder(text,count)
local parts = text:split(DIR_DELIM)