This commit is contained in:
2025-04-29 13:39:02 -05:00
commit 9cbb583982
2257 changed files with 77258 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
{
"name" : "Perspective",
"description" : "Applies a perspective distortion.",
"group" : "distort",
//"preview" : "preview/project.json",
"passes" :
[
{
"material" : "materials/effects/perspective.json"
}
],
"dependencies" :
[
"materials/effects/perspective.json",
"shaders/effects/perspective.frag",
"shaders/effects/perspective.vert"
]
}

View File

@@ -0,0 +1,13 @@
{
"passes" :
[
{
"blending" : "translucent",
"cullmode" : "nocull",
"depthtest" : "disabled",
"depthwrite" : "disabled",
"shader" : "genericimage2",
"textures" : [ "effectpreview" ]
}
]
}

View File

@@ -0,0 +1,6 @@
{
"clampuvs" : true,
"format" : "rgba8888",
"nomip" : true,
"nonpoweroftwo" : true
}

View File

@@ -0,0 +1,9 @@
{
"passes": [{
"shader": "effects/perspective",
"blending": "normal",
"depthtest": "disabled",
"depthwrite": "disabled",
"cullmode": "nocull"
}]
}

View File

@@ -0,0 +1,4 @@
{
"autosize" : true,
"material" : "materials/effectpreview.json"
}

View 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" : "preview",
"type" : "scene"
}

View File

@@ -0,0 +1,70 @@
{
"camera" :
{
"center" : "0.000 0.000 -1.000",
"eye" : "0.000 0.000 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",
"colorBlendMode" : 0,
"copybackground" : true,
"depth" : 1,
"effects" :
[
{
"file" : "effects/perspective/effect.json",
"passes" :
[
{
"combos" :
{
"MODE" : 1
},
"constantshadervalues" :
{
"Bottom" : -0.0099999997764825821,
"Left" : 0.029999999329447746,
"Right" : 0.31999999284744263,
"Top" : 0.28999999165534973
}
}
]
}
],
"id" : 38,
"image" : "models/effectpreview.json",
"name" : "",
"origin" : "112.329 121.871 0.000",
"parallaxDepth" : "1.000 1.000",
"scale" : "1.000 1.000 1.000",
"size" : "256.000 256.000",
"visible" : true
}
]
}

View File

@@ -0,0 +1,36 @@
// [COMBO] {"material":"Repeat","combo":"REPEAT","type":"options","default":1}
varying vec3 v_TexCoord;
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
uniform float g_Top; // {"material":"Top","default":1,"range":[-1,2]}
uniform float g_Bottom; // {"material":"Bottom","default":1,"range":[-1,2]}
uniform float g_Left; // {"material":"Left","default":1,"range":[-1,2]}
uniform float g_Right; // {"material":"Right","default":1,"range":[-1,2]}
void main() {
vec2 texCoord = v_TexCoord.xy / v_TexCoord.z;
#if MODE == 0
texCoord -= CAST2(0.5);
//texCoord.x += v_Perspective.x / v_TexCoord.x;
//texCoord.x *= 1.0 + (1.0 - v_TexCoord.y) * g_Top * (1.0 / (1.0 - v_TexCoord.y)) +
// v_TexCoord.y * g_Bottom;
//texCoord.y *= (1.0 - v_TexCoord.x) * g_Left +
// v_TexCoord.x * g_Right;
texCoord += CAST2(0.5);
#endif
#if REPEAT
texCoord = frac(texCoord);
#endif
gl_FragColor = texSample2D(g_Texture0, texCoord);
//gl_FragColor = vec4(v_TexCoord.xy, 0, 1);
}

View File

@@ -0,0 +1,100 @@
// [COMBO] {"material":"Mode","combo":"MODE","type":"options","default":0,"options":{"Vertex":1,"UV":0}}
#include "common.h"
uniform mat4 g_ModelViewProjectionMatrix;
uniform vec4 g_Texture0Resolution;
uniform float g_Top; // {"material":"Top","default":0,"range":[-0.49,0.49]}
uniform float g_Bottom; // {"material":"Bottom","default":0,"range":[-0.49,0.49]}
uniform float g_Left; // {"material":"Left","default":0,"range":[-0.49,0.49]}
uniform float g_Right; // {"material":"Right","default":0,"range":[-0.49,0.49]}
attribute vec3 a_Position;
attribute vec2 a_TexCoord;
varying vec3 v_TexCoord;
void main() {
vec3 position = a_Position;
v_TexCoord.xy = a_TexCoord;
v_TexCoord.z = 1.0;
#if MODE == 1
position.x += mix(g_Texture0Resolution.z * g_Top * mix(-1.0, 1.0, step(a_TexCoord.x, 0.5)),
g_Texture0Resolution.z * g_Bottom * mix(-1.0, 1.0, step(a_TexCoord.x, 0.5)),
step(0.5, a_TexCoord.y));
position.y += mix(g_Texture0Resolution.w * -g_Left * mix(-1.0, 1.0, step(a_TexCoord.y, 0.5)),
g_Texture0Resolution.w * -g_Right * mix(-1.0, 1.0, step(a_TexCoord.y, 0.5)),
step(0.5, a_TexCoord.x));
#endif
float p3x = g_Top;
float p3y = g_Left;
float p2x = 1 - g_Top;
float p2y = g_Right;
float p1x = 1 - g_Bottom;
float p1y = 1 - g_Right;
float p0x = g_Bottom;
float p0y = 1 - g_Left;
float ax = p2x - p0x;
float ay = p2y - p0y;
float bx = p3x - p1x;
float by = p3y - p1y;
float cross = ax * by - ay * bx;
//if (cross != 0) {
float cy = p0y - p1y;
float cx = p0x - p1x;
float s = (ax * cy - ay * cx) / cross;
//if (s > 0 && s < 1) {
float t = (bx * cy - by * cx) / cross;
//if (t > 0 && t < 1) {
float q0 = 1 / (1 - t);
float q1 = 1 / (1 - s);
float q2 = 1 / t;
float q3 = 1 / s;
float q = mix(
mix(q3, q2, a_TexCoord.x),
mix(q0, q1, a_TexCoord.x),
a_TexCoord.y
);
v_TexCoord.xy = a_TexCoord;
#if MODE == 0
v_TexCoord -= 0.5;
v_TexCoord.x *= 0.5 / (0.5 - mix(g_Top, g_Bottom, step(0.5, a_TexCoord.y)));
v_TexCoord.y *= 0.5 / (0.5 - mix(g_Left, g_Right, step(0.5, a_TexCoord.x)));
v_TexCoord += 0.5;
#endif
v_TexCoord.xy *= q;
v_TexCoord.z = q;
//}
//}
//}
gl_Position = mul(vec4(position, 1.0), g_ModelViewProjectionMatrix);
}

View File

@@ -0,0 +1,4 @@
{
"name": "FX Preview",
"type": "scene2d"
}