Skip to content

Commit

Permalink
fix: change JSDoc for createDerivedMaterial params to be optional (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
jerzakm authored Jul 30, 2024
1 parent d23f360 commit 6969e85
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions packages/troika-three-utils/src/DerivedMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,42 @@ let materialInstanceId = 1e10
* @param {THREE.Material} baseMaterial - the original material to derive from
*
* @param {Object} options - How the base material should be modified.
* @param {Object} options.defines - Custom `defines` for the material
* @param {Object} options.extensions - Custom `extensions` for the material, e.g. `{derivatives: true}`
* @param {Object} options.uniforms - Custom `uniforms` for use in the modified shader. These can
* @param {Object=} options.defines - Custom `defines` for the material
* @param {Object=} options.extensions - Custom `extensions` for the material, e.g. `{derivatives: true}`
* @param {Object=} options.uniforms - Custom `uniforms` for use in the modified shader. These can
* be accessed and manipulated via the resulting material's `uniforms` property, just like
* in a ShaderMaterial. You do not need to repeat the base material's own uniforms here.
* @param {String} options.timeUniform - If specified, a uniform of this name will be injected into
* @param {String=} options.timeUniform - If specified, a uniform of this name will be injected into
* both shaders, and it will automatically be updated on each render frame with a number of
* elapsed milliseconds. The "zero" epoch time is not significant so don't rely on this as a
* true calendar time.
* @param {String} options.vertexDefs - Custom GLSL code to inject into the vertex shader's top-level
* @param {String=} options.vertexDefs - Custom GLSL code to inject into the vertex shader's top-level
* definitions, above the `void main()` function.
* @param {String} options.vertexMainIntro - Custom GLSL code to inject at the top of the vertex
* @param {String=} options.vertexMainIntro - Custom GLSL code to inject at the top of the vertex
* shader's `void main` function.
* @param {String} options.vertexMainOutro - Custom GLSL code to inject at the end of the vertex
* @param {String=} options.vertexMainOutro - Custom GLSL code to inject at the end of the vertex
* shader's `void main` function.
* @param {String} options.vertexTransform - Custom GLSL code to manipulate the `position`, `normal`,
* @param {String=} options.vertexTransform - Custom GLSL code to manipulate the `position`, `normal`,
* and/or `uv` vertex attributes. This code will be wrapped within a standalone function with
* those attributes exposed by their normal names as read/write values.
* @param {String} options.fragmentDefs - Custom GLSL code to inject into the fragment shader's top-level
* @param {String=} options.fragmentDefs - Custom GLSL code to inject into the fragment shader's top-level
* definitions, above the `void main()` function.
* @param {String} options.fragmentMainIntro - Custom GLSL code to inject at the top of the fragment
* @param {String=} options.fragmentMainIntro - Custom GLSL code to inject at the top of the fragment
* shader's `void main` function.
* @param {String} options.fragmentMainOutro - Custom GLSL code to inject at the end of the fragment
* @param {String=} options.fragmentMainOutro - Custom GLSL code to inject at the end of the fragment
* shader's `void main` function. You can manipulate `gl_FragColor` here but keep in mind it goes
* after any of ThreeJS's color postprocessing shader chunks (tonemapping, fog, etc.), so if you
* want those to apply to your changes use `fragmentColorTransform` instead.
* @param {String} options.fragmentColorTransform - Custom GLSL code to manipulate the `gl_FragColor`
* @param {String=} options.fragmentColorTransform - Custom GLSL code to manipulate the `gl_FragColor`
* output value. Will be injected near the end of the `void main` function, but before any
* of ThreeJS's color postprocessing shader chunks (tonemapping, fog, etc.), and before the
* `fragmentMainOutro`.
* @param {function<{vertexShader,fragmentShader}>:{vertexShader,fragmentShader}} options.customRewriter - A function
* @param {function({fragmentShader: string, vertexShader:string}):
* {fragmentShader: string, vertexShader:string}} options.customRewriter - A function
* for performing custom rewrites of the full shader code. Useful if you need to do something
* special that's not covered by the other builtin options. This function will be executed before
* any other transforms are applied.
* @param {boolean} options.chained - Set to `true` to prototype-chain the derived material to the base
* @param {boolean=} options.chained - Set to `true` to prototype-chain the derived material to the base
* material, rather than the default behavior of copying it. This allows the derived material to
* automatically pick up changes made to the base material and its properties. This can be useful
* where the derived material is hidden from the user as an implementation detail, allowing them
Expand Down

0 comments on commit 6969e85

Please sign in to comment.