Update model compression with draco

This commit is contained in:
DefectingCat
2022-10-18 16:14:21 +08:00
parent 2a521bd371
commit 5a1b95bd7c
14 changed files with 24987 additions and 20961 deletions

View File

@ -5,6 +5,7 @@ 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 { NextPageWithLayout } from 'types';
@ -12,6 +13,11 @@ 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;
@ -157,7 +163,7 @@ const About: NextPageWithLayout = () => {
});
};
glftLoader.load('./models/cloud_station/scene.gltf', handleLoad);
glftLoader.load('./models/cloud_station/modelDraco.gltf', handleLoad);
};
const { ref } = useThree({

View File

@ -6,8 +6,8 @@ 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 { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
import { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
import type { NextPageWithLayout } from 'types';
const MainLayout = dynamic(() => import('layouts/MainLayout'));
@ -128,7 +128,7 @@ const Home: NextPageWithLayout = () => {
});
};
gltfLoader.load('./models/just_a_hungry_cat/scene.gltf', handleLoad);
gltfLoader.load('./models/just_a_hungry_cat/modelDraco.gltf', handleLoad);
};
const { ref } = useThree({
init,

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 519 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long