|
@@ -334,6 +334,36 @@
|
|
|
Unlike properties, the callback is not supported by [page:Material.clone .clone](), [page:Material.copy .copy]() and [page:Material.toJSON .toJSON]().
|
|
|
</p>
|
|
|
|
|
|
+ <h3>[method:String customProgramCacheKey]()</h3>
|
|
|
+ <p>
|
|
|
+ In case onBeforeCompile is used, this callback can be used to identify values of settings used in onBeforeCompile, so three.js can reuse a cached shader or recompile the shader for this material as needed.
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <p>
|
|
|
+ For example, if onBeforeCompile contains a conditional statement like:<br />
|
|
|
+
|
|
|
+ <code>if ( black ) {
|
|
|
+
|
|
|
+ shader.fragmentShader = shader.fragmentShader.replace('gl_FragColor = vec4(1)', 'gl_FragColor = vec4(0)')
|
|
|
+
|
|
|
+ }
|
|
|
+ </code>
|
|
|
+
|
|
|
+ then customProgramCacheKey should be set like this:<br />
|
|
|
+
|
|
|
+ <code>material.customProgramCacheKey = function() {
|
|
|
+
|
|
|
+ return black ? '1' : '0';
|
|
|
+
|
|
|
+ }
|
|
|
+ </code>
|
|
|
+
|
|
|
+ </p>
|
|
|
+
|
|
|
+ <p>
|
|
|
+ Unlike properties, the callback is not supported by [page:Material.clone .clone](), [page:Material.copy .copy]() and [page:Material.toJSON .toJSON]().
|
|
|
+ </p>
|
|
|
+
|
|
|
<h3>[method:null setValues]( [param:object values] )</h3>
|
|
|
<p>
|
|
|
values -- a container with parameters.<br />
|