Skip to content

Commit

Permalink
fix dice loading smh
Browse files Browse the repository at this point in the history
  • Loading branch information
Platane committed Aug 11, 2024
1 parent dc2d112 commit d44926e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
13 changes: 3 additions & 10 deletions src/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { PickHint } from "./Ui/Hints/PickHint";
import { PullHint } from "./Ui/Hints/PullHint";
import { useDelay } from "./Ui/useDelay";
import { GithubLogo } from "./Ui/GithubLogo";
import { Canvas } from "@react-three/fiber";
import { Canvas, useFrame, useThree } from "@react-three/fiber";
import { XR8Controls } from "../XR8Canvas/XR8Controls";
import { useXR8 } from "../XR8Canvas/useXR8";
// @ts-ignore
Expand Down Expand Up @@ -112,13 +112,7 @@ export const App = ({ onReady, onProgress, started }: Props) => {
{xr8 && <XR8Controls xr8={xr8} onReady={() => setXr8Ready(true)} />}

<React.Suspense fallback={null}>
{false && (
<Environment
environmentIntensity={0.4}
path={"assets/"}
files={"lebombo_1k.hdr"}
/>
)}
<Environment path={"assets/"} files={"lebombo_1k.hdr"} />

<Board
status={status}
Expand All @@ -129,8 +123,7 @@ export const App = ({ onReady, onProgress, started }: Props) => {
/>
</React.Suspense>

{false && <ambientLight intensity={0.1} />}
<directionalLight position={[10, 8, 6]} intensity={0.8} castShadow />
<directionalLight position={[10, 8, 6]} intensity={0} castShadow />

<Target />

Expand Down
14 changes: 12 additions & 2 deletions src/App/Scene/Dice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,27 @@ type Props = {
export const Dice = ({ selected, ...props }: Props) => {
const { nodes, materials } = useGLTF(diceUrl);

const mesh = nodes.mesh_0 as THREE.Mesh;
const mat = materials.Dice as THREE.MeshStandardMaterial;

return (
<mesh
{...props}
castShadow
geometry={(nodes.mesh_0 as any).geometry}
geometry={mesh.geometry}
material={mesh.material}
scale={scale}
dispose={null}
>
<meshStandardMaterial {...mat} color={selected ? "hotpink" : mat.color} />
{false && <boxGeometry args={[2, 2, 2]} />}
{false && <meshStandardMaterial color="#ab34ef" />}

{false && (
<meshStandardMaterial
{...mat}
color={selected ? "hotpink" : mat.color}
/>
)}
</mesh>
);
};

0 comments on commit d44926e

Please sign in to comment.