forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBufferAttribute.html
More file actions
115 lines (93 loc) · 4.39 KB
/
BufferAttribute.html
File metadata and controls
115 lines (93 loc) · 4.39 KB
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>
<h1>[name]</h1>
<div class="desc">
This class stores data for an attribute associated with a [page:BufferGeometry]. See that page for details and a usage example. This class is used to store builtin attributes such as vertex position, normals, color, etc., but can also be used in your code to store custom attributes in a [page:BufferGeometry].
</div>
<h2>Constructor</h2>
<h3>[name]( [page:TypedArray array], [page:Integer itemSize], [page:Boolean normalized] )</h3>
<div>
Instantiates this attribute with data from the associated buffer.
itemSize gives the number of values of the array that should be associated with a particular vertex. normalized indicates how the underlying data in the buffer maps to the values in the GLSL shader code.
</div>
<h2>Properties</h2>
<h3>[property:TypedArray array]</h3>
<div>
Stores the data associated with this attribute. This element should have <code>itemSize * numVertices</code> elements, where numVertices is the number of vertices in the associated [page:BufferGeometry geometry]. [page:TypedArray array] can be an instance of UInt8Array, Int8Array, UInt16Array, Int16Array, or Float32Array.
</div>
<h3>[property:Integer itemSize]</h3>
<div>
Records how many items of the array are associated with a particular vertex. For instance, if this
attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
</div>
<h3>[property:Integer count]</h3>
<div>
Gives the total number of elements in the array.
</div>
<h3>[property:Boolean needsUpdate]</h3>
<div>
Flag to indicate that this attribute has changed and should be re-send to the GPU. Set this to true when you modify the value of the array.
</div>
<h3>[property:Boolean normalized]</h3>
<div>
Indicates how the underlying data in the buffer maps to the values in the GLSL code. For instance, if [page:TypedArray array] is an instance of UInt16Array, and [page:Boolean normalized] is true, the values 0 - +65535 in the array data will be mapped to 0.0f - +1.0f in the GLSL attribute. An Int16Array (signed) would map from -32767 - +32767 to -1.0f - +1.0f. If [page:Boolean normalized] is false, the values will be converted to floats which contain the exact value, i.e. 32767 becomes 32767.0f.
</div>
<h3>[property:Integer version]</h3>
<div>
A version number, incremented every time the needsUpdate property is set to true.
</div>
<h2>Methods</h2>
<h3>[method:null copyAt] ( [page:Integer index1], attribute, [page:Integer index2] ) </h3>
<div>
Copies itemSize values in the array from the vertex at index2 to the vertex at index1.
</div>
<h3>[method:null set] ( [page:Array value] ) </h3>
<div>
Sets the associated array with values from the passed array.
</div>
<h3>[method:null setX]( index, x ) </h3>
<div>
Sets the value of the array at <code>index * itemSize</code> to x
</div>
<h3>[method:null setY]( index, y ) </h3>
<div>
Sets the value of the array at <code>index * itemSize + 1</code> to y
</div>
<h3>[method:null setZ]( index, z ) </h3>
<div>
Sets the value of the array at <code>index * itemSize + 2</code> to z
</div>
<h3>[method:null setXY]( index, x, y ) </h3>
<div>
Sets the value of the array at <code>index * itemSize</code> to x and
sets the value of the array at <code>index * itemSize + 1</code> to y
</div>
<h3>[method:null setXYZ]( index, x, y, z ) </h3>
<div>
Sets the value of the array at <code>index * itemSize</code> to x,
the value of the array at <code>index * itemSize + 1</code> to y, and
the value of the array at <code>index * itemSize + 2</code> to z.
</div>
<h3>[method:null setXYZW]( index, x, y, z, w ) </h3>
<div>
Sets the value of the array at <code>index * itemSize</code> to x,
the value of the array at <code>index * itemSize + 1</code> to y,
the value of the array at <code>index * itemSize + 2</code> to z, and
the value of the array at <code>index * itemSize + 3</code> to w.
</div>
<h3>[method:BufferAttribute clone]() </h3>
<div>
Copies this attribute.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>