@@ -57,29 +57,31 @@ ShaderNodeRegistry.prototype._genVariantKey = function (argTypes, options) {
57
57
} ;
58
58
59
59
ShaderNodeRegistry . prototype . get = function ( name , argTypes , options ) {
60
- if ( this . _nodeCache [ name ] ) {
61
- if ( ! this . _nodeDef [ name ] . gen ) {
60
+ var cachedNode = this . _nodeCache [ name ] ;
61
+ if ( cachedNode ) {
62
+ var nodeDef = this . _nodeDef [ name ] ;
63
+ if ( ! nodeDef . gen ) {
62
64
// if no generator, passthrough
63
- if ( ! this . _nodeCache [ name ] . def ) {
64
- this . _nodeCache [ name ] . def = new ShaderGraphNode ( this . _nodeDef [ name ] . code ) ;
65
+ if ( ! cachedNode . def ) {
66
+ cachedNode . def = new ShaderGraphNode ( nodeDef . code ) ;
65
67
}
66
- return this . _nodeCache [ name ] . def ;
68
+ return cachedNode . def ;
67
69
}
68
70
69
71
var variantKey = this . _genVariantKey ( argTypes , options ) ;
70
- if ( this . _nodeCache [ name ] [ variantKey ] ) {
72
+ if ( cachedNode [ variantKey ] ) {
71
73
// return cached variant
72
- return this . _nodeCache [ name ] [ variantKey ] ;
74
+ return cachedNode [ variantKey ] ;
73
75
}
74
76
75
77
// generate variant, add to cache and return it
76
- var variantCode = this . _nodeDef [ name ] . gen ( argTypes , options ) ;
78
+ var variantCode = nodeDef . gen ( argTypes , options ) ;
77
79
if ( variantCode ) {
78
- this . _nodeCache [ name ] [ variantKey ] = new ShaderGraphNode ( variantCode ) ;
80
+ cachedNode [ variantKey ] = new ShaderGraphNode ( variantCode ) ;
79
81
80
- this . _nodeCache [ name ] [ variantKey ] . _precision = ( ( options && options . precision ) ? options . precision : '' ) ;
82
+ cachedNode [ variantKey ] . _precision = ( ( options && options . precision ) ? options . precision : '' ) ;
81
83
82
- return this . _nodeCache [ name ] [ variantKey ] ;
84
+ return cachedNode [ variantKey ] ;
83
85
}
84
86
}
85
87
} ;
0 commit comments