File: LOD.html

package info (click to toggle)
three.js 111%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 15,184 kB
  • sloc: javascript: 133,174; makefile: 24; sh: 1
file content (115 lines) | stat: -rw-r--r-- 3,555 bytes parent folder | download | duplicates (2)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<base href="../../../" />
		<script src="list.js"></script>
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
	</head>
	<body>
		[page:Object3D] &rarr;

		<h1>多细节层次([name],Levels of Detail)</h1>

		<p class="desc">
			多细节层次 —— 在显示网格时,根据摄像机距离物体的距离,来使用更多或者更少的几何体来对其进行显示。<br /><br />
			每一个级别都和一个几何体相关联,且在渲染时,可以根据给定的距离,来在这些级别对应的几何体之间进行切换。
			通常情况下,你会创建多个几何体,比如说三个,一个距离很远(低细节),一个距离适中(中等细节),还有一个距离非常近(高质量)。
		</p>

		<h2>示例</h2>
		
		<p>
			[example:webgl_lod webgl / lod ]
		</p>

		<code>
var lod = new THREE.LOD();

//Create spheres with 3 levels of detail and create new LOD levels for them
for( var i = 0; i < 3; i++ ) {

	var geometry = new THREE.IcosahedronBufferGeometry( 10, 3 - i )

	var mesh = new THREE.Mesh( geometry, material );

	lod.addLevel( mesh, i * 75 );

}

scene.add( lod );
		</code>

		<h2>Constructor</h2>
		<h3>[name]( )</h3>
		<p>
			创建一个新的 [name].
		</p>


		<h2>属性</h2>
		<p>共有属性请参见其基类[page:Object3D]。</p>

		<h3>[property:boolean autoUpdate]</h3>
		<p>
		Whether the LOD object is updated automatically by the renderer per frame or not.
		If set to false, you have to call [page:LOD.update]() in the render loop by yourself.
		Default is true.
		</p>

		<h3>[property:array levels]</h3>
		<p>
			一个包含有[page:object level] objects(各层次物体)的数组。<br /><br />

			每一个层级都是一个对象,具有以下两个属性:
			[page:Object3D object] —— 在这个层次中将要显示的[page:Object3D]。<br />
			[page:Float distance] —— 将显示这一细节层次的距离。
		</p>

		<h2>方法</h2>
		<p>共有方法请参见其基类[page:Object3D]。</p>

		<h3>[method:this addLevel]( [param:Object3D object], [param:Float distance] )</h3>
		<p>
		[page:Object3D object] —— 在这个层次中将要显示的[page:Object3D]。<br />
		[page:Float distance] —— 将显示这一细节层次的距离。<br /><br />

		添加在一定距离和更大范围内显示的网格。通常来说,距离越远,网格中的细节就越少。
		</p>

		<h3>[method:LOD clone]()</h3>
		<p>
			返回一个LOD对象及其所关联的在特定距离中的物体。
		</p>


		<h3>[method:Object3D getObjectForDistance]( [param:Float distance] )</h3>
		<p>
			获得第一个比[page:Float distance]大的[page:Object3D](网格)的引用。
		</p>

		<h3>[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
		<p>
			在一条投射出去的[page:Ray](射线)和这个LOD之间获得交互。
			[page:Raycaster.intersectObject]将会调用这个方法。
		</p>



		<h3>[method:Object toJSON]( meta )</h3>
		<p>
			使用这个方法,为LOD对象中的每个细节层次创建一个JSON结构。
		</p>

		<h3>[method:null update]( [param:Camera camera] )</h3>
		<p>
			基于每个[page:levels level]中的[page:Object3D object]和[page:Camera camera](摄像机)之间的距离,来设置其可见性。
		</p>

		<h2>源代码</h2>
		<p>
			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
		</p>
	</body>
</html>