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语言较其他的高级语 ...
随机推荐
- 杂记-格式化Date默认格式,日期加一天,jstl判断字符类型,ajax模拟from表单后台跳转页面,jstl访问数据库并在页面显示
1.格式化Date默认格式 String str="Sun Oct 08 22:36:45 CST 2017"; SimpleDateFormat sdf = new Simple ...
- js向一个数组中插入元素的几个方法-性能比较
向一个数组中插入元素是平时很常见的一件事情.你可以使用push在数组尾部插入元素,可以用unshift在数组头部插入元素,也可以用splice在数组中间插入元素. 但是这些已知的方法,并不意味着没有更 ...
- 改写了禁用或启用oracle数据库的约束的存储过程
改写了网上某位大侠(最开始的源头是哪位没记住)写的禁用或启用oracle数据库所有约束的存储过程,增加了异常控制,以使发生异常时也可以执行下去. –调用过程: 执行前先 set serveroutpu ...
- 十八、Spring框架(AOP)
一.AOP(基于XML方式配置AOP) AOP(Aspect Oriented Program):面向切面编程.思想是:把功能分为核心业务功能和周边功能. 所谓核心业务功能:比如登录,增删改数据都叫做 ...
- 四、持久层框架(Hibernate)
一.一级缓存与二级缓存 1.一级缓存:Hibernate默认是开启一级缓存的,一级缓存存放在session里,一个Session做一次查询操作,会把这个操作的结果放在一级缓存中,如果短时间内这个ses ...
- 1.Liunx 文件管理
文件管理命令 1.基本命令:ls .cd .pwd .man 2.文件操作:touch . cp . rm . mv .ln . mkdir . rmdir 3.文件查看:cat .more .les ...
- RocketMQ消息存储
转载:RocketMQ源码学习--消息存储篇 消息中间件—RocketMQ消息存储(一) RocketMQ高性能之底层存储设计 存储架构 RMQ存储架构 上图即为RocketMQ的消息存储整体架构,R ...
- Java 8 默认方法(Default Methods)
Java 8 默认方法(Default Methods) Posted by Ebn Zhang on December 20, 2015 Java 8 引入了新的语言特性——默认方法(Default ...
- MySQL(一) 初识MySQL
数据库基础 数据库是由一批数据构成的有序的集合,这些数据被存放在结构化的数据表里.数据表之间相互联系,反映了客观事物间的本质联系.数据库系统提供对数据的安全控制和完整性控制. 什么是数据库 数据库的发 ...
- bootstrap 下拉选中查询
<div class="form-group"> <label class="col-lg-3 col-sm-2 control-label" ...