Skip to content

Commit 2392547

Browse files
committed
Further improvements to ShaderMaterial docs
1 parent 4c81ab6 commit 2392547

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

docs/api/materials/ShaderMaterial.html

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ <h3>Custom attributes and uniforms</h3>
7777
</code>
7878
Each attribute must have a *type* property and a *value* property.
7979
<table>
80-
<caption>Attribute types</caption>
80+
<caption><a id="attribute-types">Attribute types</a></caption>
8181
<thead>
8282
<tr>
8383
<th>Attribute *type* string</th>
@@ -136,9 +136,9 @@ <h3>Custom attributes and uniforms</h3>
136136
resolution: { type: "v2", value: new THREE.Vector2() }
137137
}
138138
</code>
139-
Each uniform must have a *type* and a *value*:
139+
Each uniform must have a <a href="#uniform-types">*type*</a> and a *value*:
140140
<table>
141-
<caption>Uniform types</caption>
141+
<caption><a id="uniform-types">Uniform types</a></caption>
142142
<thead>
143143
<tr>
144144
<th>Uniform *type* string</th>
@@ -216,12 +216,25 @@ <h2>Properties</h2>
216216

217217
<h3>.[page:Object uniforms]</h3>
218218
<div>
219-
Uniforms defined inside GLSL shader code.
219+
Object specifying the uniforms to be passed to the shader code; keys are uniform names, values are definitions of the form
220+
<code>
221+
{ type: 'f', value: 1.0 }
222+
</code>
223+
where *type* is a <a href="#uniform-types">uniform type string</a>, and *value* is the value of the uniform. Names must match the name of the uniform, as defined in the GLSL code. Note that uniforms are refreshed on every frame, so updating the value of the uniform will immediately update the value available to the GLSL code.
220224
</div>
221225

222226
<h3>.[page:Object attributes]</h3>
223227
<div>
224-
Attributes defined inside GLSL shader code.
228+
<p>
229+
Object specifying the custom attributes to be passed to the shader code; keys are attribute names, values are definitions of the form
230+
<code>
231+
{ type: 'f', value: [1.0, 0.5, 2.0, ...] }
232+
</code>
233+
where *type* is an <a href="#attribute-types">attribute type string</a>, and *value* is an array containing an attribute value for each vertex in the geometry (or *undefined* if using [page:BufferGeometry]). Names must match the name of the attribute, as defined in the GLSL code.
234+
</p>
235+
<p>
236+
Note that attribute buffers are <emph>not</emph> refreshed automatically when their values change; if using [page:Geometry], set <code>needsUpdate = true</code> on the attribute definition. If using [page:BufferGeometry], set <code>needsUpdate = true</code> on the [page:BufferAttribute].
237+
</p>
225238
</div>
226239

227240
<h3>.[page:Object defines]</h3>

0 commit comments

Comments
 (0)