Skip to content

Commit 7d9a1e9

Browse files
authored
New toy (#51)
- `--no-focus` option to not steal focus and float - Update the docs - Experimental Shell Integration Docs - Update `README.md` and `QUICKSTART.md` - `--new-toy [filename]` ability to create a new example template shader - `--new-toy example.frag --template plot` ability to use either _default_ or _plot_ template
1 parent da06015 commit 7d9a1e9

File tree

15 files changed

+652
-181
lines changed

15 files changed

+652
-181
lines changed

.github/workflows/linux-docker-ci.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@ on:
44
push:
55
branches:
66
- main
7-
- master
8-
paths-ignore:
9-
- 'scripts/**'
10-
- '**.md'
11-
- 'LICENSE'
12-
- '.gitignore'
13-
- '.github/workflows/release.yml'
7+
paths:
8+
- 'src/**'
9+
- 'include/**'
10+
- 'tests/**'
11+
- 'CMakeLists.txt'
12+
- 'linux-tests.Dockerfile'
13+
- '.github/workflows/linux-docker-ci.yml'
1414
pull_request:
1515
branches:
1616
- main
17-
paths-ignore:
18-
- 'scripts/**'
19-
- '**.md'
20-
- 'LICENSE'
21-
- '.gitignore'
22-
- '.github/workflows/release.yml'
17+
paths:
18+
- 'src/**'
19+
- 'include/**'
20+
- 'tests/**'
21+
- 'CMakeLists.txt'
22+
- 'linux-tests.Dockerfile'
23+
- '.github/workflows/linux-docker-ci.yml'
2324

2425
jobs:
2526
build-and-test-linux:

.github/workflows/linux-smoke-tests.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@ name: Linux Smoke Tests
22

33
on:
44
push:
5-
branches: [main, master]
6-
paths-ignore:
7-
- 'scripts/**'
8-
- '**.md'
9-
- 'LICENSE'
10-
- '.gitignore'
11-
- '.github/workflows/release.yml'
5+
branches:
6+
- main
7+
paths:
8+
- 'src/**'
9+
- 'include/**'
10+
- 'tests/**'
11+
- 'CMakeLists.txt'
12+
- '.github/workflows/linux-smoke-tests.yml'
1213
pull_request:
13-
paths-ignore:
14-
- 'scripts/**'
15-
- '**.md'
16-
- 'LICENSE'
17-
- '.gitignore'
18-
- '.github/workflows/release.yml'
14+
branches:
15+
- main
16+
paths:
17+
- 'src/**'
18+
- 'include/**'
19+
- 'tests/**'
20+
- 'CMakeLists.txt'
21+
- '.github/workflows/linux-smoke-tests.yml'
1922

2023
jobs:
2124
build-and-test:

.github/workflows/macos-ci.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@ on:
44
push:
55
branches:
66
- main
7-
- master
8-
paths-ignore:
9-
- 'scripts/**'
10-
- '**.md'
11-
- 'LICENSE'
12-
- '.gitignore'
13-
- '.github/workflows/release.yml'
7+
paths:
8+
- 'src/**'
9+
- 'include/**'
10+
- 'tests/**'
11+
- 'CMakeLists.txt'
12+
- '.github/workflows/macos-ci.yml'
1413
pull_request:
1514
branches:
1615
- main
17-
paths-ignore:
18-
- 'scripts/**'
19-
- '**.md'
20-
- 'LICENSE'
21-
- '.gitignore'
22-
- '.github/workflows/release.yml'
16+
paths:
17+
- 'src/**'
18+
- 'include/**'
19+
- 'tests/**'
20+
- 'CMakeLists.txt'
21+
- '.github/workflows/macos-ci.yml'
2322

2423
jobs:
2524
build-and-test-macos:

.github/workflows/nix-flake-ci.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ name: Nix Flake CI
22

33
on:
44
push:
5-
branches: [main, master]
6-
paths-ignore:
7-
- 'scripts/**'
8-
- '**.md'
9-
- 'LICENSE'
10-
- '.gitignore'
11-
- '.github/workflows/release.yml'
5+
branches:
6+
- main
7+
paths:
8+
- 'src/**'
9+
- 'include/**'
10+
- 'tests/**'
11+
- 'CMakeLists.txt'
12+
- '.github/workflows/nix-flake-ci.yml'
1213
pull_request:
14+
branches:
15+
- main
1316
paths:
1417
- 'flake.nix'
1518
- 'flake.lock'

.github/workflows/windows-build-test.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@ on:
44
push:
55
branches:
66
- main
7-
- master
8-
paths-ignore:
9-
- 'scripts/**'
10-
- '**.md'
11-
- 'LICENSE'
12-
- '.gitignore'
13-
- '.github/workflows/release.yml'
7+
paths:
8+
- 'src/**'
9+
- 'include/**'
10+
- 'tests/**'
11+
- 'CMakeLists.txt'
12+
- '.github/workflows/windows-build-test.yml'
1413
pull_request:
1514
branches:
1615
- main
17-
paths-ignore:
18-
- 'scripts/**'
19-
- '**.md'
20-
- 'LICENSE'
21-
- '.gitignore'
22-
- '.github/workflows/release.yml'
16+
paths:
17+
- 'src/**'
18+
- 'include/**'
19+
- 'tests/**'
20+
- 'CMakeLists.txt'
21+
- '.github/workflows/windows-build-test.yml'
2322

2423
jobs:
2524
build-and-test-windows:

QUICKSTART.md

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,30 @@
22

33
Go from zero to your first shader in minutes.
44

5-
## 0) Populate submodules
6-
```sh
7-
git submodule update --init --recursive
8-
```
5+
## 1) Install
96

10-
## 1) Install + Build
11-
12-
### macOS (Homebrew)
13-
Install Vulkan + deps with Homebrew:
7+
### macOS
8+
Install vsdf and its dependencies with Homebrew:
149
```sh
15-
brew install molten-vk vulkan-loader glslang glfw glm spdlog vulkan-tools ffmpeg
10+
brew install jamylak/vsdf/vsdf
1611
```
1712

18-
Build:
19-
```sh
20-
cmake -B build .
21-
cmake --build build
22-
```
13+
### Linux
2314

24-
### Linux (Ubuntu/Debian)
25-
Install dependencies, then build:
26-
```sh
27-
sudo apt-get update
28-
sudo apt-get install -y \
29-
build-essential cmake ninja-build \
30-
libgtest-dev libspdlog-dev \
31-
libglfw3 libglfw3-dev libvulkan-dev \
32-
glslang-tools glslang-dev libglm-dev \
33-
# (Optional) set -DDISABLE_FFMPEG=ON to skip \
34-
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev \
35-
```
15+
**Easiest way to install vsdf:**
16+
Pre-built binaries for Linux are available in the [GitHub Releases](https://github.com/jamylak/vsdf/releases) page.
17+
18+
To get the **latest release**:
3619

37-
Build:
3820
```sh
39-
# FFmpeg is optional; set `-DDISABLE_FFMPEG=ON` (see `CMakeLists.txt`) to build without it.
40-
cmake -B build .
41-
cmake --build build
21+
LATEST_RELEASE_TAG=$(curl -sL https://api.github.com/repos/jamylak/vsdf/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
22+
DOWNLOAD_URL="https://github.com/jamylak/vsdf/releases/download/${LATEST_RELEASE_TAG}/vsdf-linux-x86_64.tar.gz"
23+
echo "Downloading from: ${DOWNLOAD_URL}"
24+
curl -LO "${DOWNLOAD_URL}"
25+
tar -xzf vsdf-linux-x86_64.tar.gz
26+
chmod +x linux/vsdf
27+
sudo mv linux/vsdf /usr/local/bin/vsdf
28+
rm -rf vsdf-linux-x86_64.tar.gz linux # Clean up downloaded files
4229
```
4330

4431
### Windows (vcpkg)
@@ -57,39 +44,49 @@ cmake --build build
5744
```
5845
3. Build:
5946
```powershell
47+
git submodule update --init --recursive
6048
# FFmpeg is optional; set `-DDISABLE_FFMPEG=ON` (see `CMakeLists.txt`) to build without it.
61-
cmake -B build -DCMAKE_TOOLCHAIN_FILE="<path-to-vcpkg>/scripts/buildsystems/vcpkg.cmake" .
49+
cmake -B build -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" .
6250
cmake --build build --config Release
6351
```
6452

65-
## 2) Launch the sample shader
53+
## 2) Quick Start - INSTANT shader development!
54+
55+
The fastest way to get started is by using the `vsdf` command line tool directly.
56+
57+
1. Create a new shader file:
58+
6659
```sh
67-
./build/vsdf --toy shaders/testtoyshader.frag
60+
vsdf --new-toy example.frag # Creates 'example.frag' with a default template
61+
vsdf --new-toy plot.frag --template plot # Creates 'plot.frag' with the 2D plot template
6862
```
6963

70-
## 3) Make your own shader (copy and run)
71-
Saving your file hot reloads.
64+
2. Open the newly created shader file in your favorite editor (e.g., VS Code, Neovim, Sublime Text) and start editing!
7265

73-
### ShaderToy-style
7466
```sh
75-
cp shaders/testtoyshader.frag shaders/myshader.frag
76-
./build/vsdf --toy shaders/myshader.frag
67+
code example.frag # VS Code
68+
# or: nvim example.frag # Neovim
69+
# or: subl example.frag # Sublime Text
7770
```
7871

79-
### Vulkan-style
72+
3. While you're editing, run `vsdf` in another terminal to see your changes hot-reload:
8073
```sh
81-
cp shaders/vulktemplate.frag shaders/myshader.frag
82-
./build/vsdf shaders/myshader.frag
74+
vsdf --toy example.frag
8375
```
8476

85-
## 4) Record video with FFMPEG (offline MP4 encoding)
77+
For a more integrated and faster *experimental* workflow with a shell function that creates the shader, opens the editor, and launches `vsdf` in one command, see the [Shell Integration Guide](SHELL_INTEGRATION.md).
78+
79+
## 3) Record video with FFMPEG (offline MP4 encoding)
8680
```sh
87-
./build/vsdf --toy shaders/testtoyshader.frag --frames 100 --ffmpeg-output out.mp4
81+
./build/vsdf --toy example.frag --frames 100 --ffmpeg-output out.mp4
8882
```
8983

9084
## Notes
91-
- `--toy` prepends `shaders/toytemplate.frag` to set up push constants in the format
85+
- `--toy` sets up push constants and other things in the format
9286
ShaderToy uses, e.g., `iTime` as well as `main()` etc.
87+
- `--new-toy` creates an example shader file starting point
88+
- **Hot reload**: Saving your shader file automatically reloads it in vsdf!
89+
- Available templates: `default` (colorful animation), `plot` (2D function plotter)
9390

9491
## Example: save a ShaderToy and run it locally
9592
1. Open the ShaderToy and copy the fragment shader code:
@@ -99,3 +96,7 @@ ShaderToy uses, e.g., `iTime` as well as `main()` etc.
9996
```sh
10097
./build/vsdf --toy shaders/raymarching_primitives.frag
10198
```
99+
100+
## Recommendations
101+
I would recommend visiting https://www.shadertoy.com to see their amazing shaders.
102+
Also check out https://iquilezles.org/

0 commit comments

Comments
 (0)