mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
49 lines
1000 B
JavaScript
49 lines
1000 B
JavaScript
/**
|
|
* @author sunag / http://www.sunag.com.br/
|
|
*/
|
|
|
|
THREE.UVNode = function ( index ) {
|
|
|
|
THREE.TempNode.call( this, 'v2', { shared: false } );
|
|
|
|
this.index = index || 0;
|
|
|
|
};
|
|
|
|
THREE.UVNode.vertexDict = [ 'uv', 'uv2' ];
|
|
THREE.UVNode.fragmentDict = [ 'vUv', 'vUv2' ];
|
|
|
|
THREE.UVNode.prototype = Object.create( THREE.TempNode.prototype );
|
|
THREE.UVNode.prototype.constructor = THREE.UVNode;
|
|
THREE.UVNode.prototype.nodeType = "UV";
|
|
|
|
THREE.UVNode.prototype.generate = function ( builder, output ) {
|
|
|
|
var material = builder.material;
|
|
var result;
|
|
|
|
material.requires.uv[ this.index ] = true;
|
|
|
|
if ( builder.isShader( 'vertex' ) ) result = THREE.UVNode.vertexDict[ this.index ];
|
|
else result = THREE.UVNode.fragmentDict[ this.index ];
|
|
|
|
return builder.format( result, this.getType( builder ), output );
|
|
|
|
};
|
|
|
|
THREE.UVNode.prototype.toJSON = function ( meta ) {
|
|
|
|
var data = this.getJSONNode( meta );
|
|
|
|
if ( ! data ) {
|
|
|
|
data = this.createJSONNode( meta );
|
|
|
|
data.index = this.index;
|
|
|
|
}
|
|
|
|
return data;
|
|
|
|
};
|