forked from serjIII/threejsSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoxHelper.html
82 lines (68 loc) · 2.59 KB
/
BoxHelper.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:Object3D] → [page:Line] → [page:LineSegments] →
<h1>[name]</h1>
<p class="desc">
Helper object to graphically show the world-axis-aligned bounding box
around an object. The actual bounding box is handled with [page:Box3],
this is just a visual helper for debugging. It can be automatically
resized with the [page:BoxHelper.update] method when the object it's
created from is transformed. Note that the object must have a
[page:BufferGeometry] for this to work, so it won't work with [page:Sprite Sprites].
</p>
<h2>Code Example</h2>
<code>
const sphere = new THREE.SphereGeometry();
const object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
const box = new THREE.BoxHelper( object, 0xffff00 );
scene.add( box );
</code>
<h2>Examples</h2>
<p>
[example:webgl_helpers WebGL / helpers]<br />
[example:webgl_loader_nrrd WebGL / loader / nrrd]<br />
[example:webgl_buffergeometry_drawrange WebGL / buffergeometry / drawrange]
</p>
<h2>Constructor</h2>
<h3>[name]( [param:Object3D object], [param:Color color] )</h3>
<p>
[page:Object3D object] -- (optional) the object3D to show the
world-axis-aligned boundingbox.<br />
[page:Color color] -- (optional) hexadecimal value that defines the box's
color. Default is 0xffff00.<br /><br />
Creates a new wireframe box that bounds the passed object. Internally this
uses [page:Box3.setFromObject] to calculate the dimensions. Note that this
includes any children.
</p>
<h2>Properties</h2>
<p>See the base [page:LineSegments] class for common properties.</p>
<h2>Methods</h2>
<p>See the base [page:LineSegments] class for common methods.</p>
<h3>[method:undefined update]()</h3>
<p>
Updates the helper's geometry to match the dimensions of the object,
including any children. See [page:Box3.setFromObject].
</p>
<h3>[method:this setFromObject]( [param:Object3D object] )</h3>
<p>
[page:Object3D object] - [page:Object3D] to create the helper of.<br /><br />
Updates the wireframe box for the passed object.
</p>
<h3>[method:undefined dispose]()</h3>
<p>
Frees the GPU-related resources allocated by this instance. Call this
method whenever this instance is no longer used in your app.
</p>
<h2>Source</h2>
<p>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</p>
</body>
</html>