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 (120 lines) | stat: -rw-r--r-- 3,320 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
116
117
118
119
120
<!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]</h1>

		<p class="desc">
			Level of Detail - show meshes with more or less geometry based on distance from the camera.<br /><br />

		  Every level is associated with an object, and rendering can be switched between them at the distances
			specified. Typically you would create, say, three meshes, one for far away (low detail), one for mid range (medium detail)
			and one for close up (high detail).
		</p>

		<h2>Example</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>
			Creates a new [name].
		</p>


		<h2>Properties</h2>
		<p>See the base [page:Object3D] class for common properties.</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>
		An array of [page:object level] objects<br /><br />

		Each level is an object with two properties:<br />
		[page:Object3D object] - The [page:Object3D] to display at this level.<br />
		[page:Float distance] - The distance at which to display this level of detail.
		</p>

		<h2>Methods</h2>
		<p>See the base [page:Object3D] class for common methods.</p>

		<h3>[method:this addLevel]( [param:Object3D object], [param:Float distance] )</h3>
		<p>
		[page:Object3D object] - The [page:Object3D] to display at this level.<br />
		[page:Float distance] - The distance at which to display this level of detail.<br /><br />

		Adds a mesh that will display at a certain distance and greater. Typically the further away the distance,
		the lower the detail on the mesh.
		</p>

		<h3>[method:LOD clone]()</h3>
		<p>
		Returns a clone of this LOD object and its associated distance specific objects.
		</p>


		<h3>[method:Object3D getObjectForDistance]( [param:Float distance] )</h3>
		<p>
		Get a reference to the first [page:Object3D] (mesh) that is greater than [page:Float distance].
		</p>

		<h3>[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
		<p>
		Get intersections between a casted [page:Ray] and this LOD.
		[page:Raycaster.intersectObject] will call this method.
		</p>



		<h3>[method:Object toJSON]( meta )</h3>
		<p>
		Create a JSON structure with details of this LOD object.
		</p>

		<h3>[method:null update]( [param:Camera camera] )</h3>
		<p>
			Set the visibility of each [page:levels level]'s [page:Object3D object] based on
			distance from the [page:Camera camera]. 
		</p>

		<h2>Source</h2>

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