Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/tiled-renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
hsimpson committed Nov 2, 2023
2 parents 212441a + 49c9440 commit ed71c7f
Show file tree
Hide file tree
Showing 68 changed files with 2,457 additions and 2,019 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/node_modules/
.eslintrc.js
build/*
postcss.config.js
Expand Down
44 changes: 44 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
project: './tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'react'],
root: true,
rules: {
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-explicit-any': 'warn', // FIXME: turn this into a warning some day
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '[iI]gnored' }],
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-await': 'error',
'array-callback-return': 'error',
'no-console': 'warn',
'no-unused-vars': 'off',
'no-warning-comments': 'warn',
'object-shorthand': ['warn', 'always'],
curly: 'warn',
eqeqeq: 'warn',
},
settings: {
react: {
version: 'detect',
},
},
};
75 changes: 0 additions & 75 deletions .eslintrc.json

This file was deleted.

11 changes: 6 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
workflow_dispatch:

jobs:
build:
Expand All @@ -14,12 +15,12 @@ jobs:
node-version: [16.x]
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version-file: '.nvmrc'

- name: Install node_modules
run: yarn install
Expand All @@ -28,7 +29,7 @@ jobs:
run: yarn run build

- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.7
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: dist
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.9.0
18 changes: 0 additions & 18 deletions .prettierrc

This file was deleted.

9 changes: 8 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "dtoplak.vscode-glsllint"]
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"dtoplak.vscode-glsllint",
"dsznajder.es7-react-js-snippets",
"cesium.gltf-vscode",
"yoavbls.pretty-ts-errors"
]
}
19 changes: 13 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
Expand All @@ -8,27 +14,28 @@
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"css.validate": false, // vscode built-in disabled
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": true,
"source.organizeImports": true
},
"editor.formatOnSave": true,
"editor.tabSize": 2,
"files.exclude": {
"dist": true,
"node_modules": true
},
"glsllint.glslangValidatorArgs": "-V -o %temp%/shader.spv",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"typescript.tsdk": "node_modules/typescript/lib",
"github.copilot.enable": {
"wgsl": false
}
"typescript.tsdk": "node_modules/typescript/lib"
}
48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"deploy": "yarn run build && gh-pages -d dist",
"lint": "eslint ./src/ --ext .ts,.tsx"
"check-types": "tsc --noemit",
"lint:ts": "eslint . --ext .ts,.tsx --fix",
"lint": "yarn check-types && yarn lint:ts"
},
"repository": {
"type": "git",
Expand All @@ -22,33 +23,32 @@
},
"homepage": "https://github.com/hsimpson/ts-raytracer#readme",
"devDependencies": {
"@types/node": "^17.0.8",
"@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11",
"@types/node": "^20.8.10",
"@types/react": "^18.2.34",
"@types/react-dom": "^18.2.14",
"@types/recoil": "0.0.9",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"@typescript-eslint/typescript-estree": "^5.9.0",
"@vitejs/plugin-react": "^1.1.4",
"@webgpu/types": "^0.1.9",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@vitejs/plugin-react": "^4.1.1",
"@webgpu/types": "^0.1.38",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-react": "^1.1.7",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"gh-pages": "^3.2.3",
"prettier": "^2.5.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^3.0.3",
"resize-observer-polyfill": "^1.5.1",
"rimraf": "^3.0.2",
"typescript": "^4.5.4",
"vite": "^2.7.10"
"rimraf": "^5.0.5",
"typescript": "^5.2.2",
"vite": "^4.5.0"
},
"dependencies": {
"alea": "^1.0.1",
"gl-matrix": "^3.4.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"recoil": "0.5.2",
"simplex-noise": "^3.0.1"
"react": "^18.2.0",
"react-dom": "^18.2.0",
"recoil": "0.7.7",
"simplex-noise": "^4.0.1"
}
}
6 changes: 6 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
arrowParens: 'avoid',
printWidth: 140,
singleQuote: true,
trailingComma: 'all',
};
22 changes: 11 additions & 11 deletions public/assets/shaders/camera.wgsl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#include "./ray.wgsl"

struct Camera {
origin: vec4<f32>;
lowerLeftCorner: vec4<f32>;
horizontal: vec4<f32>;
vertical: vec4<f32>;
u: vec4<f32>;
v: vec4<f32>;
w: vec4<f32>;
lensRadius: f32;
t0: f32;
t1: f32;
origin: vec4<f32>,
lowerLeftCorner: vec4<f32>,
horizontal: vec4<f32>,
vertical: vec4<f32>,
u: vec4<f32>,
v: vec4<f32>,
w: vec4<f32>,
lensRadius: f32,
t0: f32,
t1: f32,
};
[[group(0), binding(1)]] var<uniform> camera: Camera;
@group(0) @binding(1) var<uniform> camera: Camera;


fn cameraGetRay(s: f32, t: f32) -> Ray {
Expand Down
22 changes: 11 additions & 11 deletions public/assets/shaders/hittable/hittable.wgsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

let HITTABLETYPE_SPHERE = 0u;
let HITTABLETYPE_MOVINGSPHERE = 1u;
let HITTABLETYPE_XYRECT = 2u;
let HITTABLETYPE_XZRECT = 3u;
let HITTABLETYPE_YZRECT = 4u;
let HITTABLETYPE_CONSTANTMEDIUM = 5u;
let HITTABLETYPE_TRIANGLE = 6u;
const HITTABLETYPE_SPHERE = 0u;
const HITTABLETYPE_MOVINGSPHERE = 1u;
const HITTABLETYPE_XYRECT = 2u;
const HITTABLETYPE_XZRECT = 3u;
const HITTABLETYPE_YZRECT = 4u;
const HITTABLETYPE_CONSTANTMEDIUM = 5u;
const HITTABLETYPE_TRIANGLE = 6u;

#include "../ray.wgsl"
#include "./hittable_base.wgsl"
Expand All @@ -18,10 +18,10 @@ let HITTABLETYPE_TRIANGLE = 6u;

fn hitPrimitve(
primitve: Primitve,
ray: ptr<function, Ray, read_write>,
ray: ptr<function, Ray>,
tMin: f32,
tMax: f32,
rec: ptr<function, HitRecord, read_write>
rec: ptr<function, HitRecord>
) -> bool {
let primitiveType = primitve.primitiveType;
var hitted: bool = false;
Expand All @@ -48,10 +48,10 @@ fn hitPrimitve(
}

fn hittableListHit(
ray: ptr<function, Ray, read_write>,
ray: ptr<function, Ray>,
tMin: f32,
tMax: f32,
rec: ptr<function, HitRecord, read_write>
rec: ptr<function, HitRecord>
) -> bool {
var tempRec: HitRecord;
var hitAnything = false;
Expand Down
Loading

0 comments on commit ed71c7f

Please sign in to comment.