@thi.ng/webgl 6.6.11 → 6.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/api/blend.js +36 -32
- package/api/buffers.js +0 -1
- package/api/canvas.js +0 -1
- package/api/ext.js +12 -9
- package/api/glsl.js +0 -1
- package/api/material.js +0 -1
- package/api/model.js +13 -10
- package/api/multipass.js +0 -1
- package/api/shader.js +4 -1
- package/api/stencil.js +26 -22
- package/api/texture.js +589 -252
- package/buffer.js +145 -127
- package/canvas.js +53 -61
- package/checks.js +6 -6
- package/draw.js +84 -69
- package/error.js +7 -3
- package/fbo.js +95 -90
- package/geo/cube.js +28 -26
- package/geo/quad.js +34 -33
- package/logger.js +6 -2
- package/material.js +14 -11
- package/matrices.js +12 -19
- package/multipass.js +155 -146
- package/package.json +22 -19
- package/rbo.js +43 -34
- package/readpixels.js +14 -10
- package/shader.js +342 -335
- package/shaders/lambert.js +79 -48
- package/shaders/phong.js +92 -60
- package/shaders/pipeline.js +35 -27
- package/syntax.js +64 -77
- package/texture.js +277 -230
- package/textures/checkerboard.js +28 -25
- package/textures/stripes.js +19 -18
- package/uniforms.js +70 -67
- package/utils.js +6 -8
package/shaders/lambert.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
diffuseLighting,
|
|
3
|
+
halfLambert,
|
|
4
|
+
lambert
|
|
5
|
+
} from "@thi.ng/shader-ast-stdlib/light/lambert";
|
|
2
6
|
import { transformMVP } from "@thi.ng/shader-ast-stdlib/matrix/mvp";
|
|
3
7
|
import { surfaceNormal } from "@thi.ng/shader-ast-stdlib/matrix/normal";
|
|
4
8
|
import { assign } from "@thi.ng/shader-ast/ast/assign";
|
|
@@ -11,51 +15,78 @@ import { texture } from "@thi.ng/shader-ast/builtin/texture";
|
|
|
11
15
|
import { defMaterial } from "../material.js";
|
|
12
16
|
import { autoNormalMatrix2 } from "../matrices.js";
|
|
13
17
|
import { colorAttrib, positionAttrib } from "../utils.js";
|
|
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
|
-
}
|
|
18
|
+
const LAMBERT = (opts = {}) => ({
|
|
19
|
+
vs: (gl, unis, ins, outs) => [
|
|
20
|
+
defMain(() => [
|
|
21
|
+
opts.uv ? assign(outs.vuv, ins[opts.uv]) : null,
|
|
22
|
+
assign(outs.vcolor, colorAttrib(opts, ins, unis.diffuseCol)),
|
|
23
|
+
assign(outs.vnormal, surfaceNormal(ins.normal, unis.normalMat)),
|
|
24
|
+
assign(
|
|
25
|
+
gl.gl_Position,
|
|
26
|
+
transformMVP(
|
|
27
|
+
positionAttrib(opts, ins),
|
|
28
|
+
unis.model,
|
|
29
|
+
unis.view,
|
|
30
|
+
unis.proj
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
])
|
|
34
|
+
],
|
|
35
|
+
fs: (_, unis, ins, outs) => [
|
|
36
|
+
defMain(() => [
|
|
37
|
+
assign(
|
|
38
|
+
outs.fragColor,
|
|
39
|
+
vec4(
|
|
40
|
+
diffuseLighting(
|
|
41
|
+
(opts.bidir !== false ? halfLambert : lambert)(
|
|
42
|
+
normalize(ins.vnormal),
|
|
43
|
+
unis.lightDir
|
|
44
|
+
),
|
|
45
|
+
opts.uv ? mul(
|
|
46
|
+
$(texture(unis.tex, ins.vuv), "xyz"),
|
|
47
|
+
ins.vcolor
|
|
48
|
+
) : ins.vcolor,
|
|
49
|
+
unis.lightCol,
|
|
50
|
+
unis.ambientCol
|
|
51
|
+
),
|
|
52
|
+
1
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
])
|
|
56
|
+
],
|
|
57
|
+
// pre: ALIAS_TEXTURE,
|
|
58
|
+
attribs: {
|
|
59
|
+
position: "vec3",
|
|
60
|
+
normal: "vec3",
|
|
61
|
+
...opts.uv ? { [opts.uv]: "vec2" } : null,
|
|
62
|
+
...opts.color && !opts.instanceColor ? { [opts.color]: "vec3" } : null,
|
|
63
|
+
...opts.instancePos ? { [opts.instancePos]: "vec3" } : null,
|
|
64
|
+
...opts.instanceColor ? { [opts.instanceColor]: "vec3" } : null
|
|
65
|
+
},
|
|
66
|
+
varying: {
|
|
67
|
+
vcolor: "vec3",
|
|
68
|
+
vnormal: "vec3",
|
|
69
|
+
...opts.uv ? { vuv: "vec2" } : null
|
|
70
|
+
},
|
|
71
|
+
uniforms: {
|
|
72
|
+
model: "mat4",
|
|
73
|
+
view: "mat4",
|
|
74
|
+
proj: "mat4",
|
|
75
|
+
normalMat: ["mat4", autoNormalMatrix2()],
|
|
76
|
+
lightDir: ["vec3", [0, 1, 0]],
|
|
77
|
+
lightCol: ["vec3", [1, 1, 1]],
|
|
78
|
+
...defMaterial(
|
|
79
|
+
{ diffuseCol: [1, 1, 1], ...opts.material },
|
|
80
|
+
{ specularCol: false }
|
|
81
|
+
),
|
|
82
|
+
...opts.uv ? { tex: "sampler2D" } : null
|
|
83
|
+
},
|
|
84
|
+
state: {
|
|
85
|
+
depth: true,
|
|
86
|
+
cull: true,
|
|
87
|
+
...opts.state
|
|
88
|
+
}
|
|
61
89
|
});
|
|
90
|
+
export {
|
|
91
|
+
LAMBERT
|
|
92
|
+
};
|
package/shaders/phong.js
CHANGED
|
@@ -11,64 +11,96 @@ import { dot, max, normalize, pow } from "@thi.ng/shader-ast/builtin/math";
|
|
|
11
11
|
import { defMaterial } from "../material.js";
|
|
12
12
|
import { autoNormalMatrix1 } from "../matrices.js";
|
|
13
13
|
import { colorAttrib, positionAttrib } from "../utils.js";
|
|
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
|
-
|
|
14
|
+
const PHONG = (opts = {}) => ({
|
|
15
|
+
vs: (gl, unis, ins, outs) => [
|
|
16
|
+
defMain(() => {
|
|
17
|
+
let worldPos;
|
|
18
|
+
return [
|
|
19
|
+
worldPos = sym(
|
|
20
|
+
mul(unis.model, vec4(positionAttrib(opts, ins), 1))
|
|
21
|
+
),
|
|
22
|
+
assign(outs.vnormal, surfaceNormal(ins.normal, unis.normalMat)),
|
|
23
|
+
assign(outs.vlight, sub(unis.lightPos, $(worldPos, "xyz"))),
|
|
24
|
+
assign(outs.veye, sub(unis.eyePos, $(worldPos, "xyz"))),
|
|
25
|
+
assign(outs.vcolor, colorAttrib(opts, ins, unis.diffuseCol)),
|
|
26
|
+
assign(
|
|
27
|
+
gl.gl_Position,
|
|
28
|
+
mul(mul(unis.proj, unis.view), worldPos)
|
|
29
|
+
)
|
|
30
|
+
];
|
|
31
|
+
})
|
|
32
|
+
],
|
|
33
|
+
fs: (_, unis, ins, outs) => [
|
|
34
|
+
defMain(() => {
|
|
35
|
+
let normal;
|
|
36
|
+
let light;
|
|
37
|
+
let directional;
|
|
38
|
+
let specular;
|
|
39
|
+
return [
|
|
40
|
+
normal = sym(normalize(ins.vnormal)),
|
|
41
|
+
light = sym(normalize(ins.vlight)),
|
|
42
|
+
directional = sym(max(dot(normal, light), FLOAT0)),
|
|
43
|
+
specular = sym(
|
|
44
|
+
ternary(
|
|
45
|
+
gt(directional, FLOAT0),
|
|
46
|
+
pow(
|
|
47
|
+
dot(
|
|
48
|
+
normal,
|
|
49
|
+
normalize(add(light, normalize(ins.veye)))
|
|
50
|
+
),
|
|
51
|
+
unis.shininess
|
|
52
|
+
),
|
|
53
|
+
FLOAT0
|
|
54
|
+
)
|
|
55
|
+
),
|
|
56
|
+
assign(
|
|
57
|
+
outs.fragColor,
|
|
58
|
+
vec4(
|
|
59
|
+
add(
|
|
60
|
+
diffuseLighting(
|
|
61
|
+
directional,
|
|
62
|
+
ins.vcolor,
|
|
63
|
+
unis.lightCol,
|
|
64
|
+
unis.ambientCol
|
|
65
|
+
),
|
|
66
|
+
mul(unis.specularCol, specular)
|
|
67
|
+
),
|
|
68
|
+
1
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
];
|
|
72
|
+
})
|
|
73
|
+
],
|
|
74
|
+
attribs: {
|
|
75
|
+
position: "vec3",
|
|
76
|
+
normal: "vec3",
|
|
77
|
+
...opts.color && !opts.instanceColor ? { [opts.color]: "vec3" } : null,
|
|
78
|
+
...opts.instancePos ? { [opts.instancePos]: "vec3" } : null,
|
|
79
|
+
...opts.instanceColor ? { [opts.instanceColor]: "vec3" } : null
|
|
80
|
+
},
|
|
81
|
+
varying: {
|
|
82
|
+
vnormal: "vec3",
|
|
83
|
+
veye: "vec3",
|
|
84
|
+
vlight: "vec3",
|
|
85
|
+
vcolor: "vec3"
|
|
86
|
+
},
|
|
87
|
+
uniforms: {
|
|
88
|
+
model: "mat4",
|
|
89
|
+
normalMat: ["mat4", autoNormalMatrix1()],
|
|
90
|
+
view: "mat4",
|
|
91
|
+
proj: "mat4",
|
|
92
|
+
shininess: ["float", 32],
|
|
93
|
+
eyePos: "vec3",
|
|
94
|
+
lightPos: ["vec3", [0, 0, 2]],
|
|
95
|
+
lightCol: ["vec3", [1, 1, 1]],
|
|
96
|
+
...defMaterial(opts.material)
|
|
97
|
+
},
|
|
98
|
+
state: {
|
|
99
|
+
depth: true,
|
|
100
|
+
cull: true,
|
|
101
|
+
...opts.state
|
|
102
|
+
}
|
|
74
103
|
});
|
|
104
|
+
export {
|
|
105
|
+
PHONG
|
|
106
|
+
};
|
package/shaders/pipeline.js
CHANGED
|
@@ -3,36 +3,44 @@ import { defMain } from "@thi.ng/shader-ast/ast/function";
|
|
|
3
3
|
import { FLOAT0, FLOAT1, vec4 } from "@thi.ng/shader-ast/ast/lit";
|
|
4
4
|
import { $xy } from "@thi.ng/shader-ast/ast/swizzle";
|
|
5
5
|
import { texture } from "@thi.ng/shader-ast/builtin/texture";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const PASSTHROUGH_VS = (gl, _, ins) => [
|
|
7
|
+
defMain(() => [assign(gl.gl_Position, vec4(ins.position, FLOAT0, FLOAT1))])
|
|
8
8
|
];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const PASSTHROUGH_VS_UV = (gl, _, ins, outs) => [
|
|
10
|
+
defMain(() => [
|
|
11
|
+
assign(outs.v_uv, ins.uv),
|
|
12
|
+
assign(gl.gl_Position, vec4(ins.position, FLOAT0, FLOAT1))
|
|
13
|
+
])
|
|
14
14
|
];
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const PASSTHROUGH_FS = (gl, _, __, outs) => [
|
|
16
|
+
defMain(() => [assign(outs.fragColor, $xy(gl.gl_FragCoord))])
|
|
17
17
|
];
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const PASSTHROUGH_FS_UV = (_, unis, ins, outs) => [
|
|
19
|
+
defMain(() => [assign(outs.fragColor, texture(unis.tex, ins.v_uv))])
|
|
20
20
|
];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
const FX_SHADER_SPEC = {
|
|
22
|
+
vs: PASSTHROUGH_VS,
|
|
23
|
+
fs: PASSTHROUGH_FS,
|
|
24
|
+
attribs: { position: "vec2" },
|
|
25
|
+
varying: {},
|
|
26
|
+
uniforms: {},
|
|
27
|
+
state: { depth: false },
|
|
28
|
+
ext: {}
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
const FX_SHADER_SPEC_UV = {
|
|
31
|
+
vs: PASSTHROUGH_VS_UV,
|
|
32
|
+
fs: PASSTHROUGH_FS_UV,
|
|
33
|
+
attribs: { position: "vec2", uv: "vec2" },
|
|
34
|
+
varying: { v_uv: "vec2" },
|
|
35
|
+
uniforms: { tex: "sampler2D" },
|
|
36
|
+
state: { depth: false },
|
|
37
|
+
ext: {}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
FX_SHADER_SPEC,
|
|
41
|
+
FX_SHADER_SPEC_UV,
|
|
42
|
+
PASSTHROUGH_FS,
|
|
43
|
+
PASSTHROUGH_FS_UV,
|
|
44
|
+
PASSTHROUGH_VS,
|
|
45
|
+
PASSTHROUGH_VS_UV
|
|
38
46
|
};
|
package/syntax.js
CHANGED
|
@@ -1,91 +1,69 @@
|
|
|
1
1
|
import { isArray } from "@thi.ng/checks/is-array";
|
|
2
2
|
import { GLSLVersion } from "@thi.ng/shader-ast-glsl/api";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const PREFIXES = {
|
|
4
|
+
a: "a_",
|
|
5
|
+
v: "v_",
|
|
6
|
+
u: "u_",
|
|
7
|
+
o: "o_"
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const NO_PREFIXES = {
|
|
10
|
+
a: "",
|
|
11
|
+
v: "",
|
|
12
|
+
u: "",
|
|
13
|
+
o: ""
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
varying: {
|
|
26
|
-
vs: (id, type, pre) => arrayDecl("varying", type, pre.v + id),
|
|
27
|
-
fs: (id, type, pre) => arrayDecl("varying", type, pre.v + id),
|
|
28
|
-
},
|
|
29
|
-
uniform: (id, u, pre) => arrayDecl("uniform", u, pre.u + id),
|
|
30
|
-
output: (id, type, pre) => isArray(type)
|
|
31
|
-
? `#define ${pre.o}${id} gl_FragData[${type[1]}]`
|
|
32
|
-
: "",
|
|
15
|
+
const SYNTAX = {
|
|
16
|
+
/**
|
|
17
|
+
* WebGL (GLSL ES 1.0)
|
|
18
|
+
*/
|
|
19
|
+
[GLSLVersion.GLES_100]: {
|
|
20
|
+
number: 100,
|
|
21
|
+
attrib: (id, type, pre) => `attribute ${isArray(type) ? type[0] : type} ${pre.a}${id};`,
|
|
22
|
+
varying: {
|
|
23
|
+
vs: (id, type, pre) => arrayDecl("varying", type, pre.v + id),
|
|
24
|
+
fs: (id, type, pre) => arrayDecl("varying", type, pre.v + id)
|
|
33
25
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
uniform: (id, u, pre) => arrayDecl("uniform", u, pre.u + id),
|
|
47
|
-
output: (id, type, pre) => isArray(type)
|
|
48
|
-
? `layout(location=${type[1]}) out ${type[0]} ${pre.o}${id};`
|
|
49
|
-
: `out ${type} ${pre.o}${id};`,
|
|
26
|
+
uniform: (id, u, pre) => arrayDecl("uniform", u, pre.u + id),
|
|
27
|
+
output: (id, type, pre) => isArray(type) ? `#define ${pre.o}${id} gl_FragData[${type[1]}]` : ""
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* WebGL 2 (GLSL ES 3)
|
|
31
|
+
*/
|
|
32
|
+
[GLSLVersion.GLES_300]: {
|
|
33
|
+
number: 300,
|
|
34
|
+
attrib: (id, type, pre) => isArray(type) ? `layout(location=${type[1]}) in ${type[0]} ${pre.a}${id};` : `in ${type} ${pre.a}${id};`,
|
|
35
|
+
varying: {
|
|
36
|
+
vs: (id, type, pre) => arrayDecl("out", type, pre.v + id),
|
|
37
|
+
fs: (id, type, pre) => arrayDecl("in", type, pre.v + id)
|
|
50
38
|
},
|
|
39
|
+
uniform: (id, u, pre) => arrayDecl("uniform", u, pre.u + id),
|
|
40
|
+
output: (id, type, pre) => isArray(type) ? `layout(location=${type[1]}) out ${type[0]} ${pre.o}${id};` : `out ${type} ${pre.o}${id};`
|
|
41
|
+
}
|
|
51
42
|
};
|
|
52
43
|
const arrayDecl = (qualifier, decl, id) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
? `${qualifier} ${type.replace("[]", "")} ${id}[${decl[1]}];`
|
|
56
|
-
: `${qualifier} ${type} ${id};`;
|
|
44
|
+
const type = isArray(decl) ? decl[0] : decl;
|
|
45
|
+
return type.indexOf("[]") > 0 ? `${qualifier} ${type.replace("[]", "")} ${id}[${decl[1]}];` : `${qualifier} ${type} ${id};`;
|
|
57
46
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
fail = null;
|
|
70
|
-
cmp = "<";
|
|
71
|
-
}
|
|
72
|
-
return `#if __VERSION__ ${cmp} ${ver}
|
|
73
|
-
${ok}${fail ? `\n#else\n${fail}` : ""}
|
|
47
|
+
const VERSION_CHECK = (ver, ok, fail = "") => {
|
|
48
|
+
let cmp = ">=";
|
|
49
|
+
if (!ok) {
|
|
50
|
+
ok = fail;
|
|
51
|
+
fail = null;
|
|
52
|
+
cmp = "<";
|
|
53
|
+
}
|
|
54
|
+
return `#if __VERSION__ ${cmp} ${ver}
|
|
55
|
+
${ok}${fail ? `
|
|
56
|
+
#else
|
|
57
|
+
${fail}` : ""}
|
|
74
58
|
#endif`;
|
|
75
59
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*/
|
|
84
|
-
export const EXPORT_FRAGCOL = (body = "col", out = "o_fragColor") => VERSION_CHECK(300, `${out}=${body};`, `gl_FragColor=${body};`);
|
|
85
|
-
/**
|
|
86
|
-
* Default GLSL prelude.
|
|
87
|
-
*/
|
|
88
|
-
export const GLSL_HEADER = `#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
60
|
+
const ALIAS_TEXTURE = VERSION_CHECK(
|
|
61
|
+
300,
|
|
62
|
+
"",
|
|
63
|
+
"#define texture texture2D"
|
|
64
|
+
);
|
|
65
|
+
const EXPORT_FRAGCOL = (body = "col", out = "o_fragColor") => VERSION_CHECK(300, `${out}=${body};`, `gl_FragColor=${body};`);
|
|
66
|
+
const GLSL_HEADER = `#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
89
67
|
precision highp int;
|
|
90
68
|
precision highp float;
|
|
91
69
|
#else
|
|
@@ -102,3 +80,12 @@ precision mediump float;
|
|
|
102
80
|
#define HALF_PI 1.570796326794896
|
|
103
81
|
#endif
|
|
104
82
|
`;
|
|
83
|
+
export {
|
|
84
|
+
ALIAS_TEXTURE,
|
|
85
|
+
EXPORT_FRAGCOL,
|
|
86
|
+
GLSL_HEADER,
|
|
87
|
+
NO_PREFIXES,
|
|
88
|
+
PREFIXES,
|
|
89
|
+
SYNTAX,
|
|
90
|
+
VERSION_CHECK
|
|
91
|
+
};
|