mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 10:49:36 +02:00
This commit is contained in:
parent
f0f62670c5
commit
7e26256cac
4563 changed files with 1246712 additions and 17558 deletions
84
node_modules/three/examples/jsm/nodes/misc/TextureCubeNode.js
generated
vendored
Normal file
84
node_modules/three/examples/jsm/nodes/misc/TextureCubeNode.js
generated
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
import { TempNode } from '../core/TempNode.js';
|
||||
import { FloatNode } from '../inputs/FloatNode.js';
|
||||
import { TextureCubeUVNode } from './TextureCubeUVNode.js';
|
||||
import { ReflectNode } from '../accessors/ReflectNode.js';
|
||||
import { NormalNode } from '../accessors/NormalNode.js';
|
||||
|
||||
function TextureCubeNode( value, uv, bias ) {
|
||||
|
||||
TempNode.call( this, 'v4' );
|
||||
|
||||
this.value = value;
|
||||
|
||||
this.radianceNode = new TextureCubeUVNode(
|
||||
this.value,
|
||||
uv || new ReflectNode( ReflectNode.VECTOR ),
|
||||
// bias should be replaced in builder.context in build process
|
||||
bias
|
||||
);
|
||||
|
||||
this.irradianceNode = new TextureCubeUVNode(
|
||||
this.value,
|
||||
new NormalNode( NormalNode.WORLD ),
|
||||
new FloatNode( 1 ).setReadonly( true )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
TextureCubeNode.prototype = Object.create( TempNode.prototype );
|
||||
TextureCubeNode.prototype.constructor = TextureCubeNode;
|
||||
TextureCubeNode.prototype.nodeType = 'TextureCube';
|
||||
|
||||
TextureCubeNode.prototype.generate = function ( builder, output ) {
|
||||
|
||||
if ( builder.isShader( 'fragment' ) ) {
|
||||
|
||||
builder.require( 'irradiance' );
|
||||
|
||||
if ( builder.context.bias ) {
|
||||
|
||||
builder.context.bias.setTexture( this.value );
|
||||
|
||||
}
|
||||
|
||||
var scopeNode = builder.slot === 'irradiance' ? this.irradianceNode : this.radianceNode;
|
||||
|
||||
return scopeNode.build( builder, output );
|
||||
|
||||
} else {
|
||||
|
||||
console.warn( 'THREE.TextureCubeNode is not compatible with ' + builder.shader + ' shader.' );
|
||||
|
||||
return builder.format( 'vec4( 0.0 )', this.getType( builder ), output );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
TextureCubeNode.prototype.copy = function ( source ) {
|
||||
|
||||
TempNode.prototype.copy.call( this, source );
|
||||
|
||||
this.value = source.value;
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
TextureCubeNode.prototype.toJSON = function ( meta ) {
|
||||
|
||||
var data = this.getJSONNode( meta );
|
||||
|
||||
if ( ! data ) {
|
||||
|
||||
data = this.createJSONNode( meta );
|
||||
|
||||
data.value = this.value.toJSON( meta ).uuid;
|
||||
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
};
|
||||
|
||||
export { TextureCubeNode };
|
Loading…
Add table
Add a link
Reference in a new issue