Skip to content

v2.3.1 #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/worlds/Multiplayer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StandardReality, Background } from "spacesvr";
import { StandardReality, Background, Model } from "spacesvr";
import LightSwitch from "./ideas/LightSwitch";

export default function Multiplayer() {
Expand All @@ -15,6 +15,7 @@ export default function Multiplayer() {
<planeBufferGeometry args={[200, 200]} />
<meshBasicMaterial color={"purple"} />
</mesh>
<Model src="https://d27rt3a60hh1lx.cloudfront.net/models/Camera-1652915410/camera_02_cleaned.glb.gz" />
</StandardReality>
);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spacesvr",
"version": "2.3.0",
"version": "2.3.1",
"private": true,
"description": "A standardized reality for future of the 3D Web",
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions src/ideas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export * from "./physical/Fog";
export * from "./physical/Frame";
export * from "./physical/HDRI";
export * from "./physical/InfinitePlane";
export * from "./physical/Model";
export * from "./physical/Video";
32 changes: 32 additions & 0 deletions src/ideas/physical/Model.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Fragment, Suspense } from "react";
import { GroupProps } from "@react-three/fiber";
import { Center } from "@react-three/drei";
import { useModel } from "../../logic";

type ModelProps = {
src: string;
center?: boolean;
} & GroupProps;

function UnsuspensedModel(props: ModelProps) {
const { src, center, ...rest } = props;
const gltf = useModel(src);

const Parent = center ? Center : Fragment;

return (
<group name="spacesvr-model" {...rest}>
<Parent>
<primitive object={gltf.scene} />
</Parent>
</group>
);
}

export function Model(props: ModelProps) {
return (
<Suspense fallback={null}>
<UnsuspensedModel {...props} />
</Suspense>
);
}
2 changes: 1 addition & 1 deletion src/layers/Environment/ui/PauseMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function PauseMenu(props: PauseMenuProps) {
const PAUSE_ITEMS: PauseItem[] = [
...pauseMenuItems,
{
text: "v2.3.0",
text: "v2.3.1",
link: "https://www.npmjs.com/package/spacesvr",
},
...menuItems,
Expand Down
2 changes: 2 additions & 0 deletions src/layers/Network/logic/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type ConnectionState = {
connections: Map<string, DataConnection>;
voiceStreams: Map<string, MediaStream>;
disconnect: () => void;
voice: boolean;
setVoice: (v: boolean) => void;
} & Pick<Channels, "useChannel">;

Expand Down Expand Up @@ -133,6 +134,7 @@ export const useConnection = (
connections,
voiceStreams,
useChannel: channels.useChannel,
voice,
setVoice,
};
};