Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mquangdev committed May 2, 2024
1 parent 25b3295 commit df63f6d
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 51 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PUBLIC_URL=.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/3D-Portfolio/src/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/src/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/3D-Portfolio/src/main.jsx"></script>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"homepage": "http://mquangdev.github.io/3D-Portfolio",
"name": "react-three-fiber-starter",
"private": true,
"version": "0.0.0",
Expand Down
12 changes: 6 additions & 6 deletions src/components/Avatar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { useAnimations, useFBX, useGLTF, useScroll } from "@react-three/drei";
import { useFrame } from "@react-three/fiber";
import * as THREE from "three";
export default function Avatar(props) {
const { nodes, materials } = useGLTF("./../../public/models/Me.glb");
const { nodes, materials } = useGLTF("./models/Me.glb");
const { animations: idleAnimation } = useFBX(
"/animations/Breathing_Idle.fbx"
"./animations/Breathing_Idle.fbx"
);
const { animations: walkingAnimation } = useFBX("/animations/Walking.fbx");
const { animations: walkingAnimation } = useFBX("./animations/Walking.fbx");
const group = useRef();
const [animation, setAnimation] = useState("idle");
idleAnimation[0].name = "idle";
Expand Down Expand Up @@ -115,6 +115,6 @@ export default function Avatar(props) {
);
}

useGLTF.preload("./../../public/models/Me.glb");
useFBX.preload("/animations/Breathing_Idle.fbx");
useFBX.preload("/animations/Walking.fbx");
useGLTF.preload("./models/Me.glb");
useFBX.preload("./animations/Breathing_Idle.fbx");
useFBX.preload("./animations/Walking.fbx");
4 changes: 2 additions & 2 deletions src/components/Balloon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useGLTF } from "@react-three/drei";
import React from "react";

