Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
refactor: using CDN for retreiving gltf
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelfimov committed Jan 25, 2024
1 parent 5f888d7 commit 0170f86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ui/sphere/src/loader/loader.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Suspense } from 'react'
import { FC } from 'react'
import { PropsWithChildren } from 'react'

import { SphereGltf } from '../../assets'
import { CDN_SPHERE_PATH } from '../sphere.constants'

export const Loader: FC<PropsWithChildren<{}>> = ({ children }) => (
<Suspense fallback={null}>{children}</Suspense>
)

useGLTF.preload(SphereGltf)
useGLTF.preload(CDN_SPHERE_PATH)
4 changes: 2 additions & 2 deletions ui/sphere/src/model/model.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { FC } from 'react'
import { Group } from 'three'
import { useEffect } from 'react'
import { useRef } from 'react'
import { CDN_SPHERE_PATH } from '../sphere.constants'

import { SphereGltf } from '../../assets'
import { GLTFResult } from './model.interfaces'
import { GLTFAction } from './model.interfaces'
import { ModelProps } from './model.interfaces'

export const Model: FC<ModelProps> = (props) => {
const group = useRef<Group>(null)
const { nodes, materials, animations } = useGLTF(SphereGltf, true) as unknown as GLTFResult
const { nodes, materials, animations } = useGLTF(CDN_SPHERE_PATH, true) as unknown as GLTFResult
const { actions } = useAnimations<GLTFAction>(animations, group)

useEffect(() => {
Expand Down
1 change: 1 addition & 0 deletions ui/sphere/src/sphere.constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CDN_SPHERE_PATH = 'https://cdn.dream-team.tech/sphere.gltf'

0 comments on commit 0170f86

Please sign in to comment.