[http://www.yanhuangxueyuan.com/threejs/examples/#webgl\_loader\_fbx](http://www.yanhuangxueyuan.com/threejs/examples/#webgl_loader_fbx)
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - FBX loader</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="main.css">
</head>
```
<body>
<div id="info">
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - FBXLoader<br />
Character and animation from <a href="https://www.mixamo.com/" target="_blank" rel="noopener">Mixamo</a>
</div>
<script type="module">
import * as THREE from '../build/three.module.js';
import Stats from './jsm/libs/stats.module.js';
import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { FBXLoader } from './jsm/loaders/FBXLoader.js';
let camera, scene, renderer, stats;
const clock = new THREE.Clock();
let mixer;
init();
animate();
function init() {
const container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
camera.position.set( 100, 200, 300 );
scene = new THREE.Scene();
scene.background = new THREE.Color( 0xa0a0a0 );
scene.fog = new THREE.Fog( 0xa0a0a0, 200, 1000 );
const hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444 );
hemiLight.position.set( 0, 200, 0 );
scene.add( hemiLight );
const dirLight = new THREE.DirectionalLight( 0xffffff );
dirLight.position.set( 0, 200, 100 );
dirLight.castShadow = true;
dirLight.shadow.camera.top = 180;
dirLight.shadow.camera.bottom = - 100;
dirLight.shadow.camera.left = - 120;
dirLight.shadow.camera.right = 120;
scene.add( dirLight );
// scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) );
// ground
const mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2000, 2000 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) );
mesh.rotation.x = - Math.PI / 2;
mesh.receiveShadow = true;
scene.add( mesh );
const grid = new THREE.GridHelper( 2000, 20, 0x000000, 0x000000 );
grid.material.opacity = 0.2;
grid.material.transparent = true;
scene.add( grid );
// model
const loader = new FBXLoader();
loader.load( 'models/fbx/Samba Dancing.fbx', function ( object ) {
mixer = new THREE.AnimationMixer( object );
const action = mixer.clipAction( object.animations[ 0 ] );
action.play();
object.traverse( function ( child ) {
if ( child.isMesh ) {
child.castShadow = true;
child.receiveShadow = true;
}
} );
scene.add( object );
} );
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.shadowMap.enabled = true;
container.appendChild( renderer.domElement );
const controls = new OrbitControls( camera, renderer.domElement );
controls.target.set( 0, 100, 0 );
controls.update();
window.addEventListener( 'resize', onWindowResize );
// stats
stats = new Stats();
container.appendChild( stats.dom );
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
//
function animate() {
requestAnimationFrame( animate );
const delta = clock.getDelta();
if ( mixer ) mixer.update( delta );
renderer.render( scene, camera );
stats.update();
}
</script>
</body>
```
</html>
- markdown
- 前端技术
- fiddler抓包
- thingjs项目设计
- 目录结构
- thingjs 模型
- 开发规范
- thingjs引入vuejs
- uniapp性能优化
- 防抖与节流
- uniapp 使用高德地图做路径规划不生效解决方法
- 5个CSS编程坏习惯
- echarts 刮刮乐
- jquery轮播图
- uniapp滚动问题
- 5 个不常提及的 HTML 技巧
- Http 缓存简介
- canvas像素操作
- Chrome 调试技巧
- H5隐藏特性
- vue 实战中的一些小技巧
- vue-video-player组件
- JS循环大总结
- vue自定义指令1
- 剩余运算符,扩展运算符(...)用法
- 后端技术
- 面向对象
- linux
- docker
- centos
- CentOS7安装MySQL
- CentOS7安装php
- 阿里云
- 添加宝塔
- 添加子域名
- ssl证书部署
- Liunx常用的命令
- php
- 项目常见问题总结
- 开发规范
- 9个PHP小技巧
- php生成二维码
- 算法
- 经纬度计算距离
- Kmp算法
- mysql
- 索引
- 索引概述及优势
- 索引结构
- 事务
- mysql 数据库任务计划
- 接口
- RESTful API接口设计标准及规范
- 保证接口的安全
- 了解DOS/DDOS/CSRF/XSS攻击
- 防止攻击
- mongoDB
- 安装
- Docker 安装 MongoDB
- 安装扩展
- docker安装mongodb扩展
- supervisor
- 自动化开发
- 接口字典代码配置
- 建模
- three模型展示
- 应用市场
- 应用宝上架流程
- vivo上架流程
- 华为上架流程
- 小米上架流程
- android 获取应用签名
- git部分
- git 基本操作命令
- git解决冲突
- 打包那些事
- electron
- android系统进程保活
