PHP 7.4.33
Preview: MeshMatcapNodeMaterial.js Size: 1.58 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/three/src/materials/nodes/MeshMatcapNodeMaterial.js
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 `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;

Directory Contents

Dirs: 1 × Files: 18
Name Size Perms Modified Actions
manager DIR
- drwxr-xr-x 2025-03-28 11:04:38
Edit Download
13.53 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
816 B lrw-r--r-- 2025-03-28 11:04:38
Edit Download
3.69 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
2.94 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
1.73 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
1.58 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
1.71 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
3.33 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
15.96 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
4.89 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
4.65 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
1.17 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
28.35 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
1.51 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
3.05 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
1.17 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
4.78 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
1.18 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).