stuff
This commit is contained in:
20
modules/wallpaper-engine/effects/blend/effect.json
Normal file
20
modules/wallpaper-engine/effects/blend/effect.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version" : 1,
|
||||
"replacementkey" : "blend",
|
||||
"name" : "ui_editor_effect_blend_title",
|
||||
"description" : "ui_editor_effect_blend_description",
|
||||
"group" : "colorize",
|
||||
"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/blend.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/blend.json",
|
||||
"shaders/effects/blend.frag",
|
||||
"shaders/effects/blend.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blend",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name" : "Blend",
|
||||
"description" : "Blend two images with various modes.",
|
||||
"group" : "image",
|
||||
//"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/blend.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/blend.json",
|
||||
"shaders/effects/blend.frag",
|
||||
"shaders/effects/blend.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name" : "Opacity",
|
||||
"description" : "Adds an opacity mask to the image.",
|
||||
"group" : "image",
|
||||
"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/opacity.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/opacity.json",
|
||||
"shaders/effects/opacity.frag",
|
||||
"shaders/effects/opacity.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name" : "Scroll",
|
||||
"description" : "Scrolls the image horizontally or vertically.",
|
||||
"group" : "image",
|
||||
"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/scroll.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/scroll.json",
|
||||
"shaders/effects/scroll.frag",
|
||||
"shaders/effects/scroll.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name" : "Spin",
|
||||
"description" : "Spin the image.",
|
||||
"group" : "image",
|
||||
"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/spin.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/spin.json",
|
||||
"shaders/effects/spin.frag",
|
||||
"shaders/effects/spin.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name" : "Transform",
|
||||
"description" : "Apply scaling, rotation and offsets to the image.",
|
||||
"group" : "image",
|
||||
"preview" : "preview/project.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"material" : "materials/effects/transform.json"
|
||||
}
|
||||
],
|
||||
"dependencies" :
|
||||
[
|
||||
"materials/effects/transform.json",
|
||||
"shaders/effects/transform.frag",
|
||||
"shaders/effects/transform.vert"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"blending" : "translucent",
|
||||
"cullmode" : "nocull",
|
||||
"depthtest" : "disabled",
|
||||
"depthwrite" : "disabled",
|
||||
"shader" : "genericimage2",
|
||||
"textures" : [ "effectpreview" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/blend",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/opacity",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/scroll",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/spin",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"passes": [{
|
||||
"shader": "effects/transform",
|
||||
"blending": "normal",
|
||||
"depthtest": "disabled",
|
||||
"depthwrite": "disabled",
|
||||
"cullmode": "nocull"
|
||||
}]
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"format" : "rgba8888",
|
||||
"nomip" : true,
|
||||
"nonpoweroftwo" : true
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"autosize" : true,
|
||||
"material" : "materials/effectpreview.json"
|
||||
}
|
||||
18
modules/wallpaper-engine/effects/blend/preview/project.json
Normal file
18
modules/wallpaper-engine/effects/blend/preview/project.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"file" : "scene.json",
|
||||
"general" :
|
||||
{
|
||||
"properties" :
|
||||
{
|
||||
"schemecolor" :
|
||||
{
|
||||
"order" : 0,
|
||||
"text" : "ui_browse_properties_scheme_color",
|
||||
"type" : "color",
|
||||
"value" : "0 0 0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"title" : "previewblend",
|
||||
"type" : "scene"
|
||||
}
|
||||
115
modules/wallpaper-engine/effects/blend/preview/scene.json
Normal file
115
modules/wallpaper-engine/effects/blend/preview/scene.json
Normal file
@@ -0,0 +1,115 @@
|
||||
{
|
||||
"camera" :
|
||||
{
|
||||
"center" : "-121.595 -15.576 -1.000",
|
||||
"eye" : "-121.595 -15.576 0.000",
|
||||
"up" : "0.000 1.000 0.000"
|
||||
},
|
||||
"general" :
|
||||
{
|
||||
"ambientcolor" : "0.3 0.3 0.3",
|
||||
"bloom" : false,
|
||||
"bloomstrength" : 2,
|
||||
"bloomthreshold" : 0.64999997615814209,
|
||||
"cameraparallax" : false,
|
||||
"cameraparallaxamount" : 0.5,
|
||||
"cameraparallaxdelay" : 0.10000000149011612,
|
||||
"cameraparallaxmouseinfluence" : 0,
|
||||
"camerapreview" : true,
|
||||
"camerashake" : false,
|
||||
"camerashakeamplitude" : 0.5,
|
||||
"camerashakeroughness" : 1,
|
||||
"camerashakespeed" : 3,
|
||||
"clearcolor" : "0.7 0.7 0.7",
|
||||
"orthogonalprojection" :
|
||||
{
|
||||
"height" : 256,
|
||||
"width" : 256
|
||||
},
|
||||
"skylightcolor" : "0.3 0.3 0.3"
|
||||
},
|
||||
"objects" :
|
||||
[
|
||||
{
|
||||
"angles" : "0.000 0.000 0.000",
|
||||
"dependencies" : [ 15 ],
|
||||
"depth" : 1,
|
||||
"effects" :
|
||||
[
|
||||
{
|
||||
"file" : "effects/blend/effect.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"combos" :
|
||||
{
|
||||
"BLENDMODE" : 23
|
||||
},
|
||||
"constantshadervalues" : null,
|
||||
"textures" : [ null, "_rt_imageLayerComposite_15_a" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"id" : 38,
|
||||
"image" : "models/effectpreview.json",
|
||||
"name" : "",
|
||||
"origin" : "128.000 128.000 0.000",
|
||||
"scale" : "1.000 1.000 1.000"
|
||||
},
|
||||
{
|
||||
"angles" : "0.000 0.000 0.000",
|
||||
"depth" : 1,
|
||||
"effects" :
|
||||
[
|
||||
{
|
||||
"file" : "effects/transform/effect.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"combos" :
|
||||
{
|
||||
"CLAMP" : 1,
|
||||
"MODE" : 0
|
||||
},
|
||||
"constantshadervalues" :
|
||||
{
|
||||
"Angle" : 0,
|
||||
"Scale" : "3 3"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"file" : "effects/spin/effect.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"combos" :
|
||||
{
|
||||
"MODE" : 0
|
||||
},
|
||||
"constantshadervalues" : null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"file" : "effects/opacity/effect.json",
|
||||
"passes" :
|
||||
[
|
||||
{
|
||||
"combos" : null,
|
||||
"constantshadervalues" : null,
|
||||
"textures" : [ null, "masks/opacity_mask_ee0d9bbc6d0516b8583c8fb3e841485c0b7ec4e8" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"id" : 15,
|
||||
"image" : "models/effectpreview.json",
|
||||
"name" : "effectpreview",
|
||||
"origin" : "-204.142 136.225 0.000",
|
||||
"scale" : "1.000 1.000 1.000"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":2}
|
||||
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"Color mask","mode":"rgbmask","default":"util/white"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
vec4 mask = texSample2D(g_Texture1, v_TexCoord.zw);
|
||||
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, mask.rgb, mask.a);
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture1Resolution;
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
|
||||
v_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"Mask","mode":"opacitymask","default":"util/white"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
|
||||
albedo.a *= mask;
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture1Resolution;
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
|
||||
v_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
varying vec2 v_Scroll;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
void main() {
|
||||
vec2 texCoord = frac(v_TexCoord + v_Scroll);
|
||||
gl_FragColor = texSample2D(g_Texture0, texCoord);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform float g_Time;
|
||||
|
||||
uniform float g_ScrollX; // {"material":"Speed X","default":0.2,"range":[-2,2]}
|
||||
uniform float g_ScrollY; // {"material":"Speed Y","default":0.2,"range":[-2,2]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
varying vec2 v_Scroll;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord = a_TexCoord;
|
||||
|
||||
vec2 scroll = vec2(g_ScrollX, g_ScrollY);
|
||||
scroll = sign(scroll) * pow(vec2(g_ScrollX, g_ScrollY), CAST2(2.0));
|
||||
v_Scroll = scroll * g_Time;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
// [COMBO] {"material":"Repeat","combo":"CLAMP","type":"options","default":1}
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
void main() {
|
||||
vec2 texCoord = v_TexCoord;
|
||||
#if CLAMP
|
||||
texCoord = frac(texCoord);
|
||||
#endif
|
||||
gl_FragColor = texSample2D(g_Texture0, texCoord);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
// [COMBO] {"material":"Mode","combo":"MODE","type":"options","default":0,"options":{"Vertex":1,"UV":0}}
|
||||
|
||||
#include "common.h"
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform float g_Time;
|
||||
|
||||
uniform float g_Speed; // {"material":"Speed","default":1.0,"range":[-5,5]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
|
||||
vec3 position = a_Position;
|
||||
#if MODE == 1
|
||||
position.xy = rotateVec2(position.xy - CAST2(0.5), g_Speed * g_Time) + CAST2(0.5);
|
||||
#endif
|
||||
gl_Position = mul(vec4(position, 1.0), g_ModelViewProjectionMatrix);
|
||||
|
||||
v_TexCoord = a_TexCoord;
|
||||
|
||||
#if MODE == 0
|
||||
v_TexCoord = rotateVec2(v_TexCoord - CAST2(0.5), g_Speed * g_Time) + CAST2(0.5);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
// [COMBO] {"material":"Repeat","combo":"CLAMP","type":"options","default":0}
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
void main() {
|
||||
vec2 texCoord = v_TexCoord;
|
||||
#if CLAMP
|
||||
texCoord = frac(texCoord);
|
||||
#endif
|
||||
gl_FragColor = texSample2D(g_Texture0, texCoord);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
// [COMBO] {"material":"Mode","combo":"MODE","type":"options","default":0,"options":{"Vertex":1,"UV":0}}
|
||||
|
||||
#include "common.h"
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
|
||||
uniform vec2 g_Offset; // {"material":"Offset","default":"0 0"}
|
||||
uniform vec2 g_Scale; // {"material":"Scale","default":"1 1"}
|
||||
uniform float g_Direction; // {"material":"Angle","default":0,"range":[0,6.28]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
vec2 applyFx(vec2 v) {
|
||||
v = rotateVec2(v - CAST2(0.5), g_Direction);
|
||||
return (v + g_Offset) * g_Scale + CAST2(0.5);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec3 position = a_Position;
|
||||
#if MODE == 1
|
||||
position.xy = applyFx(position.xy);
|
||||
#endif
|
||||
gl_Position = mul(vec4(position, 1.0), g_ModelViewProjectionMatrix);
|
||||
|
||||
v_TexCoord = a_TexCoord;
|
||||
|
||||
#if MODE == 0
|
||||
v_TexCoord = applyFx(v_TexCoord);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "FX Preview",
|
||||
"type": "scene2d"
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":2}
|
||||
// [COMBO] {"material":"ui_editor_properties_transform","combo":"TRANSFORMUV","type":"options","default":0}
|
||||
// [COMBO] {"material":"ui_editor_properties_transform_repeat","combo":"TRANSFORMREPEAT","type":"options","default":0,"options":{"ui_editor_properties_clip":0,"ui_editor_properties_repeat":1,"ui_editor_properties_clamp_uvs":2},"require":{"TRANSFORMUV":1}}
|
||||
// [COMBO] {"material":"ui_editor_properties_write_alpha","combo":"WRITEALPHA","type":"options","default":0}
|
||||
// [COMBO] {"material":"ui_editor_properties_number_of_textures","combo":"NUMBLENDTEXTURES","type":"options","default":1,"options":{"1":1,"2":2,"3":3,"4":4,"5":5,"6":6}}
|
||||
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
#if NUMBLENDTEXTURES >= 2
|
||||
varying vec4 v_TexCoord23;
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 4
|
||||
varying vec4 v_TexCoord45;
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 6
|
||||
varying vec2 v_TexCoord6;
|
||||
#endif
|
||||
|
||||
uniform float g_Multiply; // {"material":"multiply","label":"ui_editor_properties_blend_amount","default":1,"range":[0.0, 2.0]}
|
||||
uniform float g_Multiply2; // {"material":"multiply2","label":"ui_editor_properties_blend_amount_2","default":1,"range":[0.0, 2.0]}
|
||||
uniform float g_Multiply3; // {"material":"multiply3","label":"ui_editor_properties_blend_amount_3","default":1,"range":[0.0, 2.0]}
|
||||
uniform float g_Multiply4; // {"material":"multiply4","label":"ui_editor_properties_blend_amount_4","default":1,"range":[0.0, 2.0]}
|
||||
uniform float g_Multiply5; // {"material":"multiply5","label":"ui_editor_properties_blend_amount_5","default":1,"range":[0.0, 2.0]}
|
||||
uniform float g_Multiply6; // {"material":"multiply6","label":"ui_editor_properties_blend_amount_6","default":1,"range":[0.0, 2.0]}
|
||||
uniform float g_AlphaMultiply; // {"material":"alpha","label":"ui_editor_properties_alpha","default":1,"range":[0.0, 1.0]}
|
||||
|
||||
#if OPACITYMASK == 1
|
||||
varying vec2 v_TexCoordOpacity;
|
||||
#endif
|
||||
|
||||
uniform sampler2D g_Texture0; // {"hidden":true}
|
||||
uniform sampler2D g_Texture7; // {"label":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"OPACITYMASK","paintdefaultcolor":"0 0 0 1"}
|
||||
uniform sampler2D g_Texture1; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
|
||||
|
||||
#if NUMBLENDTEXTURES >= 2
|
||||
uniform sampler2D g_Texture2; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 3
|
||||
uniform sampler2D g_Texture3; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 4
|
||||
uniform sampler2D g_Texture4; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 5
|
||||
uniform sampler2D g_Texture5; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 6
|
||||
uniform sampler2D g_Texture6; // {"label":"ui_editor_properties_blend_texture","mode":"rgbmask","default":"util/white"}
|
||||
#endif
|
||||
|
||||
float GetUVBlend(vec2 uv)
|
||||
{
|
||||
#if TRANSFORMUV == 1 && TRANSFORMREPEAT == 0
|
||||
return step(0.99, dot(step(CAST2(0.0), uv) * step(uv, CAST2(1.0)), CAST2(0.5)));
|
||||
#endif
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
|
||||
vec2 blendUV = v_TexCoord.zw;
|
||||
#if TRANSFORMUV == 1 && TRANSFORMREPEAT == 1
|
||||
blendUV = frac(blendUV);
|
||||
#endif
|
||||
|
||||
vec4 blendColors = texSample2D(g_Texture1, blendUV);
|
||||
float blend = 1.0;
|
||||
|
||||
#if OPACITYMASK == 1
|
||||
blend *= texSample2D(g_Texture7, v_TexCoordOpacity).r;
|
||||
#endif
|
||||
|
||||
float blendAlpha = GetUVBlend(blendUV) * blend * g_Multiply * blendColors.a;
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, blendAlpha);
|
||||
|
||||
#if NUMBLENDTEXTURES >= 2
|
||||
blendUV = frac(v_TexCoord23.xy);
|
||||
blendColors = texSample2D(g_Texture2, blendUV);
|
||||
blendAlpha *= blendColors.a * g_Multiply2;
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply2 * blendColors.a);
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 3
|
||||
blendUV = frac(v_TexCoord23.zw);
|
||||
blendColors = texSample2D(g_Texture3, blendUV);
|
||||
blendAlpha *= blendColors.a * g_Multiply3;
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply3 * blendColors.a);
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 4
|
||||
blendUV = frac(v_TexCoord45.xy);
|
||||
blendColors = texSample2D(g_Texture4, blendUV);
|
||||
blendAlpha *= blendColors.a * g_Multiply4;
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply4 * blendColors.a);
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 5
|
||||
blendUV = frac(v_TexCoord45.zw);
|
||||
blendColors = texSample2D(g_Texture5, blendUV);
|
||||
blendAlpha *= blendColors.a * g_Multiply5;
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply5 * blendColors.a);
|
||||
#endif
|
||||
|
||||
#if NUMBLENDTEXTURES >= 6
|
||||
blendUV = frac(v_TexCoord6.xy);
|
||||
blendColors = texSample2D(g_Texture6, blendUV);
|
||||
blendAlpha *= blendColors.a * g_Multiply6;
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, blendColors.rgb, GetUVBlend(blendUV) * blend * g_Multiply6 * blendColors.a);
|
||||
#endif
|
||||
|
||||
|
||||
#if WRITEALPHA
|
||||
albedo.a = blendColors.a * g_AlphaMultiply;
|
||||
#endif
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture1Resolution;
|
||||
uniform vec4 g_Texture2Resolution;
|
||||
uniform vec4 g_Texture3Resolution;
|
||||
uniform vec4 g_Texture4Resolution;
|
||||
uniform vec4 g_Texture5Resolution;
|
||||
uniform vec4 g_Texture6Resolution;
|
||||
|
||||
#if OPACITYMASK == 1
|
||||
uniform vec4 g_Texture7Resolution;
|
||||
|
||||
varying vec2 v_TexCoordOpacity;
|
||||
#endif
|
||||
|
||||
#if TRANSFORMUV == 1
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
#endif
|
||||
|
||||
uniform vec2 g_BlendOffset; // {"material":"blendoffset","label":"ui_editor_properties_offset","default":"0 0"}
|
||||
uniform float g_BlendAngle; // {"material":"blendangle","label":"ui_editor_properties_angle","default":0,"range":[0,6.28]}
|
||||
uniform float g_BlendScale; // {"material":"blendscale","label":"ui_editor_properties_scale","default":1,"range":[0.01,2]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
#if NUMBLENDTEXTURES >= 2
|
||||
varying vec4 v_TexCoord23;
|
||||
#endif
|
||||
#if NUMBLENDTEXTURES >= 4
|
||||
varying vec4 v_TexCoord45;
|
||||
#endif
|
||||
#if NUMBLENDTEXTURES >= 6
|
||||
varying vec2 v_TexCoord6;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
|
||||
v_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
|
||||
#if NUMBLENDTEXTURES >= 2
|
||||
v_TexCoord23.xy = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
|
||||
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
|
||||
v_TexCoord23.zw = CAST2(0.0);
|
||||
#endif
|
||||
#if NUMBLENDTEXTURES >= 3
|
||||
v_TexCoord23.zw = vec2(v_TexCoord.x * g_Texture3Resolution.z / g_Texture3Resolution.x,
|
||||
v_TexCoord.y * g_Texture3Resolution.w / g_Texture3Resolution.y);
|
||||
#endif
|
||||
#if NUMBLENDTEXTURES >= 4
|
||||
v_TexCoord45.xy = vec2(v_TexCoord.x * g_Texture4Resolution.z / g_Texture4Resolution.x,
|
||||
v_TexCoord.y * g_Texture4Resolution.w / g_Texture4Resolution.y);
|
||||
v_TexCoord45.zw = CAST2(0.0);
|
||||
#endif
|
||||
#if NUMBLENDTEXTURES >= 5
|
||||
v_TexCoord45.zw = vec2(v_TexCoord.x * g_Texture5Resolution.z / g_Texture5Resolution.x,
|
||||
v_TexCoord.y * g_Texture5Resolution.w / g_Texture5Resolution.y);
|
||||
#endif
|
||||
#if NUMBLENDTEXTURES >= 6
|
||||
v_TexCoord6.xy = vec2(v_TexCoord.x * g_Texture6Resolution.z / g_Texture6Resolution.x,
|
||||
v_TexCoord.y * g_Texture6Resolution.w / g_Texture6Resolution.y);
|
||||
#endif
|
||||
|
||||
#if TRANSFORMUV == 1
|
||||
vec2 scaleA = g_Texture0Resolution.zw / g_Texture1Resolution.zw;
|
||||
//vec2 scaleB = g_Texture0Resolution.wz / g_Texture1Resolution.wz;
|
||||
//vec2 dir = abs(rotateVec2(vec2(1, 0), g_BlendAngle));
|
||||
|
||||
v_TexCoord.zw -= (g_BlendOffset - (g_Texture0Resolution.zw - g_Texture1Resolution.zw) * 0.5) / g_Texture0Resolution.zw;
|
||||
|
||||
v_TexCoord.zw -= CAST2(0.5);
|
||||
v_TexCoord.zw = rotateVec2(v_TexCoord.zw, g_BlendAngle);
|
||||
// Too tired now to get this right, maybe look later at this again
|
||||
//v_TexCoord.zw *= scaleA * dot(dir, vec2(1, 0)) + scaleB * dot(dir, vec2(0, 1));
|
||||
//v_TexCoord.zw *= mix(scaleA, scaleB, abs(sin(g_BlendAngle))) / g_BlendScale;
|
||||
v_TexCoord.zw *= scaleA / g_BlendScale;
|
||||
//v_TexCoord.zw *= scaleA * abs(cos(g_BlendAngle)) + scaleB * abs(sin(g_BlendAngle));
|
||||
|
||||
v_TexCoord.zw += CAST2(0.5);
|
||||
#endif
|
||||
|
||||
#if OPACITYMASK == 1
|
||||
v_TexCoordOpacity = vec2(v_TexCoord.x * g_Texture7Resolution.z / g_Texture7Resolution.x,
|
||||
v_TexCoord.y * g_Texture7Resolution.w / g_Texture7Resolution.y);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user