Skip to content

Commit 70f2adf

Browse files
authored
Merge pull request #116 from Malacath-92/master
Fullfill feature requests & Publish in CI
2 parents 34b9706 + 930a3a3 commit 70f2adf

19 files changed

+647
-106
lines changed

.github/workflows/CI.yml

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches: [ master ]
66
pull_request:
77
branches: [ master ]
8+
release:
9+
types: [ created ]
810

911
jobs:
1012
build:
@@ -42,3 +44,8 @@ jobs:
4244
uses: GabrielBB/xvfb-action@v1.0
4345
with:
4446
run: npm test
47+
- name: Publish
48+
if: success() && startsWith(github.ref, 'refs/tags/releases/') && matrix.os == 'ubuntu-latest'
49+
run: npm run deploy
50+
env:
51+
VSCE_PAT: ${{ secrets.VSCE_PAT }}

README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ void main() {
113113
gl_FragColor = vec4(r, g, b, 1.0);
114114
}
115115
```
116-
Note that compared to *shadertoy.com* `gl_FragCoord` replaces `fragCoord` and `gl_FragColor` replaces `fragColor` in the original demo. There is however a rudimentary support for inserting a trivial `void main()` which will delegate to a `void mainImage(out vec4, in vec2)` function. The definition of `void main()` is found by matching the regex `/void\s+main\s*\(\s*\)\s*\{/g`, thus if you require to define `void main()` in addition to the extension generating a definition you may define it as `void main(void)`. This might be necessary, for example, if your main definition would be processed away by the preprocessor and should thus not be picked up by the extension.
116+
Note that compared to *shadertoy.com* `gl_FragCoord` replaces `fragCoord` and `gl_FragColor` replaces `fragColor` in the original demo. There is however a rudimentary support for inserting a trivial `void main()` which will delegate to a `void mainImage(out vec4, in vec2)` function. The definition of `void main()` is found by matching the regex `/void\s+main\s*\(\s*\)\s*\{/g`, thus if you require to define `void main()` in addition to the extension generating a definition you may define it as `void main(void)`. This might be necessary, for example, if your main definition would be processed away by the preprocessor and should thus not be picked up by the extension.
117+
Since compatibility is achieved with a simple regex match it is only semi-reliable. If you only use shaders from *shadertoy.com* that do things such as defining `mainImage` via macros you may want to enable the "Shader Toy Strict Compatibility" setting, which disables the ability to use shaders that define `void main()` and only allows shaders that define `mainImage` in some way. Alternatively you can use `#StrictCompatibility` in your shader to have this feature localized to just that shader.
117118

118119
### Integration of _glslify_
119120
You can enable support for _glslify_ in the settings, but because _glslify_ does not support line mappings pre and post its transform, line numbers on errors will unfortunately be disabled as long as you have the setting enabled. Using _glslify_ allows using a node.js-style module system for your shaders:
@@ -168,7 +169,10 @@ Contributions of any kind are welcome and encouraged.
168169

169170
### 0.10.12
170171
* Fix attributions of several demo shaders,
171-
* align default wrap mode with what is default on shader-toy.com
172+
* align default wrap mode with what is default on shadertoy.com,
173+
* allow control of filter and wrap mode for sampling other shaders,
174+
* add a strict compatibility mode for shadertoy.com,
175+
* add setting to skip all automatic recompilation and instead have a button in the webview for that.
172176

173177
### 0.10.11
174178
* Automatic dependency updates.

demos/multipass.glsl

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#iChannel0 "file://horizon.jpg"
44
#iChannel1 "file://uv-warp.glsl"
55

6+
#iChannel1::MinFilter "Nearest"
7+
#iChannel1::MagFilter "Nearest"
8+
69
void main() {
710
vec2 uv = gl_FragCoord.xy / iResolution.xy;
811

demos/raymarcher_88.glsl

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Created by Xor - https://www.shadertoy.com/view/ld2BWK
2+
// Adapted for VS Code Shadertoy
3+
4+
#StrictCompatibility
5+
6+
#define mainImage(O,I) \
7+
O -= O;\
8+
for (int i; i++ < 99;)\
9+
O += ( length(cos(O/.1)) - 1.1)\
10+
* vec4( I/1e4, .1, 0)
11+
12+
//82 Character version:
13+
//#define mainImage(O,I) for(int i;i++<99;)O+=(length(cos(O/.1))-1.)*vec4(I/1e4,.1,0)

demos/swirl_spin.glsl

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Created by TekF - https://www.shadertoy.com/view/XsyGzz
2+
// Adapted for VS Code Shadertoy
3+
4+
#iChannel0 "self"
5+
6+
void mainImage(out vec4 fragColor, in vec2 fragCoord)
7+
{
8+
fragColor = texture(iChannel0, (fragCoord*.98 + iResolution.xy*.01 + (fragCoord-iResolution.xy/2.).yx*vec2(-.03,.03)) / iResolution.xy);
9+
10+
float t = iTime*.5;
11+
12+
vec4 col = vec4(sin(t*vec3(13,11,17))*.5+.5,1);
13+
float idx = .0+1.0*smoothstep( 6., 20., length( fragCoord - sin(vec2(11,13)*t)*60. - iResolution.xy/2. ) );
14+
fragColor = mix( col, fragColor, idx );
15+
}

0 commit comments

Comments
 (0)