|
@@ -81,29 +81,29 @@ const nodeObjectsCacheMap = new WeakMap();
|
|
|
|
|
|
const ShaderNodeObject = function ( obj ) {
|
|
const ShaderNodeObject = function ( obj ) {
|
|
|
|
|
|
- const type = typeof obj;
|
|
|
|
|
|
+ const type = getValueType( obj );
|
|
|
|
|
|
- if ( ( type === 'number' ) || ( type === 'boolean' ) ) {
|
|
|
|
|
|
+ if ( type === 'node' ) {
|
|
|
|
|
|
- return nodeObject( getAutoTypedConstNode( obj ) );
|
|
|
|
|
|
+ let nodeObject = nodeObjectsCacheMap.get( obj );
|
|
|
|
|
|
- } else if ( type === 'object' ) {
|
|
|
|
|
|
+ if ( nodeObject === undefined ) {
|
|
|
|
|
|
- if ( obj && obj.isNode === true ) {
|
|
|
|
|
|
+ nodeObject = new Proxy( obj, shaderNodeHandler );
|
|
|
|
+ nodeObjectsCacheMap.set( obj, nodeObject );
|
|
|
|
+ nodeObjectsCacheMap.set( nodeObject, nodeObject );
|
|
|
|
|
|
- let nodeObject = nodeObjectsCacheMap.get( obj );
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if ( nodeObject === undefined ) {
|
|
|
|
|
|
+ return nodeObject;
|
|
|
|
|
|
- nodeObject = new Proxy( obj, shaderNodeHandler );
|
|
|
|
- nodeObjectsCacheMap.set( obj, nodeObject );
|
|
|
|
- nodeObjectsCacheMap.set( nodeObject, nodeObject );
|
|
|
|
|
|
+ } else if ( ( type === 'float' ) || ( type === 'boolean' ) ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ return nodeObject( getAutoTypedConstNode( obj ) );
|
|
|
|
|
|
- return nodeObject;
|
|
|
|
|
|
+ } else if ( type && type !== 'string' ) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ return nodeObject( new ConstNode( obj ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|