-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.ppsl
97 lines (81 loc) · 1.96 KB
/
example.ppsl
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
Input:
shader {
//You can write multiple shaders with multiple versions. The engine should pick itself the highest supported on your platform.
//This will parse into #version 130
version 130;
//Name of the shader.
name color_shader;
//Attributes contains attributes and unforms that needs to be present in the shaders, if multiple shaders has the same names for uniforms they'll be combined.
attributes {
//Select vertex selects only vertex shaders.
select vertex {
in vec2 in_Position;
in vec2 in_Color;
out vec3 ex_Color;
}
//Select fragment selects only fragment shaders.
select fragment {
in vec3 ex_Color;
out vec4 gl_FragColor;
}
//Select total selects ALL shader types.
select total {
uniform float time;
}
}
vertex {
//Always returns vec4
//technique main is always added to the generated main.
//Additional techniques can be turned on and off by setting them in-engine.
technique main {
ex_Color = in_Color;
return vec4(in_Position, 0.0, 1.0);
}
}
fragment {
//Pre-attribute is added pre-attribute.
preattrib glsl {
precision highp float;
}
//Always return vec4
//technique main is always added to the generated main.
//Additional techniques can be turned on and off by setting them in-engine.
technique main {
return OtherFunction(ex_Color.xy);
}
//GLSL code.
glsl {
vec3 OtherFunction(vec2 input) {
return vec3(input, 1.0);
}
}
}
}
shader {
//Version total is code that works on all GLSL versions.
version total;
name color_shader;
}
OUTPUT:
vertex:
#version 130
in vec2 in_Position;
in vec3 in_Color;
out vec3 ex_Color;
INSERT_MAIN
vec4 color_shader_technique() {
ex_Color = in_Color;
return vec4(in_Position, 0.0, 1.0);
}
fragment:
#version 130
precision highp float;
in vec3 ex_Color;
out vec4 gl_FragColor;
INSERT_MAIN
vec4 color_shader_technique() {
return OtherFunction(ex_Color.xy);
}
vec3 color_shader_OtherFunction(vec2 input) {
return vec3(input, 1.0);
}