LOD,听起来很牛逼的样子
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - level-of-details</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
background:#000;
color:#fff;
padding:0;
margin:0;
font-weight: bold;
overflow:hidden;
} #info {
position: absolute;
top: 0px; width: 100%;
color: #ffffff;
padding: 5px;
font-family: Monospace;
font-size: 13px;
text-align: center;
z-index:100;
} a { color:red } </style>
</head> <body>
<div id="info">
<a href="http://threejs.org" target="_blank">three.js</a> - level-of-details WebGL example
</div> <script src="../build/three.js"></script> <script src="js/controls/FlyControls.js"></script> <script src="js/Detector.js"></script>
<script src="js/libs/stats.min.js"></script> <script> if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); var container, stats; var camera, scene, renderer; var geometry, objects; var controls, clock = new THREE.Clock(); init();
animate(); function init() { container = document.createElement( 'div' );
document.body.appendChild( container ); camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 15000 );
camera.position.z = 1000; controls = new THREE.FlyControls( camera );
controls.movementSpeed = 1000;
controls.rollSpeed = Math.PI / 10; scene = new THREE.Scene();
scene.fog = new THREE.Fog( 0x000000, 1, 15000 );
scene.autoUpdate = false; var light = new THREE.PointLight( 0xff2200 );
light.position.set( 0, 0, 0 );
scene.add( light ); var light = new THREE.DirectionalLight( 0xffffff );
light.position.set( 0, 0, 1 ).normalize();
scene.add( light ); var geometry = [ [ new THREE.IcosahedronGeometry( 100, 4 ), 50 ],
[ new THREE.IcosahedronGeometry( 100, 3 ), 300 ],
[ new THREE.IcosahedronGeometry( 100, 2 ), 1000 ],
[ new THREE.IcosahedronGeometry( 100, 1 ), 2000 ],
[ new THREE.IcosahedronGeometry( 100, 0 ), 8000 ] ]; var material = new THREE.MeshLambertMaterial( { color: 0xffffff, wireframe: true } ); var i, j, mesh, lod; for ( j = 0; j < 1000; j ++ ) { lod = new THREE.LOD(); for ( i = 0; i < geometry.length; i ++ ) { mesh = new THREE.Mesh( geometry[ i ][ 0 ], material );
mesh.scale.set( 1.5, 1.5, 1.5 );
mesh.updateMatrix();
mesh.matrixAutoUpdate = false;
lod.addLevel( mesh, geometry[ i ][ 1 ] ); } lod.position.x = 10000 * ( 0.5 - Math.random() );
lod.position.y = 7500 * ( 0.5 - Math.random() );
lod.position.z = 10000 * ( 0.5 - Math.random() );
lod.updateMatrix();
lod.matrixAutoUpdate = false;
scene.add( lod ); } renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.sortObjects = false;
container.appendChild( renderer.domElement ); // window.addEventListener( 'resize', onWindowResize, false ); } function onWindowResize() { camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix(); renderer.setSize( window.innerWidth, window.innerHeight ); } function animate() { requestAnimationFrame( animate );
render(); } function render() { controls.update( clock.getDelta() ); scene.updateMatrixWorld();
scene.traverse( function ( object ) { if ( object instanceof THREE.LOD ) { object.update( camera ); } } ); renderer.render( scene, camera ); } </script> </body>
</html>
LOD,听起来很牛逼的样子的更多相关文章
- 不推荐别的了,IDEA 自带的数据库工具就很牛逼!
MySQL 等数据库客户端软件市面上非常多了,别的栈长就不介绍了, 其实 IntelliJ IDEA 自带的数据库工具就很牛逼,不信你继续往下看. 本文以 IntelliJ IDEA/ Mac 版本作 ...
- 很牛逼的android真机调试,手机、平板、电视都可
1.首先通过路由器,搭建局域网 2.手机开wifi,记住ip地址,平板开wifi,记住ip地址,电视开wifi,记住ip 3.然后再eclipse里面“窗口-首选项-android-ddms里面设置使 ...
- 【死磕 NIO】— Proactor模式是什么?很牛逼吗?
大家好,我是大明哥. 上篇文章我们分析了高性能 IO模型Reactor模式,了解了什么是Reactor 模式以及它的三种常见的模式,这篇文章,大明再介绍另外一种高性能IO模型: Proactor. 为 ...
- HDU 6071 Lazy Running(很牛逼的最短路)
http://acm.hdu.edu.cn/showproblem.php?pid=6071 题意: 1.2.3.4四个点依次形成一个环,现在有个人从2结点出发,每次可以往它相邻的两个结点跑,求最后回 ...
- copy and paste ,做到这样也很牛逼了
db笔记本 mysql资源 mysql5.1中文参考手册 mysql管理 基于linux使用mysql二进制包安装mysql5.5 mysql client命令行选项 mysqld服务器系统变量和状态 ...
- Serializable 都这么牛逼了,Parcelable 还要你何用?
一些闲聊 距离上一篇文章似乎又是很久了,看起来也没有很多反馈,催更就更不用说了.哈哈,放弃了. 话说最近公司在招聘一批至少 5 年开发经验的 Android 开发工程师,我也是忙开了花,激动得不行呀. ...
- cssViewer牛逼的chrome插件
很牛逼,功能很强大.
- Animate.css 一款牛逼的css3动画库
Animate.css是一款很牛逼的,跨浏览器的css3动画库,使用方法也很简单只要引入一个animate.min.css就可以了, 简单使用 1 首先引入 animate的 css 文件样式 cdn ...
- 一个很牛的计算pi的c程序!
C语言是面向过程的一种高级程序设计语言,它在世界范围内使用很广泛,而且很流行.很多大型的应用软件,基本上是用C语言所编写的.在对操作系统以及系统使用程序.需要对硬件进行操作的场合,C语言较其他的高级语 ...
随机推荐
- [codechef July Challenge 2017] Pishty and tree
PSHTTR: Pishty 和城堡题目描述Pishty 是生活在胡斯特市的一个小男孩.胡斯特是胡克兰境内的一个古城,以其中世纪风格的古堡和非常聪明的熊闻名全国.胡斯特的镇城之宝是就是这么一座古堡,历 ...
- 二十二、Spring MVC与Structs2的区别总结
一.框架的入口 1.Structs2采用Filter(StructsPrepartAndExecuteFilter)来进行实现. 2.SpringMVC采用Servlet(DispatcherServ ...
- cogs448
☆ 输入文件:1.in 输出文件:1.out 简单对比时间限制:1 s 内存限制:128 MB [题目描述] 在某次膜拜大会上,一些神牛被要求集体膜拜.这些神牛被奖励每人吃一些神牛果. ...
- Pinpoint是一个开源的 APM (Application Performance Management/应用性能管理)工具,用于基于java的大规模分布式系统,基于Google Dapper论文
Pinpoint是一个开源的 APM (Application Performance Management/应用性能管理)工具,用于基于java的大规模分布式系统,基于Google Dapper论文 ...
- [转]find+xargs+sed批量替换
写代码时经常遇到要把 .c 和 .h的文件中的某些内容全部替换的情况,用sourceinsight 进行全局的查找是一个方法,但是sourceinsight只能替换一个文件中的字符串,不能同时替换多 ...
- learning at command AT+CSUB
[Purpose] Learning how to get mobile module info [Eevironment] Shell terminal, base on gcom command ...
- Vue + Element UI 实现权限管理系统(更换皮肤主题)
自定义主题 命令行主题工具 1.安装主题工具 首先安装「主题生成工具」,可以全局安装或者安装在当前项目下,推荐安装在项目里,方便别人 clone 项目时能直接安装依赖并启动. yarn add ele ...
- linux 播放加密DVDs
尝试下 https://www.cyberciti.biz/faq/howto-ubuntu-linux-playback-dvd/
- 使用laravel搭建CURD后台页面
配置即一切 一切皆于需求,后台从0开始搭建,但是写了一两个页面后发现太多的是对单表的增删改查操作,于是就想到了,能不能做一个快速搭建的后台.想到一句话,配置即一切.如果一个CURD后台能只进行配置就自 ...
- RegDataToDataType
function RegDataToDataType(Value: TRegDataType): Integer; begin case Value of rdString: Result := RE ...