Buckets:
| import NodeMaterial from './NodeMaterial.js'; | |
| import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js'; | |
| import { diffuseColor } from '../../nodes/core/PropertyNode.js'; | |
| import { vec3 } from '../../nodes/tsl/TSLBase.js'; | |
| import { mix } from '../../nodes/math/MathNode.js'; | |
| import { matcapUV } from '../../nodes/utils/MatcapUVNode.js'; | |
| import { MeshMatcapMaterial } from '../MeshMatcapMaterial.js'; | |
| const _defaultValues = /*@__PURE__*/ new MeshMatcapMaterial(); | |
| /** | |
| * Node material version of {@link MeshMatcapMaterial}. | |
| * | |
| * @augments NodeMaterial | |
| */ | |
| class MeshMatcapNodeMaterial extends NodeMaterial { | |
| static get type() { | |
| return 'MeshMatcapNodeMaterial'; | |
| } | |
| /** | |
| * Constructs a new mesh normal node material. | |
| * | |
| * @param {Object} [parameters] - The configuration parameter. | |
| */ | |
| constructor( parameters ) { | |
| super(); | |
| /** | |
| * This flag can be used for type testing. | |
| * | |
| * @type {boolean} | |
| * @readonly | |
| * @default true | |
| */ | |
| this.isMeshMatcapNodeMaterial = true; | |
| this.setDefaultValues( _defaultValues ); | |
| this.setValues( parameters ); | |
| } | |
| /** | |
| * Setups the matcap specific node variables. | |
| * | |
| * @param {NodeBuilder} builder - The current node builder. | |
| */ | |
| setupVariants( builder ) { | |
| const uv = matcapUV; | |
| let matcapColor; | |
| if ( builder.material.matcap ) { | |
| matcapColor = materialReference( 'matcap', 'texture' ).context( { getUV: () => uv } ); | |
| } else { | |
| matcapColor = vec3( mix( 0.2, 0.8, uv.y ) ); // default if matcap is missing | |
| } | |
| diffuseColor.rgb.mulAssign( matcapColor.rgb ); | |
| } | |
| } | |
| export default MeshMatcapNodeMaterial; | |
Xet Storage Details
- Size:
- 1.62 kB
- Xet hash:
- eee56d61af5987c3f109f54daaf5c6f742f18c59eccace776b2129ff4db08a05
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.