Skip to content

Commit 8d04c07

Browse files
authored
Merge pull request #4 from Fripe070/assimp
Assimp & langauge migration
2 parents cfbd7df + c6c163d commit 8d04c07

37 files changed

Lines changed: 1697 additions & 370 deletions

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build & Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
env:
9+
BUILD_PATH: "."
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Bun
19+
uses: oven-sh/setup-bun@v2
20+
21+
- name: Install dependencies
22+
run: bun install
23+
working-directory: ${{ env.BUILD_PATH }}
24+
25+
- name: Build with Astro
26+
run: bun run build
27+
working-directory: ${{ env.BUILD_PATH }}
28+
29+
- name: Upload artifact
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: shadercoy-build
33+
path: ${{ env.BUILD_PATH }}/dist
34+
35+
test:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
with:
41+
ref: ${{ github.head_ref }}
42+
43+
- name: Setup Bun
44+
uses: oven-sh/setup-bun@v2
45+
46+
- name: Install dependencies
47+
run: bun install
48+
49+
- name: Run tests
50+
run: bun run test

.github/workflows/deploy.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy site to GitHub Pages
1+
name: Deploy to GitHub Pages
22

33
on:
44
push:
@@ -22,7 +22,6 @@ env:
2222

2323
jobs:
2424
build:
25-
name: Build
2625
runs-on: ubuntu-latest
2726
steps:
2827
- name: Checkout
@@ -41,7 +40,7 @@ jobs:
4140

4241
- name: Build with Astro
4342
run: |
44-
bun run astro build \
43+
bun run build \
4544
--site "${{ steps.pages.outputs.origin }}" \
4645
--base "${{ steps.pages.outputs.base_path }}"
4746
working-directory: ${{ env.BUILD_PATH }}
@@ -52,12 +51,12 @@ jobs:
5251
path: ${{ env.BUILD_PATH }}/dist
5352

5453
deploy:
54+
runs-on: ubuntu-latest
55+
needs: build
5556
environment:
5657
name: github-pages
5758
url: ${{ steps.deployment.outputs.page_url }}
58-
needs: build
59-
runs-on: ubuntu-latest
60-
name: Deploy
59+
6160
steps:
6261
- name: Deploy to GitHub Pages
6362
id: deployment

.github/workflows/lint.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Lint with ESLint
1+
name: Lint & Format
22

33
on:
44
push:
55
pull_request:
6+
workflow_dispatch:
67

78
jobs:
8-
clean:
9+
lint:
910
runs-on: ubuntu-latest
1011
permissions:
1112
contents: write
@@ -25,29 +26,13 @@ jobs:
2526
- name: Fix formatting
2627
run: bun run format
2728

28-
- name: Fix linting issues
29-
run: bun run lint:fix || true # Allow linting to fail, so we can commit the fixes
29+
- name: Fix linter issues
30+
run: bun run lint:fix:types || true
3031

3132
- uses: stefanzweifel/git-auto-commit-action@v6
3233
id: auto-commit-action
3334
with:
3435
commit_message: "chore: fix formatting and linting issues"
3536

36-
lint:
37-
runs-on: ubuntu-latest
38-
needs: clean
39-
40-
steps:
41-
- name: Checkout
42-
uses: actions/checkout@v4
43-
with:
44-
ref: ${{ github.head_ref }}
45-
46-
- name: Setup Bun
47-
uses: oven-sh/setup-bun@v2
48-
49-
- name: Install dependencies
50-
run: bun install
51-
52-
- name: Run linter
53-
run: bun run lint
37+
- name: Report linter issues
38+
run: bun run lint:types

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
dist/
33
# generated types
44
.astro/
5+
# generated parser files
6+
src/scripts/editor/language/parser.js
7+
src/scripts/editor/language/parser.terms.js
58

69
# dependencies
710
node_modules/

bun.lock

Lines changed: 415 additions & 120 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ import eslintPluginAstro from "eslint-plugin-astro";
88
export default tseslint.config(
99
eslint.configs.recommended,
1010
tseslint.configs.recommended,
11+
tseslint.configs.stylistic,
1112
eslintConfigPrettier,
1213
eslintPluginAstro.configs.recommended,
1314
{
14-
ignores: ["dist/", "node_modules/", ".astro/", "bun.lockb"],
15+
ignores: [
16+
"dist/",
17+
"node_modules/",
18+
".astro/",
19+
"bun.lockb",
20+
"src/scripts/editor/language/parser.js",
21+
"src/scripts/editor/language/parser.terms.js",
22+
],
1523
},
1624
);

eslint.types.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @ts-check
2+
3+
import mainConfig from "./eslint.config.mjs";
4+
import tseslint from "typescript-eslint";
5+
import eslintPluginAstro from "eslint-plugin-astro";
6+
7+
export default tseslint.config(
8+
...mainConfig,
9+
tseslint.configs.recommendedTypeChecked,
10+
tseslint.configs.stylisticTypeChecked,
11+
eslintPluginAstro.configs.recommended,
12+
{
13+
languageOptions: {
14+
parserOptions: {
15+
project: true,
16+
tsconfigRootDir: import.meta.dirname,
17+
},
18+
},
19+
},
20+
);

