mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
Add loader to lib
This commit is contained in:
12
lib/gltfLoader.ts
Normal file
12
lib/gltfLoader.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { THREE } from 'rua-three';
|
||||
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
|
||||
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
|
||||
|
||||
const manager = new THREE.LoadingManager();
|
||||
const gltfLoader = new GLTFLoader(manager);
|
||||
const dracoLoader = new DRACOLoader();
|
||||
dracoLoader.setDecoderPath('./libs/draco/');
|
||||
dracoLoader.setDecoderConfig({ type: 'wasm' });
|
||||
gltfLoader.setDRACOLoader(dracoLoader);
|
||||
|
||||
export { manager, gltfLoader, dracoLoader };
|
@ -1,23 +1,16 @@
|
||||
import TWEEN from '@tweenjs/tween.js';
|
||||
import classNames from 'classnames';
|
||||
import { gltfLoader, manager } from 'lib/gltfLoader';
|
||||
import { getMousePosition } from 'lib/utils';
|
||||
import { useTheme } from 'next-themes';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { InitFn, THREE, useThree } from 'rua-three';
|
||||
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
|
||||
import { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
|
||||
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
|
||||
import { NextPageWithLayout } from 'types';
|
||||
|
||||
const Loading = dynamic(() => import('components/RUA/loading/RUALoading'));
|
||||
|
||||
const manager = new THREE.LoadingManager();
|
||||
const glftLoader = new GLTFLoader(manager);
|
||||
const dracoLoader = new DRACOLoader();
|
||||
dracoLoader.setDecoderPath('./libs/draco/');
|
||||
dracoLoader.setDecoderConfig({ type: 'wasm' });
|
||||
glftLoader.setDRACOLoader(dracoLoader);
|
||||
|
||||
const rotationY = 0.4;
|
||||
const rotationX = 0.2;
|
||||
|
||||
@ -163,7 +156,7 @@ const About: NextPageWithLayout = () => {
|
||||
});
|
||||
};
|
||||
|
||||
glftLoader.load('./models/cloud_station/modelDraco.gltf', handleLoad);
|
||||
gltfLoader.load('./models/cloud_station/modelDraco.gltf', handleLoad);
|
||||
};
|
||||
|
||||
const { ref } = useThree({
|
||||
|
@ -1,4 +1,5 @@
|
||||
import cn from 'classnames';
|
||||
import { gltfLoader, manager } from 'lib/gltfLoader';
|
||||
import { getMousePosition } from 'lib/utils';
|
||||
import dynamic from 'next/dynamic';
|
||||
import Image from 'next/future/image';
|
||||
@ -6,20 +7,12 @@ import Head from 'next/head';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { InitFn, THREE, useThree } from 'rua-three';
|
||||
import styles from 'styles/index/index.module.css';
|
||||
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
|
||||
import { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
|
||||
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
|
||||
import type { NextPageWithLayout } from 'types';
|
||||
|
||||
const MainLayout = dynamic(() => import('layouts/MainLayout'));
|
||||
const Loading = dynamic(() => import('components/RUA/loading/RUALoading'));
|
||||
|
||||
const manager = new THREE.LoadingManager();
|
||||
const gltfLoader = new GLTFLoader(manager);
|
||||
const dracoLoader = new DRACOLoader();
|
||||
dracoLoader.setDecoderPath('./libs/draco/');
|
||||
dracoLoader.setDecoderConfig({ type: 'wasm' });
|
||||
gltfLoader.setDRACOLoader(dracoLoader);
|
||||
|
||||
const rotationY = 0.4;
|
||||
const rotationX = 0.18;
|
||||
|
||||
|
Reference in New Issue
Block a user