Skip to content

Commit

Permalink
refact: Object->Models로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
5nxtnxtnxt committed Nov 20, 2023
1 parent 2cc1356 commit 372df93
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions front/src/components/SnowGlobeCanvas/SnowGlobeCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as THREE from 'three';
import { useRef } from 'react';
import { getDecoPoisition } from '../../utils/position';
import mock from '../../mockdata.json';
import * as Object from './objects/index';
import * as Models from './models/index';

const CanvasBox = styled.div`
margin: auto;
Expand All @@ -20,9 +20,8 @@ const SnowGlobeCanvas = () => {
const isClicked = useRef<boolean>(false);
const glassRadius = 7;
const glassPosition = new THREE.Vector3(0, glassRadius / 2, 0);

const snows = Array.from({ length: 100 }, (_, i) => (
<Object.Snow
<Models.Snow
key={i}
centerPosition={glassPosition}
rangeRadius={glassRadius}
Expand All @@ -32,7 +31,7 @@ const SnowGlobeCanvas = () => {
const decos = mock.snowball[0].message.map((deco, index) => {
// console.log(deco);
return (
<Object.Deco
<Models.Deco
key={index}
id={deco.deco_id}
scale={1}
Expand All @@ -55,20 +54,20 @@ const SnowGlobeCanvas = () => {
castShadow
/>

<Object.Raycaster isClickedRef={isClicked} />
<Object.Ground scale={1} position={new THREE.Vector3(0, 0, 0)} />
<Object.Glass
<Models.Raycaster isClickedRef={isClicked} />
<Models.Ground scale={1} position={new THREE.Vector3(0, 0, 0)} />
<Models.Glass
position={new THREE.Vector3(0, glassRadius / 2, 0)}
color={new THREE.Color('skyblue')}
radius={glassRadius}
opacity={0.1}
/>
<Object.MainDeco
<Models.MainDeco
id={mock.snowball[0].main_deco_id}
scale={1}
position={new THREE.Vector3(0, 10, 0)}
/>
<Object.Bottom scale={1} position={new THREE.Vector3(0, 0, 0)} />
<Models.Bottom scale={1} position={new THREE.Vector3(0, 0, 0)} />
{snows}
{decos}
</Canvas>
Expand Down

0 comments on commit 372df93

Please sign in to comment.