24 | vscode-glsl-canvas
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/snippets/shapes/2d/grid.glsl:
--------------------------------------------------------------------------------
1 | /* Shape 2D grid */
2 | vec2 tile(in vec2 p, vec2 w) { return fract(mod(p + w / 2.0, w)) - (w / 2.0); }
3 | vec2 tile(in vec2 p, float w) { return tile(p, vec2(w)); }
4 | float sLine(in vec2 a, in vec2 b) {
5 | vec2 p = b - a;
6 | float d = abs(dot(normalize(vec2(p.y, -p.x)), a));
7 | return d * 2.0;
8 | }
9 | float line(in vec2 a, in vec2 b) {
10 | float d = sLine(a, b);
11 | return fill(d);
12 | }
13 | float line(in vec2 a, in vec2 b, in float t) {
14 | float d = sLine(a, b);
15 | return stroke(d, t);
16 | }
17 | float line(in vec2 p, in float a, in float t) {
18 | vec2 b = p + vec2(sin(a), cos(a));
19 | return line(p, b, t);
20 | }
21 | float sSegment(in vec2 a, in vec2 b) {
22 | vec2 ba = a - b;
23 | float d = clamp(dot(a, ba) / dot(ba, ba), 0.0, 1.0);
24 | return length(a - ba * d) * 2.0;
25 | }
26 | float segment(in vec2 a, in vec2 b, float t) {
27 | float d = sSegment(a, b);
28 | return stroke(d, t);
29 | }
30 | float grid(in vec2 p, in float w) {
31 | vec2 l = tile(p, w);
32 | float d = 0.0;
33 | d += line(l, l + vec2(0.0, 0.1), 0.002);
34 | d += line(l, l + vec2(0.1, 0.0), 0.002);
35 | d *= 0.2;
36 | p = tile(p, vec2(w * 5.0));
37 | float s = w / 10.0;
38 | float g = 0.0;
39 | g += segment(p + vec2(-s, 0.0), p + vec2(s, 0.0), 0.004);
40 | g += segment(p + vec2(0.0, -s), p + vec2(0.0, s), 0.004);
41 | return d + g;
42 | }
--------------------------------------------------------------------------------
/src/docs/docs.scss:
--------------------------------------------------------------------------------
1 | body {
2 | height: 100%;
3 | margin: 0;
4 | background: #171717;
5 | }
6 |
7 | .editor {
8 | display: block;
9 | height: 100%;
10 | }
11 |
12 | .CodeMirror {
13 | font-size: 13px !important;
14 | font-family: Cousine, Monaco, 'Courier New', monospace !important;
15 | min-height: 100vh;
16 | &.cm-s-monokai {
17 | background: #171717;
18 | color: #d4d4d4;
19 | .CodeMirror-gutters {
20 | background: #171717;
21 | }
22 | span {
23 | &.cm-atom,
24 | &.cm-number {
25 | color: #b5cea8;
26 | }
27 | &.cm-keyword {
28 | color: #9f7ec0;
29 | }
30 | &.cm-comment {
31 | color: #44864e;
32 | }
33 | &.cm-variable-3 {
34 | color: #569cd6;
35 | }
36 | &.cm-variable {
37 | color: #dcd98a;
38 | }
39 | }
40 | }
41 | }
42 |
43 | .CodeMirror-scroll {
44 | overflow: auto !important;
45 | }
46 |
47 | .CodeMirror-linenumber.CodeMirror-gutter-elt {
48 | color: #5a5a5a;
49 | }
50 |
51 | .btn {
52 | display: none;
53 | position: fixed;
54 | bottom: 20px;
55 | right: 20px;
56 | z-index: 100;
57 | padding: 8px;
58 | border-radius: 5px;
59 | text-decoration: none;
60 | font-family: Arial, Helvetica, sans-serif;
61 | font-size: 14px;
62 | background: #272727;
63 | color: white;
64 | }
65 |
66 | @media screen and (min-width: 960px) {
67 | body {
68 | padding: 20px;
69 | }
70 |
71 | .CodeMirror {
72 | min-height: calc(100vh - 40px);
73 | }
74 |
75 | .btn {
76 | display: block;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/docs/playgrounds/buffers.glsl:
--------------------------------------------------------------------------------
1 | // Author: Luca Zampetti
2 | // Title: vscode-glsl-canvas Buffers examples
3 |
4 | uniform sampler2D u_buffer0;
5 | uniform sampler2D u_buffer1;
6 |
7 | #if defined(BUFFER_0)
8 |
9 | void main() {
10 | vec3 color = vec3(
11 | 0.5 + cos(u_time) * 0.5,
12 | 0.5 + sin(u_time) * 0.5,
13 | 1.0
14 | );
15 | vec3 buffer = texture2D(u_buffer1, uv, 0.0).rgb;
16 | buffer *= 0.99;
17 | vec2 p = vec2(
18 | st.x + cos(u_time * 5.0) * 0.3,
19 | st.y + sin(u_time * 2.0) * 0.3
20 | );
21 | float c = circle(p, 0.2 + 0.1 * sin(u_time));
22 | buffer = mix(buffer, color, c * 1.0);
23 | gl_FragColor = vec4(buffer, 1.0);
24 | }
25 |
26 | #elif defined(BUFFER_1)
27 |
28 | void main() {
29 | vec3 color = vec3(
30 | 0.5 + cos(u_time) * 0.5,
31 | 0.5 + sin(u_time) * 0.5,
32 | 1.0
33 | );
34 | vec3 buffer = texture2D(u_buffer0, uv, 0.0).rgb;
35 | buffer *= 0.99;
36 | vec2 p = vec2(
37 | st.x + sin(u_time * 2.0) * 0.3,
38 | st.y + cos(u_time * 6.0) * 0.3
39 | );
40 | float c = circle(p, 0.2 + 0.1 * cos(u_time));
41 | buffer = mix(buffer, color, c * 1.0);
42 | gl_FragColor = vec4(buffer, 1.0);
43 | }
44 |
45 | #else
46 |
47 | void main() {
48 | vec3 color = BLACK;
49 | // vec3 b0 = texture2D(u_buffer0, uv).rgb;
50 | vec3 b1 = texture2D(u_buffer1, uv).rgb;
51 | // color += b0;
52 | color += b1;
53 | gl_FragColor = vec4(color, 1.0);
54 | }
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/docs/css/docs.css:
--------------------------------------------------------------------------------
1 | body {
2 | height: 100%;
3 | margin: 0;
4 | background: #171717; }
5 |
6 | .editor {
7 | display: block;
8 | height: 100%; }
9 |
10 | .CodeMirror {
11 | font-size: 13px !important;
12 | font-family: Cousine, Monaco, 'Courier New', monospace !important;
13 | min-height: 100vh; }
14 | .CodeMirror.cm-s-monokai {
15 | background: #171717;
16 | color: #d4d4d4; }
17 | .CodeMirror.cm-s-monokai .CodeMirror-gutters {
18 | background: #171717; }
19 | .CodeMirror.cm-s-monokai span.cm-atom, .CodeMirror.cm-s-monokai span.cm-number {
20 | color: #b5cea8; }
21 | .CodeMirror.cm-s-monokai span.cm-keyword {
22 | color: #9f7ec0; }
23 | .CodeMirror.cm-s-monokai span.cm-comment {
24 | color: #44864e; }
25 | .CodeMirror.cm-s-monokai span.cm-variable-3 {
26 | color: #569cd6; }
27 | .CodeMirror.cm-s-monokai span.cm-variable {
28 | color: #dcd98a; }
29 |
30 | .CodeMirror-scroll {
31 | overflow: auto !important; }
32 |
33 | .CodeMirror-linenumber.CodeMirror-gutter-elt {
34 | color: #5a5a5a; }
35 |
36 | .btn {
37 | display: none;
38 | position: fixed;
39 | bottom: 20px;
40 | right: 20px;
41 | z-index: 100;
42 | padding: 8px;
43 | border-radius: 5px;
44 | text-decoration: none;
45 | font-family: Arial, Helvetica, sans-serif;
46 | font-size: 14px;
47 | background: #272727;
48 | color: white; }
49 |
50 | @media screen and (min-width: 960px) {
51 | body {
52 | padding: 20px; }
53 | .CodeMirror {
54 | min-height: calc(100vh - 40px); }
55 | .btn {
56 | display: block; } }
57 |
--------------------------------------------------------------------------------
/src/app/services/capture/ccapture.service.js:
--------------------------------------------------------------------------------
1 | /* global window, document, console, GlslCanvas */
2 | /*
3 | Author: Brett Camper (@professorlemeza)
4 | URL: https://github.com/tangrams/tangram/blob/master/src/utils/media_capture.js
5 | */
6 |
7 | (function () {
8 | 'use strict';
9 |
10 | function CCaptureService() {
11 | this.capturer = new CCapture({
12 | format: 'webm',
13 | quality: 90,
14 | framerate: 60,
15 | // motionBlurFrames: 3,
16 | // timeLimit: window.options.recordDuration !== 0 ? window.options.recordDuration : null,
17 | });
18 | }
19 |
20 | CCaptureService.prototype = {
21 | set: set,
22 | snapshot: snapshot,
23 | snapshotRender: snapshotRender,
24 | record: record,
25 | stop: stop,
26 | };
27 |
28 | function set(canvas) {
29 | var service = this;
30 | service.canvas = canvas;
31 | }
32 |
33 | function record() {
34 | var service = this;
35 | var capturer = service.capturer;
36 | capturer.start();
37 | return true;
38 | }
39 |
40 | function stop() {
41 | var service = this;
42 | var capturer = service.capturer;
43 | return new Promise(function (resolve, reject) {
44 | capturer.stop();
45 | capturer.save(function(blob) {
46 | resolve({
47 | blob: blob,
48 | extension: '.webm',
49 | });
50 | });
51 | });
52 | }
53 |
54 | function snapshot() {
55 | var service = this;
56 | return null;
57 | }
58 |
59 | function snapshotRender() {
60 | var service = this;
61 | var capturer = service.capturer;
62 | capturer.capture(service.canvas);
63 | }
64 |
65 | window.CCaptureService = CCaptureService;
66 | }());
67 |
--------------------------------------------------------------------------------
/out/test/runTest.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 | return new (P || (P = Promise))(function (resolve, reject) {
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
9 | });
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | const path = require("path");
13 | const vscode_test_1 = require("vscode-test");
14 | function main() {
15 | return __awaiter(this, void 0, void 0, function* () {
16 | try {
17 | // The folder containing the Extension Manifest package.json
18 | // Passed to `--extensionDevelopmentPath`
19 | const extensionDevelopmentPath = path.resolve(__dirname, '../../');
20 | // The path to the extension test script
21 | // Passed to --extensionTestsPath
22 | const extensionTestsPath = path.resolve(__dirname, './suite/index');
23 | // Download VS Code, unzip it and run the integration test
24 | yield vscode_test_1.runTests({ extensionDevelopmentPath, extensionTestsPath });
25 | }
26 | catch (err) {
27 | console.error('Failed to run tests');
28 | process.exit(1);
29 | }
30 | });
31 | }
32 | main();
33 | //# sourceMappingURL=runTest.js.map
--------------------------------------------------------------------------------
/out/glsl/editor.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"editor.js","sourceRoot":"","sources":["../../src/glsl/editor.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AAEpB,QAAA,eAAe,GAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,CACnE,OAAO,CAAC,EAAE;4BACT,OAAO,CAAC,QAAQ,CAAC,CAAC;wBACnB,CAAC,EACD,KAAK,CAAC,EAAE;4BACP,MAAM,CAAC,KAAK,CAAC,CAAC;wBACf,CAAC,CACD,CAAC;qBACF;yBAAM;wBACN,MAAM,CAAC,QAAQ,CAAC,CAAC;qBACjB;gBACF,CAAC,EACD,KAAK,CAAC,EAAE;oBACP,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;oBAC1D,MAAM,CAAC,KAAK,CAAC,CAAC;gBACf,CAAC,CAAC,CAAC;YACL,CAAC,EACD,KAAK,CAAC,EAAE;gBACP,OAAO,CAAC,GAAG,CAAC,4CAA4C,EAAE,KAAK,CAAC,CAAC;gBACjE,MAAM,CAAC,KAAK,CAAC,CAAC;YACf,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACJ,CAAC;CAED;AAjDD,6BAiDC"}
--------------------------------------------------------------------------------
/resources/fonts/styles.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";
2 |
3 | @font-face {
4 | font-family: "glslcanvas";
5 | src:url("fonts/glslcanvas.eot");
6 | src:url("fonts/glslcanvas.eot?#iefix") format("embedded-opentype"),
7 | url("fonts/glslcanvas.woff") format("woff"),
8 | url("fonts/glslcanvas.ttf") format("truetype"),
9 | url("fonts/glslcanvas.svg#glslcanvas") format("svg");
10 | font-weight: normal;
11 | font-style: normal;
12 |
13 | }
14 |
15 | [data-icon]:before {
16 | font-family: "glslcanvas" !important;
17 | content: attr(data-icon);
18 | font-style: normal !important;
19 | font-weight: normal !important;
20 | font-variant: normal !important;
21 | text-transform: none !important;
22 | speak: none;
23 | line-height: 1;
24 | -webkit-font-smoothing: antialiased;
25 | -moz-osx-font-smoothing: grayscale;
26 | }
27 |
28 | [class^="icon-"]:before,
29 | [class*=" icon-"]:before {
30 | font-family: "glslcanvas" !important;
31 | font-style: normal !important;
32 | font-weight: normal !important;
33 | font-variant: normal !important;
34 | text-transform: none !important;
35 | speak: none;
36 | line-height: 1;
37 | -webkit-font-smoothing: antialiased;
38 | -moz-osx-font-smoothing: grayscale;
39 | }
40 |
41 | .icon-pause:before {
42 | content: "\61";
43 | }
44 | .icon-play:before {
45 | content: "\62";
46 | }
47 | .icon-record:before {
48 | content: "\63";
49 | }
50 | .icon-stop:before {
51 | content: "\64";
52 | }
53 | .icon-stats:before {
54 | content: "\65";
55 | }
56 | .icon-export:before {
57 | content: "\6c";
58 | }
59 | .icon-flat:before {
60 | content: "\66";
61 | }
62 | .icon-box:before {
63 | content: "\67";
64 | }
65 | .icon-sphere:before {
66 | content: "\68";
67 | }
68 | .icon-torus:before {
69 | content: "\69";
70 | }
71 | .icon-mesh:before {
72 | content: "\6a";
73 | }
74 |
--------------------------------------------------------------------------------
/docs/css/docs.min.css.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["src/docs/docs.scss"],"names":[],"mappings":"AAAA,KACC,WAAY,CACZ,QAAS,CACT,kBAAmB,CAGpB,QACC,aAAc,CACd,WAAY,CAGb,YACC,wBAA0B,CAC1B,0DAAiE,CACjE,gBAAiB,CAHlB,yBAKE,kBAAmB,CACnB,aAAc,CANhB,6CAQG,kBAAmB,CARtB,8EAaI,aAAc,CAblB,yCAgBI,aAAc,CAhBlB,yCAmBI,aAAc,CAnBlB,4CAsBI,aAAc,CAtBlB,0CAyBI,aAAc,CAMlB,mBACC,uBAAyB,CAG1B,6CACC,aAAc,CAGf,KACC,YAAa,CACV,cAAe,CACf,WAAY,CACZ,UAAW,CACX,WAAY,CACZ,WAAY,CACZ,iBAAkB,CAClB,oBAAqB,CACrB,sCAAyC,CAC5C,cAAe,CACf,kBAAmB,CAChB,UAAY,CAGhB,oCACC,KACC,YAAa,CAGd,YACC,6BAA8B,CAG/B,KACC,aAAc,CACd","file":"docs/css/docs.min.css","sourcesContent":["body {\n\theight: 100%;\n\tmargin: 0;\n\tbackground: #171717;\n}\n\n.editor {\n\tdisplay: block;\n\theight: 100%;\n}\n\n.CodeMirror {\n\tfont-size: 13px !important;\n\tfont-family: Cousine, Monaco, 'Courier New', monospace !important;\n\tmin-height: 100vh;\n\t&.cm-s-monokai {\n\t\tbackground: #171717;\n\t\tcolor: #d4d4d4;\n\t\t.CodeMirror-gutters {\n\t\t\tbackground: #171717;\n\t\t}\n\t\tspan {\n\t\t\t&.cm-atom,\n\t\t\t&.cm-number {\n\t\t\t\tcolor: #b5cea8;\n\t\t\t}\n\t\t\t&.cm-keyword {\n\t\t\t\tcolor: #9f7ec0;\n\t\t\t}\n\t\t\t&.cm-comment {\n\t\t\t\tcolor: #44864e;\n\t\t\t}\n\t\t\t&.cm-variable-3 {\n\t\t\t\tcolor: #569cd6;\n\t\t\t}\n\t\t\t&.cm-variable {\n\t\t\t\tcolor: #dcd98a;\n\t\t\t}\n\t\t}\n\t}\n}\n\n.CodeMirror-scroll {\n\toverflow: auto !important;\n}\n\n.CodeMirror-linenumber.CodeMirror-gutter-elt {\n\tcolor: #5a5a5a;\n}\n\n.btn {\n\tdisplay: none;\n position: fixed;\n bottom: 20px;\n right: 20px;\n z-index: 100;\n padding: 8px;\n border-radius: 5px;\n text-decoration: none;\n font-family: Arial, Helvetica, sans-serif;\n\tfont-size: 14px;\n\tbackground: #272727;\n color: white;\n}\n\n@media screen and (min-width: 960px) {\n\tbody {\n\t\tpadding: 20px;\n\t}\n\n\t.CodeMirror {\n\t\tmin-height: calc(100vh - 40px);\n\t}\n\n\t.btn {\n\t\tdisplay: block;\n\t}\n}\n"]}
--------------------------------------------------------------------------------
/docs/css/docs.css.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["src/docs/docs.scss"],"names":[],"mappings":"AAAA;EACC,YAAY;EACZ,SAAS;EACT,mBAAmB,EAAA;;AAGpB;EACC,cAAc;EACd,YAAY,EAAA;;AAGb;EACC,0BAA0B;EAC1B,iEAAiE;EACjE,iBAAiB,EAAA;EAHlB;IAKE,mBAAmB;IACnB,cAAc,EAAA;IANhB;MAQG,mBAAmB,EAAA;IARtB;MAaI,cAAc,EAAA;IAblB;MAgBI,cAAc,EAAA;IAhBlB;MAmBI,cAAc,EAAA;IAnBlB;MAsBI,cAAc,EAAA;IAtBlB;MAyBI,cAAc,EAAA;;AAMlB;EACC,yBAAyB,EAAA;;AAG1B;EACC,cAAc,EAAA;;AAGf;EACC,aAAa;EACV,eAAe;EACf,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,kBAAkB;EAClB,qBAAqB;EACrB,yCAAyC;EAC5C,eAAe;EACf,mBAAmB;EAChB,YAAY,EAAA;;AAGhB;EACC;IACC,aAAa,EAAA;EAGd;IACC,8BAA8B,EAAA;EAG/B;IACC,cAAc,EAAA,EACd","file":"docs/css/docs.css","sourcesContent":["body {\n\theight: 100%;\n\tmargin: 0;\n\tbackground: #171717;\n}\n\n.editor {\n\tdisplay: block;\n\theight: 100%;\n}\n\n.CodeMirror {\n\tfont-size: 13px !important;\n\tfont-family: Cousine, Monaco, 'Courier New', monospace !important;\n\tmin-height: 100vh;\n\t&.cm-s-monokai {\n\t\tbackground: #171717;\n\t\tcolor: #d4d4d4;\n\t\t.CodeMirror-gutters {\n\t\t\tbackground: #171717;\n\t\t}\n\t\tspan {\n\t\t\t&.cm-atom,\n\t\t\t&.cm-number {\n\t\t\t\tcolor: #b5cea8;\n\t\t\t}\n\t\t\t&.cm-keyword {\n\t\t\t\tcolor: #9f7ec0;\n\t\t\t}\n\t\t\t&.cm-comment {\n\t\t\t\tcolor: #44864e;\n\t\t\t}\n\t\t\t&.cm-variable-3 {\n\t\t\t\tcolor: #569cd6;\n\t\t\t}\n\t\t\t&.cm-variable {\n\t\t\t\tcolor: #dcd98a;\n\t\t\t}\n\t\t}\n\t}\n}\n\n.CodeMirror-scroll {\n\toverflow: auto !important;\n}\n\n.CodeMirror-linenumber.CodeMirror-gutter-elt {\n\tcolor: #5a5a5a;\n}\n\n.btn {\n\tdisplay: none;\n position: fixed;\n bottom: 20px;\n right: 20px;\n z-index: 100;\n padding: 8px;\n border-radius: 5px;\n text-decoration: none;\n font-family: Arial, Helvetica, sans-serif;\n\tfont-size: 14px;\n\tbackground: #272727;\n color: white;\n}\n\n@media screen and (min-width: 960px) {\n\tbody {\n\t\tpadding: 20px;\n\t}\n\n\t.CodeMirror {\n\t\tmin-height: calc(100vh - 40px);\n\t}\n\n\t.btn {\n\t\tdisplay: block;\n\t}\n}\n"]}
--------------------------------------------------------------------------------
/src/snippets/math/3d/transform.glsl:
--------------------------------------------------------------------------------
1 | /* Math 3D Transformations */
2 |
3 | const mat4 projection = mat4(
4 | vec4(3.0 / 4.0, 0.0, 0.0, 0.0),
5 | vec4( 0.0, 1.0, 0.0, 0.0),
6 | vec4( 0.0, 0.0, 0.5, 0.5),
7 | vec4( 0.0, 0.0, 0.0, 1.0)
8 | );
9 |
10 | mat4 scale = mat4(
11 | vec4(4.0 / 3.0, 0.0, 0.0, 0.0),
12 | vec4( 0.0, 1.0, 0.0, 0.0),
13 | vec4( 0.0, 0.0, 1.0, 0.0),
14 | vec4( 0.0, 0.0, 0.0, 1.0)
15 | );
16 |
17 | mat4 rotation = mat4(
18 | vec4(1.0, 0.0, 0.0, 0.0),
19 | vec4(0.0, cos(u_time), sin(u_time), 0.0),
20 | vec4(0.0, -sin(u_time), cos(u_time), 0.0),
21 | vec4(0.0, 0.0, 0.0, 1.0)
22 | );
23 |
24 | mat4 rotationAxis(float angle, vec3 axis) {
25 | axis = normalize(axis);
26 | float s = sin(angle);
27 | float c = cos(angle);
28 | float oc = 1.0 - c;
29 | return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
30 | oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
31 | oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
32 | 0.0, 0.0, 0.0, 1.0);
33 | }
34 |
35 | vec3 rotateX(vec3 p, float angle) {
36 | mat4 rmy = rotationAxis(angle, vec3(1.0, 0.0, 0.0));
37 | return (vec4(p, 1.0) * rmy).xyz;
38 | }
39 |
40 | vec3 rotateY_(vec3 p, float angle) {
41 | mat4 rmy = rotationAxis(angle, vec3(0.0, 1.0, 0.0));
42 | return (vec4(p, 1.0) * rmy).xyz;
43 | }
44 |
45 | vec3 rotateZ(vec3 p, float angle) {
46 | mat4 rmy = rotationAxis(angle, vec3(0.0, 0.0, 1.0));
47 | return (vec4(p, 1.0) * rmy).xyz;
48 | }
49 |
50 | vec3 rotateY(vec3 p, float angle) {
51 | float c = cos(angle);
52 | float s = sin(angle);
53 | mat4 r = mat4(
54 | vec4(c, 0, s, 0),
55 | vec4(0, 1, 0, 0),
56 | vec4(-s, 0, c, 0),
57 | vec4(0, 0, 0, 1)
58 | );
59 | return (vec4(p, 1.0) * r).xyz;
60 | }
--------------------------------------------------------------------------------
/vsc-extension-quickstart.md:
--------------------------------------------------------------------------------
1 | # Welcome to your VS Code Extension
2 |
3 | ## What's in the folder
4 | * This folder contains all of the files necessary for your extension.
5 | * `package.json` - this is the manifest file in which you declare your extension and command.
6 | The sample plugin registers a command and defines its title and command name. With this information
7 | VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
8 | * `src/extension.ts` - this is the main file where you will provide the implementation of your command.
9 | The file exports one function, `activate`, which is called the very first time your extension is
10 | activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
11 | We pass the function containing the implementation of the command as the second parameter to
12 | `registerCommand`.
13 |
14 | ## Get up and running straight away
15 | * Press `F5` to open a new window with your extension loaded.
16 | * Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
17 | * Set breakpoints in your code inside `src/extension.ts` to debug your extension.
18 | * Find output from your extension in the debug console.
19 |
20 | ## Make changes
21 | * You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
22 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
23 |
24 | ## Explore the API
25 | * You can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts`.
26 |
27 | ## Run tests
28 | * Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`.
29 | * Press `F5` to run the tests in a new window with your extension loaded.
30 | * See the output of the test result in the debug console.
31 | * Make changes to `test/extension.test.ts` or create new test files inside the `test` folder.
32 | * By convention, the test runner will only consider files matching the name pattern `**.test.ts`.
33 | * You can create folders inside the `test` folder to structure your tests any way you want.
34 |
--------------------------------------------------------------------------------
/docs/playgrounds/easing.glsl:
--------------------------------------------------------------------------------
1 | // Author: Luca Zampetti
2 | // Title: vscode-glsl-canvas Easing examples
3 |
4 | void main() {
5 | vec2 p = st * 1.2;
6 | float s = 1.0; float s2 = s / 2.0; float x = 0.5 - p.x;
7 | float t = fract(u_time * 0.5);
8 |
9 | float v = t; float y = x;
10 | // v = easexBackIn(t); y = easexBackIn(x);
11 | // v = easeBackOut(t); y = easeBackOut(x);
12 | // v = easeBackInOut(t); y = easeBackInOut(x);
13 | // v = easeBounceOut(t); y = easeBounceOut(x);
14 | // v = easeBounceIn(t); y = easeBounceIn(x);
15 | // v = easeBounceInOut(t); y = easeBounceInOut(x);
16 | // v = easeCircularIn(t); y = easeCircularIn(x);
17 | // v = easeCircularOut(t); y = easeCircularOut(x);
18 | // v = easeCircularInOut(t); y = easeCircularInOut(x);
19 | // v = easeCubicIn(t); y = easeCubicIn(x);
20 | // v = easeCubicOut(t); y = easeCubicOut(x);
21 | // v = easeCubicInOut(t); y = easeCubicInOut(x);
22 | // v = easeElasticIn(t); y = easeElasticIn(x);
23 | // v = easeElasticOut(t); y = easeElasticOut(x);
24 | // v = easeElasticInOut(t); y = easeElasticInOut(x);
25 | // v = easeExpoIn(t); y = easeExpoIn(x);
26 | // v = easeExpoOut(t); y = easeExpoOut(x);
27 | // v = easeExpoInOut(t); y = easeExpoInOut(x);
28 | // v = easeQuadIn(t); y = easeQuadIn(x);
29 | // v = easeQuadOut(t); y = easeQuadOut(x);
30 | // v = easeQuadInOut(t); y = easeQuadInOut(x);
31 | // v = easeQuartIn(t); y = easeQuartIn(x);
32 | // v = easeQuartOut(t); y = easeQuartOut(x);
33 | // v = easeQuartInOut(t); y = easeQuartInOut(x);
34 | // v = easeQuintIn(t); y = easeQuintIn(x);
35 | // v = easeQuintOut(t); y = easeQuintOut(x);
36 | // v = easeQuintInOut(t); y = easeQuintInOut(x);
37 | // v = easeSineIn(t); y = easeSineIn(x);
38 | // v = easeSineOut(t); y = easeSineOut(x);
39 | // v = easeSineInOut(t); y = easeSineInOut(x);
40 |
41 | vec3 color = AZUR;
42 |
43 | color = mix(color, BLACK, grid(p, 0.1));
44 |
45 | float d = plot(p, y - s2, 0.008);
46 | color = mix(color, WHITE, d * 0.5);
47 |
48 | vec2 c = vec2(t, v);
49 | d = 0.0;
50 | d += segment(p - vec2(s2, s2 + 0.01), p + vec2(-s2, s2 + 0.01), 0.004);
51 | d += segment(p + vec2(-s2 - 0.01, s2), p + vec2(s2 + 0.01, s2), 0.004);
52 | color = mix(color, BLACK, d * 0.3);
53 |
54 | d = circle(p - 0.5 + c, 0.04);
55 | color = mix(color, BLACK, d);
56 |
57 | gl_FragColor = vec4(color, 1.0);
58 | }
--------------------------------------------------------------------------------
/out/glsl/color.provider.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | const vscode = require("vscode");
4 | class GlslColorProvider {
5 | static trim(n) {
6 | const c = n.toFixed(4).replace(/(0*$)/, '');
7 | return c + (c.lastIndexOf('.') === c.length - 1 ? '0' : '');
8 | // return n.toFixed(7).replace(/(? parseFloat(c));
17 | const isColor = (components.length === 1 || components.length === l) && components.reduce((f, c) => {
18 | return f && c >= 0.0 && c <= 1.0;
19 | }, true);
20 | if (isColor) {
21 | if (components.length === 1) {
22 | while (components.length < l) {
23 | components.push(components[0]);
24 | }
25 | }
26 | if (components.length === 3) {
27 | components.push(1.0);
28 | }
29 | if (components.length === 4) {
30 | const color = new vscode.ColorInformation(new vscode.Range(document.positionAt(match.index), document.positionAt(match.index + match[0].length)), new vscode.Color(components[0], components[1], components[2], components[3]));
31 | colors.push(color);
32 | }
33 | }
34 | }
35 | return Promise.resolve(colors);
36 | }
37 | provideColorPresentations(color, context, token) {
38 | if (context.document.getText(context.range).indexOf('vec3') === 0) {
39 | return Promise.resolve([new vscode.ColorPresentation(`vec3(${GlslColorProvider.trim(color.red)}, ${GlslColorProvider.trim(color.green)}, ${GlslColorProvider.trim(color.blue)})`)]);
40 | }
41 | else {
42 | return Promise.resolve([new vscode.ColorPresentation(`vec4(${GlslColorProvider.trim(color.red)}, ${GlslColorProvider.trim(color.green)}, ${GlslColorProvider.trim(color.blue)}, ${GlslColorProvider.trim(color.alpha)})`)]);
43 | }
44 | }
45 | }
46 | exports.default = GlslColorProvider;
47 | //# sourceMappingURL=color.provider.js.map
--------------------------------------------------------------------------------
/out/glsl/color.provider.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"color.provider.js","sourceRoot":"","sources":["../../src/glsl/color.provider.ts"],"names":[],"mappings":"AACA,YAAY,CAAC;;AAEb,iCAAiC;AAEjC,MAAqB,iBAAiB;IAElC,MAAM,CAAC,IAAI,CAAC,CAAS;QACjB,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5D,iDAAiD;IACrD,CAAC;IAEM,qBAAqB,CAAC,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KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAC/N;IACL,CAAC;CAEJ;AAlDD,oCAkDC"}
--------------------------------------------------------------------------------
/gulpfile-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "targets": {
3 | "browser": {
4 | "compile": [
5 | {
6 | "input": "src/app/app.scss",
7 | "output": "resources/css/app.css",
8 | "minify": true
9 | },
10 | {
11 | "input": "src/docs/docs.scss",
12 | "output": "docs/css/docs.css",
13 | "minify": true
14 | }
15 | ],
16 | "bundle": [
17 | {
18 | "input": [
19 | "node_modules/stats.js/build/stats.min.js",
20 | "node_modules/dat.gui/build/dat.gui.min.js",
21 | "node_modules/glsl-canvas-js/dist/umd/glsl-canvas.min.js",
22 | "node_modules/ccapture.js/src/CCapture.js",
23 | "node_modules/ccapture.js/src/webm-writer-0.2.0.js"
24 | ],
25 | "output": "resources/js/vendors.js",
26 | "minify": true
27 | },
28 | {
29 | "input": [
30 | "node_modules/dat.gui/build/dat.gui.css"
31 | ],
32 | "output": "resources/css/vendors.css",
33 | "minify": true
34 | },
35 | {
36 | "input": [
37 | "src/app/services/vector/vector.js",
38 | "src/app/services/camera/camera.service.js",
39 | "src/app/services/capture/capture.service.js",
40 | "src/app/services/capture/ccapture.service.js",
41 | "src/app/services/gui/gui.service.js",
42 | "src/app/services/trails/trails.service.js",
43 | "src/app/app.js"
44 | ],
45 | "output": "resources/js/app.js",
46 | "minify": true
47 | },
48 | {
49 | "input": [
50 | "node_modules/glslEditor/build/glslEditor.css"
51 | ],
52 | "output": "docs/css/vendors.css",
53 | "minify": true
54 | },
55 | {
56 | "input": [
57 | "node_modules/glslEditor/build/glslEditor.js"
58 | ],
59 | "output": "docs/js/vendors.js",
60 | "minify": true
61 | },
62 | {
63 | "input": [
64 | "src/app/services/vector/vector.js",
65 | "src/app/services/camera/camera.service.js",
66 | "src/app/services/trails/trails.service.js",
67 | "src/docs/docs.js"
68 | ],
69 | "output": "docs/js/docs.js",
70 | "minify": true
71 | }
72 | ]
73 | }
74 | },
75 | "server": {
76 | "src": "./docs",
77 | "path": "/",
78 | "host": "localhost",
79 | "port": 5555,
80 | "log": false
81 | },
82 | "tfs": false
83 | }
84 |
--------------------------------------------------------------------------------
/src/glsl/color.provider.ts:
--------------------------------------------------------------------------------
1 |
2 | 'use strict';
3 |
4 | import * as vscode from 'vscode';
5 |
6 | export default class GlslColorProvider implements vscode.DocumentColorProvider {
7 |
8 | static trim(n: number): string {
9 | const c = n.toFixed(4).replace(/(0*$)/, '');
10 | return c + (c.lastIndexOf('.') === c.length - 1 ? '0' : '');
11 | // return n.toFixed(7).replace(/(? {
15 | const regexp = /vec[3|4]\s*\(([0-9|.|,|\s]*)\)/gm;
16 | const colors = [];
17 | let match;
18 | while ((match = regexp.exec(document.getText())) !== null) {
19 | const l = match[0].indexOf('vec3') === 0 ? 3 : 4;
20 | const components = match[1].split(',').map((c: string) => parseFloat(c));
21 | const isColor = (components.length === 1 || components.length === l) && components.reduce((f: boolean, c: number) => {
22 | return f && c >= 0.0 && c <= 1.0;
23 | }, true);
24 | if (isColor) {
25 | if (components.length === 1) {
26 | while (components.length < l) {
27 | components.push(components[0]);
28 | }
29 | }
30 | if (components.length === 3) {
31 | components.push(1.0);
32 | }
33 | if (components.length === 4) {
34 | const color = new vscode.ColorInformation(
35 | new vscode.Range(
36 | document.positionAt(match.index),
37 | document.positionAt(match.index + match[0].length)
38 | ),
39 | new vscode.Color(components[0], components[1], components[2], components[3]),
40 | );
41 | colors.push(color);
42 | }
43 | }
44 | }
45 | return Promise.resolve(colors);
46 | }
47 |
48 | public provideColorPresentations(color: vscode.Color, context: { document: vscode.TextDocument, range: vscode.Range }, token: vscode.CancellationToken): ThenableThis font was created withFontastic
16 |