Skip to content

Commit

Permalink
Moved to web worlding package.
Browse files Browse the repository at this point in the history
  • Loading branch information
evankirkiles committed Dec 12, 2022
1 parent 8a8fa15 commit d257c45
Show file tree
Hide file tree
Showing 59 changed files with 62 additions and 4,366 deletions.
13 changes: 2 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,22 @@
"@supabase/auth-helpers-nextjs": "^0.2.9",
"@supabase/auth-helpers-react": "^0.2.3",
"@supabase/supabase-js": "^1.35.7",
"camera-controls": "^1.37.2",
"cannon-es": "^0.19.0",
"cannon-es-debugger": "^1.0.0",
"gamepads": "^1.2.2",
"hamburger-react": "^2.5.0",
"hash-wasm": "^4.9.0",
"lazysizes": "^5.3.2",
"lodash": "^4.17.21",
"next": "12.3.1",
"next-seo": "^5.5.0",
"nipplejs": "^0.10.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-draggable": "^4.4.5",
"react-icons": "^4.4.0",
"react-imgix": "^9.5.4",
"react-query": "^3.39.2",
"react-scrolllock": "^5.0.1",
"react-textarea-autosize": "^8.3.4",
"react-transition-group": "^4.4.5",
"three": "^0.142.0",
"three-mesh-bvh": "^0.5.14",
"three-stdlib": "^2.12.1",
"three-to-cannon": "^4.1.0",
"uuid": "^9.0.0"
"uuid": "^9.0.0",
"web-worlding": "^0.1.3"
},
"devDependencies": {
"@types/lodash": "^4.14.186",
Expand Down
35 changes: 22 additions & 13 deletions src/components/Space/Space.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
* 2022 the nobot space,
*/
import { useEffect, useRef, useState } from 'react';
import * as APIt from '../../supabase/types';
import { World } from './game/world/World';
import type World from 'web-worlding';
import { AiOutlineCamera, AiOutlineUser } from 'react-icons/ai';
import s from './Space.module.scss';
import { InputButton } from './game/enums/UserInputs';
import { InputButton } from 'web-worlding/dist/enums/UserInputs';

type SpaceProps = {
world: string;
Expand Down Expand Up @@ -44,16 +43,26 @@ const Space: React.FC<SpaceProps> = function Space({ world }) {
worldRef.current.destroy();
}
// now rebuild it with the better world
worldRef.current = new World(canvasRef.current!, world, {
onDownloadFinish: () => setIsLoading(false),
onDownloadProgress: (p: number, d: number, t: number) => {
if (loadingRef.current && loadingDRef.current && loadingTRef.current) {
loadingRef.current.style.transform = `scaleX(${p})`;
loadingDRef.current.textContent = formatBytes(d, 1);
loadingTRef.current.textContent = formatBytes(t, 1);
}
},
});
var WebWorld: typeof World = require('web-worlding').default;
worldRef.current = new WebWorld(
canvasRef.current!,
'/assets/characters/personspace.glb',
world,
{
onDownloadFinish: () => setIsLoading(false),
onDownloadProgress: (p: number, d: number, t: number) => {
if (
loadingRef.current &&
loadingDRef.current &&
loadingTRef.current
) {
loadingRef.current.style.transform = `scaleX(${p})`;
loadingDRef.current.textContent = formatBytes(d, 1);
loadingTRef.current.textContent = formatBytes(t, 1);
}
},
}
);
}, [world]);

return (
Expand Down
284 changes: 0 additions & 284 deletions src/components/Space/game/core/CameraOperator.ts

This file was deleted.

Loading

1 comment on commit d257c45

@vercel
Copy link

@vercel vercel bot commented on d257c45 Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.