preact
This commit is contained in:
parent
6acf267d48
commit
b7614eb3f8
4794 changed files with 1280808 additions and 1546 deletions
30
frontend/node_modules/three/examples/jsm/nodes/utils/MatcapUVNode.js
generated
vendored
Normal file
30
frontend/node_modules/three/examples/jsm/nodes/utils/MatcapUVNode.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import TempNode from '../core/TempNode.js';
|
||||
import { transformedNormalView } from '../accessors/NormalNode.js';
|
||||
import { positionViewDirection } from '../accessors/PositionNode.js';
|
||||
import { nodeImmutable, vec2, vec3 } from '../shadernode/ShaderNode.js';
|
||||
import { addNodeClass } from '../core/Node.js';
|
||||
|
||||
class MatcapUVNode extends TempNode {
|
||||
|
||||
constructor() {
|
||||
|
||||
super( 'vec2' );
|
||||
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
||||
const x = vec3( positionViewDirection.z, 0, positionViewDirection.x.negate() ).normalize();
|
||||
const y = positionViewDirection.cross( x );
|
||||
|
||||
return vec2( x.dot( transformedNormalView ), y.dot( transformedNormalView ) ).mul( 0.495 ).add( 0.5 ); // 0.495 to remove artifacts caused by undersized matcap disks
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default MatcapUVNode;
|
||||
|
||||
export const matcapUV = nodeImmutable( MatcapUVNode );
|
||||
|
||||
addNodeClass( 'MatcapUVNode', MatcapUVNode );
|
||||
Loading…
Add table
Add a link
Reference in a new issue