export function Balloon(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/Balloon.glb");
const { nodes, materials } = useGLTF("./models/Balloon.glb");
return (
<group {...props} dispose={null}>
<mesh geometry={nodes.Balloon007.geometry} material={materials.phong1SG}>
Expand All @@ -18,4 +18,4 @@ export function Balloon(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Balloon.glb");
useGLTF.preload("./models/Balloon.glb");
13 changes: 5 additions & 8 deletions src/components/BlackPanther.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
import * as THREE from "three";
export default function BlackPanther(props) {
const group = useRef();
const { animations } = useGLTF("/3D-Portfolio/models/black_panther.glb");
const nodes = useLoader(GLTFLoader, "/3D-Portfolio/models/black_panther.glb")[
"nodes"
const { animations } = useGLTF("./models/black_panther.glb");
const nodes = useLoader(GLTFLoader, "./models/black_panther.glb")["nodes"];
const materials = useLoader(GLTFLoader, "./models/black_panther.glb")[
"materials"
];
const materials = useLoader(
GLTFLoader,
"/3D-Portfolio/models/black_panther.glb"
)["materials"];
const { actions } = useAnimations(animations, group);
return (
<group ref={group} {...props} dispose={null}>
Expand Down Expand Up @@ -130,4 +127,4 @@ export default function BlackPanther(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/black_panther.glb");
useGLTF.preload("./models/black_panther.glb");
4 changes: 2 additions & 2 deletions src/components/BookCase.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useGLTF } from "@react-three/drei";
import React from "react";

export function BookCase(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/BookCaseWide.glb");
const { nodes, materials } = useGLTF("./models/BookCaseWide.glb");
return (
<group {...props} dispose={null}>
<group rotation={[Math.PI / 2, 0, 0]}>
Expand Down Expand Up @@ -53,4 +53,4 @@ export function BookCase(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/BookCaseWide.glb");
useGLTF.preload("./models/BookCaseWide.glb");
10 changes: 4 additions & 6 deletions src/components/Cat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
import * as THREE from "three";
export default function Cat(props) {
const group = useRef();
const { animations } = useGLTF("/3D-Portfolio/models/Cat.glb");
const nodes = useLoader(GLTFLoader, "/3D-Portfolio/models/Cat.glb")["nodes"];
const materials = useLoader(GLTFLoader, "/3D-Portfolio/models/Cat.glb")[
"materials"
];
const { animations } = useGLTF("./models/Cat.glb");
const nodes = useLoader(GLTFLoader, "./models/Cat.glb")["nodes"];
const materials = useLoader(GLTFLoader, "./models/Cat.glb")["materials"];
const { actions } = useAnimations(animations, group);
console.log(actions);
useEffect(() => {
Expand Down Expand Up @@ -91,4 +89,4 @@ export default function Cat(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Cat.glb");
useGLTF.preload("./models/Cat.glb");
4 changes: 2 additions & 2 deletions src/components/CouchSmall.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useGLTF } from "@react-three/drei";
import React from "react";

export function CouchSmall(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/Couch Small.glb");
const { nodes, materials } = useGLTF("./models/Couch Small.glb");
return (
<group {...props} dispose={null}>
<group rotation={[-Math.PI / 2, 0, 0]} scale={100}>
Expand All @@ -25,4 +25,4 @@ export function CouchSmall(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Couch Small.glb");
useGLTF.preload("./models/Couch Small.glb");
4 changes: 2 additions & 2 deletions src/components/Lamp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useGLTF } from "@react-three/drei";
import React from "react";

export function Lamp(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/Lamp.glb");
const { nodes, materials } = useGLTF("./models/Lamp.glb");
return (
<group {...props} dispose={null}>
<group position={[0.326, 0.78, -0.505]} rotation={[-1.419, 0.087, 2.088]}>
Expand Down Expand Up @@ -39,4 +39,4 @@ export function Lamp(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Lamp.glb");
useGLTF.preload("./models/Lamp.glb");
4 changes: 2 additions & 2 deletions src/components/Laptop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useGLTF } from "@react-three/drei";
import React from "react";

export function Laptop(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/Laptop.glb");
const { nodes, materials } = useGLTF("./models/Laptop.glb");
return (
<group {...props} dispose={null}>
<mesh
Expand All @@ -31,4 +31,4 @@ export function Laptop(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Laptop.glb");
useGLTF.preload("./models/Laptop.glb");
4 changes: 2 additions & 2 deletions src/components/Larmbogini.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useRef } from "react";
import { useGLTF } from "@react-three/drei";

export function Larmbogini(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/larmbogini.glb");
const { nodes, materials } = useGLTF("./models/larmbogini.glb");
return (
<group {...props} dispose={null}>
<group rotation={[-Math.PI / 2, 0, 0]}>
Expand Down Expand Up @@ -59,4 +59,4 @@ export function Larmbogini(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/larmbogini.glb");
useGLTF.preload("./models/larmbogini.glb");
4 changes: 2 additions & 2 deletions src/components/MacBookPro.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useGLTF, useTexture } from "@react-three/drei";
import React from "react";

export function MacBookPro(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/MacBook Pro.glb");
const { nodes, materials } = useGLTF("./models/MacBook Pro.glb");
const screenTexture = useTexture("textures/screen.jpg");
return (
<group {...props} dispose={null}>
Expand Down Expand Up @@ -51,4 +51,4 @@ export function MacBookPro(props) {
</group>
);
}
useGLTF.preload("/3D-Portfolio/models/MacBook Pro.glb");
useGLTF.preload("./models/MacBook Pro.glb");
4 changes: 2 additions & 2 deletions src/components/Mailbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as THREE from "three";
import { config } from "../config";

export function Mailbox(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/Mailbox v2.glb");
const { nodes, materials } = useGLTF("./models/Mailbox v2.glb");
const [mailboxHovered, setMailboxHovered] = useState(false);
useCursor(mailboxHovered);
useEffect(() => {
Expand Down Expand Up @@ -193,4 +193,4 @@ export function Mailbox(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Mailbox v2.glb");
useGLTF.preload("./models/Mailbox v2.glb");
4 changes: 2 additions & 2 deletions src/components/Monitor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useGLTF } from "@react-three/drei";
import React from "react";

export function Monitor(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/Monitor.glb");
const { nodes, materials } = useGLTF("./models/Monitor.glb");

return (
<group {...props} dispose={null}>
Expand All @@ -17,4 +17,4 @@ export function Monitor(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Monitor.glb");
useGLTF.preload("./models/Monitor.glb");
4 changes: 2 additions & 2 deletions src/components/PalmTree.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useGLTF } from "@react-three/drei";
import React from "react";

export function PalmTree(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/Palm tree.glb");
const { nodes, materials } = useGLTF("./models/Palm tree.glb");
return (
<group {...props} dispose={null}>
<mesh
Expand All @@ -27,4 +27,4 @@ export function PalmTree(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Palm tree.glb");
useGLTF.preload("./models/Palm tree.glb");
4 changes: 2 additions & 2 deletions src/components/ParkBench.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useGLTF } from "@react-three/drei";
import React from "react";

export function ParkBench(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/Park Bench.glb");
const { nodes, materials } = useGLTF("./models/Park Bench.glb");
return (
<group {...props} dispose={null}>
<mesh
Expand All @@ -23,4 +23,4 @@ export function ParkBench(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Park Bench.glb");
useGLTF.preload("./models/Park Bench.glb");
6 changes: 2 additions & 4 deletions src/components/Pigeon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import React, { useEffect, useRef, useState } from "react";

export function Pigeon(props) {
const group = useRef();
const { nodes, materials, animations } = useGLTF(
"/3D-Portfolio/models/Pigeon.gltf"
);
const { nodes, materials, animations } = useGLTF("./models/Pigeon.gltf");
const { actions } = useAnimations(animations, group);
const [animation, setAnimation] = useState("Flying_Idle");
useEffect(() => {
Expand Down Expand Up @@ -65,4 +63,4 @@ export function Pigeon(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Pigeon.gltf");
useGLTF.preload("./models/Pigeon.gltf");
4 changes: 2 additions & 2 deletions src/components/Star.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useFrame } from "@react-three/fiber";
import React, { useRef } from "react";

export function Star(props) {
const { nodes, materials } = useGLTF("/3D-Portfolio/models/Star.gltf");
const { nodes, materials } = useGLTF("./models/Star.gltf");
const ref = useRef();
useFrame(() => {
ref.current.rotation.y += 0.06;
Expand All @@ -25,4 +25,4 @@ export function Star(props) {
);
}

useGLTF.preload("/3D-Portfolio/models/Star.gltf");
useGLTF.preload("./models/Star.gltf");

0 comments on commit df63f6d

Please sign in to comment.