package.json

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,41 @@
33
"type": "module",
44
"version": "0.0.1",
55
"scripts": {
6-
"dev": "astro dev --host",
7-
"build": "astro build",
8-
"preview": "astro preview",
6+
"prepare": "bun run build:parser",
97
"astro": "astro",
8+
"dev": "astro dev",
9+
"preview": "bun run build:parser && astro preview",
10+
"build": "bun run build:parser && astro build",
11+
"build:parser": "lezer-generator src/scripts/editor/language/glsl.grammar -o src/scripts/editor/language/parser.js",
12+
"test": "vitest run",
13+
"test:watch": "vitest --watch",
14+
"test:ui": "vitest --ui",
1015
"lint": "eslint .",
1116
"lint:fix": "eslint . --fix",
17+
"lint:types": "eslint --config eslint.types.config.mjs .",
18+
"lint:fix:types": "eslint --config eslint.types.config.mjs . --fix",
1219
"format": "prettier --write .",
1320
"format:check": "prettier --check ."
1421
},
1522
"dependencies": {
16-
"astro": "^5.11.2",
23+
"assimpts": "^0.1.0",
24+
"astro": "^5.12.0",
1725
"autoprefixer": "^10.4.21",
1826
"codemirror": "^6.0.2",
19-
"codemirror-lang-glsl": "^0.5.0",
2027
"gl-matrix": "^3.4.3"
2128
},
2229
"devDependencies": {
30+
"@astrojs/check": "^0.9.4",
2331
"@eslint/js": "^9.31.0",
32+
"@lezer/generator": "^1.8.0",
33+
"@vitest/coverage-v8": "3.2.4",
34+
"@vitest/ui": "3.2.4",
2435
"eslint": "^9.31.0",
25-
"eslint-config-prettier": "^10.1.5",
36+
"eslint-config-prettier": "^10.1.8",
2637
"eslint-plugin-astro": "1.3.1",
2738
"prettier": "3.6.2",
2839
"prettier-plugin-astro": "0.14.1",
29-
"typescript-eslint": "^8.37.0"
40+
"typescript-eslint": "^8.37.0",
41+
"vitest": "^3.2.4"
3042
}
3143
}

src/assets/models/cube.obj

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Blender 4.5.3 LTS
2+
# www.blender.org
3+
o Cube
4+
v 1.000000 1.000000 -1.000000
5+
v -1.000000 1.000000 -1.000000
6+
v -1.000000 -1.000000 1.000000
7+
v 1.000000 1.000000 1.000000
8+
v -1.000000 1.000000 1.000000
9+
v 1.000000 -1.000000 1.000000
10+
v -1.000000 -1.000000 -1.000000
11+
v 1.000000 -1.000000 -1.000000
12+
vn -0.0000 1.0000 -0.0000
13+
vn -0.0000 -0.0000 1.0000
14+
vn -1.0000 -0.0000 -0.0000
15+
vn -0.0000 -1.0000 -0.0000
16+
vn 1.0000 -0.0000 -0.0000
17+
vn -0.0000 -0.0000 -1.0000
18+
vt 0.999900 0.000100
19+
vt 0.999900 0.999900
20+
vt 0.000100 0.999900
21+
vt 0.000100 0.000100
22+
vt -0.999700 0.000100
23+
vt -0.999700 0.999900
24+
vt 0.000100 1.999700
25+
vt 0.999900 1.999700
26+
vt 1.999700 0.999900
27+
vt 1.999700 0.000100
28+
vt 2.999499 0.000100
29+
vt 2.999499 0.999900
30+
vt 0.999900 -0.999700
31+
vt 0.000100 -0.999700
32+
s 1
33+
f 1/1/1 2/2/1 5/3/1 4/4/1
34+
f 6/5/2 4/4/2 5/3/2 3/6/2
35+
f 3/7/3 5/3/3 2/2/3 7/8/3
36+
f 7/9/4 8/10/4 6/11/4 3/12/4
37+
f 8/13/5 1/1/5 4/4/5 6/14/5
38+
f 7/9/6 2/2/6 1/1/6 8/10/6
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#version 300 es
2+
precision mediump float;
3+
4+
in vec3 FragPosition;
5+
in vec3 Normal;
6+
in vec2 TexCoord;
7+
8+
out vec4 fragColor;
9+
10+
uniform vec2 u_resolution;
11+
uniform vec4 u_mouse;
12+
uniform float u_time;
13+
uniform float u_timeDelta;
14+
uniform int u_frameNumber;
15+
16+
uniform sampler2D u_textures[8];
17+
18+
void main() {
19+
// fragColor = vec4((FragPosition + 1.0) / 2.0, 1.0);
20+
vec4 color = texture(u_textures[0], TexCoord);
21+
fragColor = vec4(color.rgb, 1.0);
22+
fragColor = vec4(TexCoord.xy, 0.0, 1.0);
23+
}

0 commit comments

Comments
 (0)