#
luxiaotao1123
2023-03-06 8f902a43cd8fb6e07605d2db7e35eaaa2f540879
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { FBXLoader } from '../lib/FBXLoader.js';
 
export class DefineModel {
 
    object;
    mixer;
 
    constructor(object) {
        let that = this;
        that.object = object;
        that.mixer;
        const loader = new FBXLoader();
        // loader.load( '../static/model/fbx/fbxDemo.fbx', function ( object ) {
        loader.load( '../static/model/fbx/Samba Dancing.fbx', function ( object ) {
 
            that.mixer = new THREE.AnimationMixer( object );
 
            const action = that.mixer.clipAction( object.animations[ 0 ] );
            action.play();
 
            object.traverse( function ( child ) {
 
                if ( child.isMesh ) {
 
                    child.castShadow = true;
                    child.receiveShadow = true;
                    child.material = new THREE.MeshLambertMaterial({
                        color: 0xCD6839
                    });
                }
 
            } );
 
            that.object.addObject( object );
 
        } );
 
 
    }
 
 
 
}