-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Adding Boi to couple of places #1417
Open
infomiho
wants to merge
2
commits into
main
Choose a base branch
from
miho-boi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import React, { Suspense, useRef, useEffect } from "react"; | ||
import { Canvas, useLoader, useThree } from "@react-three/fiber"; | ||
import { OrbitControls, Environment, useTexture } from "@react-three/drei"; | ||
import { FBXLoader } from "three/examples/jsm/loaders/FBXLoader"; | ||
import { Box3, Vector3 } from "three"; | ||
|
||
function Model() { | ||
const fbx = useLoader(FBXLoader, "/boi/Models/bee_low.fbx"); | ||
const [baseColorMap, heightMap, metallicMap, normalMap, roughnessMap] = | ||
useTexture([ | ||
"/boi/Textures/bee_low_body_low_BaseColor.png", | ||
"/boi/Textures/bee_low_body_low_Height.png", | ||
"/boi/Textures/bee_low_body_low_Metallic.png", | ||
"/boi/Textures/bee_low_body_low_Normal.png", | ||
"/boi/Textures/bee_low_body_low_Roughness.png", | ||
]); | ||
|
||
fbx.scale.set(0.6, 0.6, 0.6); | ||
fbx.position.y = 1; | ||
fbx.position.x = 0; | ||
fbx.rotation.z = -0.1; | ||
|
||
fbx.traverse((o) => { | ||
if (o.isMesh) { | ||
o.material.map = baseColorMap; | ||
o.material.displacementMap = heightMap; | ||
o.material.metalnessMap = metallicMap; | ||
o.material.normalMap = normalMap; | ||
o.material.roughnessMap = roughnessMap; | ||
o.castShadow = true; | ||
o.receiveShadow = true; | ||
} | ||
}); | ||
|
||
return ( | ||
<> | ||
<primitive object={fbx} /> | ||
{fbx && <Controls model={fbx} />} | ||
</> | ||
); | ||
} | ||
|
||
function Lights() { | ||
return ( | ||
<> | ||
<directionalLight position={[8, 8, 2]} intensity={2} castShadow /> | ||
<hemisphereLight | ||
color={"#ffffff"} | ||
groundColor={"#b3858c"} | ||
intensity={2} | ||
/> | ||
<spotLight | ||
color={0xffffff} | ||
intensity={100} | ||
position={[2.5, 5, 2.5]} | ||
angle={Math.PI / 6} | ||
penumbra={1} | ||
decay={2} | ||
distance={0} | ||
castShadow | ||
shadow-mapSize-width={1024} | ||
shadow-mapSize-height={1024} | ||
shadow-camera-near={1} | ||
shadow-camera-far={10} | ||
shadow-focus={1} | ||
/> | ||
</> | ||
); | ||
} | ||
|
||
function Controls({ model }) { | ||
const { camera, gl } = useThree(); | ||
|
||
const controls = useRef(); | ||
|
||
useEffect(() => { | ||
if (!controls.current) { | ||
return; | ||
} | ||
if (!model) { | ||
return; | ||
} | ||
const box = new Box3().setFromObject(model); | ||
const center = box.getCenter(new Vector3()); | ||
controls.current.target.copy(center); | ||
}, [model]); | ||
|
||
return ( | ||
<OrbitControls | ||
ref={controls} | ||
args={[camera, gl.domElement]} | ||
enablePan={false} | ||
enableZoom={false} | ||
enableDamping={true} | ||
dampingFactor={0.1} | ||
autoRotate={true} | ||
autoRotateSpeed={2} | ||
minPolarAngle={Math.PI / 2} | ||
maxPolarAngle={Math.PI / 2} | ||
minAzimuthAngle={-Math.PI / 2} | ||
/> | ||
); | ||
} | ||
|
||
export default function DaBoi({ height = 200, width = 200 }) { | ||
return ( | ||
<Canvas | ||
style={{ | ||
height, | ||
width, | ||
background: "transparent", | ||
}} | ||
camera={{ position: [0, 0, 245], fov: 50, near: 0.1, far: 1000 }} | ||
> | ||
<Suspense fallback={null}> | ||
<Model /> | ||
<Environment | ||
files={[ | ||
"/boi/pisa/px.png", | ||
"/boi/pisa/nx.png", | ||
"/boi/pisa/py.png", | ||
"/boi/pisa/ny.png", | ||
"/boi/pisa/pz.png", | ||
"/boi/pisa/nz.png", | ||
]} | ||
/> | ||
</Suspense> | ||
<Lights /> | ||
</Canvas> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, { Suspense, lazy } from "react"; | ||
import { | ||
BreakPointHooks, | ||
breakpointsTailwind, | ||
} from "@react-hooks-library/core"; | ||
import SectionContainer from "./Layouts/SectionContainer"; | ||
import { DiscordIcon } from "./Nav/SocialIcons"; | ||
|
||
const { useGreater } = BreakPointHooks(breakpointsTailwind); | ||
|
||
const DaBoi = lazy(() => import("./DaBoi")); | ||
|
||
export function DiscordCallout() { | ||
const isGreaterMd = useGreater("md"); | ||
|
||
return ( | ||
<SectionContainer className="space-y-16 lg:py-18"> | ||
<div className="flex justify-between items-center bg-gray-200 rounded-xl p-16 pl-16 relative"> | ||
<div className="space-y-6 max-w-prose"> | ||
<div className="space-y-2"> | ||
<h2 className="text-4xl font-bold text-gray-900">Meet Da Boi</h2> | ||
<p className="text-gray-600 text-lg leading-relaxed"> | ||
Da Boi is our community mascot. He's a friendly little guy who | ||
loves to code and hang out with his friends. Join our Discord to | ||
meet him and the rest of the community! | ||
</p> | ||
</div> | ||
<a | ||
href="https://discord.gg/rzdnErX" | ||
className="inline-flex gap-2 items-center space-x-2 | ||
px-3 py-2 rounded | ||
bg-yellow-500 text-white text-sm leading-4 | ||
border border-yellow-500 hover:border-yellow-400 | ||
hover:bg-yellow-400 | ||
transition ease-out duration-200" | ||
> | ||
Join Discord <DiscordIcon /> | ||
</a> | ||
</div> | ||
<div | ||
className="absolute right-1 top-1/2 -translate-y-1/2" | ||
style={{ | ||
width: 400, | ||
height: 400, | ||
}} | ||
> | ||
{isGreaterMd && ( | ||
<Suspense fallback={null}> | ||
<DaBoi height={400} width={400} /> | ||
</Suspense> | ||
)} | ||
</div> | ||
</div> | ||
</SectionContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think boi fits well here, it messes up the page a bit too much in my opinion.
What about putting it up in the navbar instead?