rename prismarine-viewer dir to renderer to avoid confusion (#269)
This commit is contained in:
parent
b196ea5955
commit
f96673bc17
154 changed files with 239 additions and 210 deletions
18
.github/workflows/next-deploy.yml
vendored
18
.github/workflows/next-deploy.yml
vendored
|
|
@ -23,6 +23,8 @@ jobs:
|
|||
uses: pnpm/action-setup@v4
|
||||
- name: Install Global Dependencies
|
||||
run: pnpm add -g vercel
|
||||
- name: Install Dependencies
|
||||
run: pnpm install
|
||||
- name: Pull Vercel Environment Information
|
||||
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
|
||||
- name: Write Release Info
|
||||
|
|
@ -35,7 +37,7 @@ jobs:
|
|||
run: |
|
||||
mkdir -p .vercel/output/static/playground
|
||||
pnpm build-playground
|
||||
cp -r prismarine-viewer/dist/* .vercel/output/static/playground/
|
||||
cp -r renderer/dist/* .vercel/output/static/playground/
|
||||
- name: Download Generated Sounds map
|
||||
run: node scripts/downloadSoundsMap.mjs
|
||||
- name: Deploy Project Artifacts to Vercel
|
||||
|
|
@ -43,6 +45,20 @@ jobs:
|
|||
with:
|
||||
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
|
||||
id: deploy
|
||||
- name: Start servers for testing
|
||||
run: |
|
||||
nohup pnpm prod-start &
|
||||
nohup pnpm test-mc-server &
|
||||
- name: Run Cypress smoke tests
|
||||
uses: cypress-io/github-action@v5
|
||||
with:
|
||||
install: false
|
||||
spec: cypress/e2e/smoke.spec.ts
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: cypress-smoke-test-screenshots
|
||||
path: cypress/screenshots/
|
||||
- name: Set deployment aliases
|
||||
run: |
|
||||
for alias in $(echo ${{ secrets.TEST_PREVIEW_DOMAIN }} | tr "," "\n"); do
|
||||
|
|
|
|||
2
.github/workflows/preview.yml
vendored
2
.github/workflows/preview.yml
vendored
|
|
@ -66,7 +66,7 @@ jobs:
|
|||
run: |
|
||||
mkdir -p .vercel/output/static/playground
|
||||
pnpm build-playground
|
||||
cp -r prismarine-viewer/dist/* .vercel/output/static/playground/
|
||||
cp -r renderer/dist/* .vercel/output/static/playground/
|
||||
- name: Write pr redirect index.html
|
||||
run: |
|
||||
mkdir -p .vercel/output/static/pr
|
||||
|
|
|
|||
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
|
|
@ -35,7 +35,7 @@ jobs:
|
|||
run: |
|
||||
mkdir -p .vercel/output/static/playground
|
||||
pnpm build-playground
|
||||
cp -r prismarine-viewer/dist/* .vercel/output/static/playground/
|
||||
cp -r renderer/dist/* .vercel/output/static/playground/
|
||||
- name: Download Generated Sounds map
|
||||
run: node scripts/downloadSoundsMap.mjs
|
||||
- name: Deploy Project to Vercel
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ Paths:
|
|||
- `src` - main app source code
|
||||
- `src/react` - React components - almost all UI is in this folder. Almost every component has its base (reused in app and storybook) and `Provider` - which is a component that provides context to its children. Consider looking at DeathScreen component to see how it's used.
|
||||
|
||||
### Renderer: Playground & Mesher (`prismarine-viewer`)
|
||||
### Renderer: Playground & Mesher (`renderer`)
|
||||
|
||||
- Playground Scripts:
|
||||
- Start: `pnpm run-playground` (playground, mesher + server) or `pnpm watch-playground`
|
||||
- Build: `pnpm build-playground` or `node prismarine-viewer/esbuild.mjs`
|
||||
- Build: `pnpm build-playground` or `node renderer/esbuild.mjs`
|
||||
|
||||
- Mesher Scripts:
|
||||
- Start: `pnpm watch-mesher`
|
||||
|
|
@ -43,10 +43,10 @@ Paths:
|
|||
|
||||
Paths:
|
||||
|
||||
- `prismarine-viewer` - Improved and refactored version of <https://github.com/prismarineJS/prismarine-viewer>. Here is everything related to rendering the game world itself (no ui at all). Two most important parts here are:
|
||||
- `prismarine-viewer/viewer/lib/worldrenderer.ts` - adding new objects to three.js happens here (sections)
|
||||
- `prismarine-viewer/viewer/lib/models.ts` - preparing data for rendering (blocks) - happens in worker: out file - `worker.js`, building - `prismarine-viewer/buildWorker.mjs`
|
||||
- `prismarine-viewer/examples/playground.ts` - Playground (source of <mcraft.fun/playground.html>) Use this for testing any rendering changes. You can also modify the playground code.
|
||||
- `renderer` - Improved and refactored version of <https://github.com/PrismarineJS/prismarine-viewer>. Here is everything related to rendering the game world itself (no ui at all). Two most important parts here are:
|
||||
- `renderer/viewer/lib/worldrenderer.ts` - adding new objects to three.js happens here (sections)
|
||||
- `renderer/viewer/lib/models.ts` - preparing data for rendering (blocks) - happens in worker: out file - `worker.js`, building - `renderer/buildWorker.mjs`
|
||||
- `renderer/playground/playground.ts` - Playground (source of <mcraft.fun/playground.html>) Use this for testing any rendering changes. You can also modify the playground code.
|
||||
|
||||
### Storybook (`.storybook`)
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ Cypress tests are located in `cypress` folder. To run them, run `pnpm test-mc-se
|
|||
## Unit Tests
|
||||
|
||||
There are not many unit tests for now (which we are trying to improve).
|
||||
Location of unit tests: `**/*.test.ts` files in `src` folder and `prismarine-viewer` folder.
|
||||
Location of unit tests: `**/*.test.ts` files in `src` folder and `renderer` folder.
|
||||
Start them with `pnpm test-unit`.
|
||||
|
||||
## Making protocol-related changes
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ RUN if [ "$DOWNLOAD_SOUNDS" = "true" ] ; then node scripts/downloadSoundsMap.mjs
|
|||
# TODO for development
|
||||
# EXPOSE 9090
|
||||
# VOLUME /app/src
|
||||
# VOLUME /app/prismarine-viewer
|
||||
# VOLUME /app/renderer
|
||||
# ENTRYPOINT ["pnpm", "run", "run-all"]
|
||||
|
||||
# only for prod
|
||||
|
|
|
|||
10
package.json
10
package.json
|
|
@ -16,19 +16,19 @@
|
|||
"test:e2e": "start-test http-get://localhost:8080 test:cypress",
|
||||
"prod-start": "node server.js --prod",
|
||||
"test-mc-server": "tsx cypress/minecraft-server.mjs",
|
||||
"lint": "eslint \"{src,cypress,prismarine-viewer}/**/*.{ts,js,jsx,tsx}\"",
|
||||
"lint": "eslint \"{src,cypress,renderer}/**/*.{ts,js,jsx,tsx}\"",
|
||||
"lint-fix": "pnpm lint --fix",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"build-storybook": "storybook build && node scripts/build.js moveStorybookFiles",
|
||||
"start-experiments": "vite --config experiments/vite.config.ts --host",
|
||||
"watch-other-workers": "echo NOT IMPLEMENTED",
|
||||
"build-other-workers": "echo NOT IMPLEMENTED",
|
||||
"build-mesher": "node prismarine-viewer/buildMesherWorker.mjs",
|
||||
"build-mesher": "node renderer/buildMesherWorker.mjs",
|
||||
"watch-mesher": "pnpm build-mesher -w",
|
||||
"run-playground": "run-p watch-mesher watch-other-workers watch-playground",
|
||||
"run-all": "run-p start run-playground",
|
||||
"build-playground": "rsbuild build --config prismarine-viewer/rsbuild.config.ts",
|
||||
"watch-playground": "rsbuild dev --config prismarine-viewer/rsbuild.config.ts"
|
||||
"build-playground": "rsbuild build --config renderer/rsbuild.config.ts",
|
||||
"watch-playground": "rsbuild dev --config renderer/rsbuild.config.ts"
|
||||
},
|
||||
"keywords": [
|
||||
"prismarine",
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
"os-browserify": "^0.3.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"path-exists-cli": "^2.0.0",
|
||||
"prismarine-viewer": "link:prismarine-viewer",
|
||||
"renderer": "link:renderer",
|
||||
"process": "github:PrismarineJS/node-process",
|
||||
"rimraf": "^5.0.1",
|
||||
"storybook": "^7.4.6",
|
||||
|
|
|
|||
16
pnpm-lock.yaml
generated
16
pnpm-lock.yaml
generated
|
|
@ -369,12 +369,12 @@ importers:
|
|||
path-exists-cli:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
prismarine-viewer:
|
||||
specifier: link:prismarine-viewer
|
||||
version: link:prismarine-viewer
|
||||
process:
|
||||
specifier: github:PrismarineJS/node-process
|
||||
version: https://codeload.github.com/PrismarineJS/node-process/tar.gz/380d0b4f4c86f1b65b216c311bf00431f314e88e
|
||||
renderer:
|
||||
specifier: link:renderer
|
||||
version: link:renderer
|
||||
rimraf:
|
||||
specifier: ^5.0.1
|
||||
version: 5.0.1
|
||||
|
|
@ -400,7 +400,7 @@ importers:
|
|||
specifier: ^2.3.2
|
||||
version: 2.4.1
|
||||
|
||||
prismarine-viewer:
|
||||
renderer:
|
||||
dependencies:
|
||||
'@tweenjs/tween.js':
|
||||
specifier: ^20.0.3
|
||||
|
|
@ -435,12 +435,12 @@ importers:
|
|||
prismarine-schematic:
|
||||
specifier: ^1.2.0
|
||||
version: 1.2.3
|
||||
prismarine-viewer:
|
||||
specifier: link:./
|
||||
version: 'link:'
|
||||
process:
|
||||
specifier: ^0.11.10
|
||||
version: 0.11.10
|
||||
renderer:
|
||||
specifier: link:./
|
||||
version: 'link:'
|
||||
socket.io:
|
||||
specifier: ^4.0.0
|
||||
version: 4.7.2
|
||||
|
|
@ -471,7 +471,7 @@ importers:
|
|||
specifier: ^1.2.2
|
||||
version: 1.2.2
|
||||
|
||||
prismarine-viewer/viewer/sign-renderer:
|
||||
renderer/viewer/sign-renderer:
|
||||
dependencies:
|
||||
vite:
|
||||
specifier: ^4.4.9
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
packages:
|
||||
- "."
|
||||
- "prismarine-viewer"
|
||||
- "prismarine-viewer/viewer/sign-renderer/"
|
||||
- "renderer"
|
||||
- "renderer/viewer/sign-renderer/"
|
||||
|
|
|
|||
5
prismarine-viewer/README.MD
Normal file
5
prismarine-viewer/README.MD
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Prismarine Viewer
|
||||
|
||||
Renamed to `renderer`.
|
||||
|
||||
For more info see [CONTRIBUTING.md](../CONTRIBUTING.md).
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "prismarine-viewer",
|
||||
"name": "renderer",
|
||||
"version": "1.25.0",
|
||||
"description": "Web based viewer",
|
||||
"main": "index.js",
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
"prismarine-block": "^1.7.3",
|
||||
"prismarine-chunk": "^1.22.0",
|
||||
"prismarine-schematic": "^1.2.0",
|
||||
"prismarine-viewer": "link:./",
|
||||
"renderer": "link:./",
|
||||
"process": "^0.11.10",
|
||||
"socket.io": "^4.0.0",
|
||||
"socket.io-client": "^4.0.0",
|
||||
|
|
@ -104,6 +104,17 @@ export class BasePlaygroundScene {
|
|||
}
|
||||
if (window.innerHeight < 700) {
|
||||
this.gui.open(false)
|
||||
} else {
|
||||
// const observer = new MutationObserver(() => {
|
||||
// this.gui.domElement.classList.remove('transition')
|
||||
// })
|
||||
// observer.observe(this.gui.domElement, {
|
||||
// attributes: true,
|
||||
// attributeFilter: ['class'],
|
||||
// })
|
||||
setTimeout(() => {
|
||||
this.gui.domElement.classList.remove('transition')
|
||||
}, 500)
|
||||
}
|
||||
|
||||
this.gui.onChange(({ property, object }) => {
|
||||
|
|
@ -222,7 +222,7 @@ class MainScene extends BasePlaygroundScene {
|
|||
})
|
||||
|
||||
const zip = new JSZip()
|
||||
zip.file('description.txt', 'Generated with prismarine-viewer')
|
||||
zip.file('description.txt', 'Generated with mcraft.fun/playground')
|
||||
|
||||
const end = async () => {
|
||||
// download zip file
|
||||
|
|
@ -30,7 +30,7 @@ export default mergeRsbuildConfig(
|
|||
},
|
||||
source: {
|
||||
entry: {
|
||||
index: join(__dirname, './examples/playground.ts')
|
||||
index: join(__dirname, './playground/playground.ts')
|
||||
},
|
||||
define: {
|
||||
'globalThis.includedVersions': JSON.stringify(supportedVersions),
|
||||
|
|
@ -304,6 +304,7 @@ export function getMesh (
|
|||
mesh.scale.set(1 / 16, 1 / 16, 1 / 16)
|
||||
|
||||
if (textureOffset) {
|
||||
// todo(memory) dont clone
|
||||
const loadedTexture = blocksTexture.clone()
|
||||
loadedTexture.offset.set(textureOffset[0], textureOffset[1])
|
||||
loadedTexture.needsUpdate = true
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { Vec3 } from 'vec3'
|
||||
import worldBlockProvider, { WorldBlockProvider } from 'mc-assets/dist/worldBlockProvider'
|
||||
import legacyJson from '../../../../src/preflatMap.json'
|
||||
import { BlockType } from '../../../examples/shared'
|
||||
import { BlockType } from '../../../playground/shared'
|
||||
import { World, BlockModelPartsResolved, WorldBlock as Block } from './world'
|
||||
import { BlockElement, buildRotationMatrix, elemFaces, matmul3, matmulmat3, vecadd3, vecsub3 } from './modelsGeometryCommon'
|
||||
import { INVISIBLE_BLOCKS } from './worldConstants'
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { BlockType } from '../../../examples/shared'
|
||||
import { BlockType } from '../../../playground/shared'
|
||||
|
||||
export const defaultMesherConfig = {
|
||||
version: '',
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue