-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TSL: UVNode - Move to TSL approach (#28511)
* Normal/Tangent/Bitangent revisions * UVNode: Move to TSL approach * fix type
- Loading branch information
Showing
5 changed files
with
17 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,3 @@ | ||
import { addNodeClass } from '../core/Node.js'; | ||
import AttributeNode from '../core/AttributeNode.js'; | ||
import { nodeObject } from '../shadernode/ShaderNode.js'; | ||
import { attribute } from '../core/AttributeNode.js'; | ||
|
||
class UVNode extends AttributeNode { | ||
|
||
constructor( index = 0 ) { | ||
|
||
super( null, 'vec2' ); | ||
|
||
this.isUVNode = true; | ||
|
||
this.index = index; | ||
|
||
} | ||
|
||
getAttributeName( /*builder*/ ) { | ||
|
||
const index = this.index; | ||
|
||
return 'uv' + ( index > 0 ? index : '' ); | ||
|
||
} | ||
|
||
serialize( data ) { | ||
|
||
super.serialize( data ); | ||
|
||
data.index = this.index; | ||
|
||
} | ||
|
||
deserialize( data ) { | ||
|
||
super.deserialize( data ); | ||
|
||
this.index = data.index; | ||
|
||
} | ||
|
||
} | ||
|
||
export default UVNode; | ||
|
||
export const uv = ( ...params ) => nodeObject( new UVNode( ...params ) ); | ||
|
||
addNodeClass( 'UVNode', UVNode ); | ||
export const uv = ( index ) => attribute( 'uv' + ( index > 0 ? index : '' ), 'vec2' ); |