@@ -819,30 +819,40 @@ class WebGLFunctionNode extends FunctionNode {
819
819
return retArr ;
820
820
case 'this.output.value' :
821
821
switch ( mNode . property . name ) {
822
- case 'x' : retArr . push ( this . output [ 0 ] ) ; break ;
823
- case 'y' : retArr . push ( this . output [ 1 ] ) ; break ;
824
- case 'z' : retArr . push ( this . output [ 2 ] ) ; break ;
822
+ case 'x' :
823
+ retArr . push ( this . output [ 0 ] ) ;
824
+ break ;
825
+ case 'y' :
826
+ retArr . push ( this . output [ 1 ] ) ;
827
+ break ;
828
+ case 'z' :
829
+ retArr . push ( this . output [ 2 ] ) ;
830
+ break ;
825
831
}
826
832
return retArr ;
827
- case 'value' : {
833
+ case 'value' :
834
+ {
828
835
throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
829
836
}
830
- case 'value[]' : {
837
+ case 'value[]' :
838
+ {
831
839
if ( typeof mNode . object . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
832
840
name = 'user_' + mNode . object . name ;
833
841
type = this . getVariableType ( mNode . object . name ) ;
834
842
xProperty = mNode . property ;
835
843
break ;
836
844
}
837
- case 'value[][]' : {
845
+ case 'value[][]' :
846
+ {
838
847
if ( typeof mNode . object . object . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
839
848
name = 'user_' + mNode . object . object . name ;
840
849
type = this . getVariableType ( mNode . object . object . name ) ;
841
850
yProperty = mNode . object . property ;
842
851
xProperty = mNode . property ;
843
852
break ;
844
853
}
845
- case 'value[][][]' : {
854
+ case 'value[][][]' :
855
+ {
846
856
if ( typeof mNode . object . object . object . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
847
857
name = 'user_' + mNode . object . object . object . name ;
848
858
type = this . getVariableType ( mNode . object . object . object . name ) ;
@@ -851,30 +861,41 @@ class WebGLFunctionNode extends FunctionNode {
851
861
xProperty = mNode . property ;
852
862
break ;
853
863
}
854
- case 'value.value' : {
855
- if ( typeof mNode . property . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
856
- if ( this . isAstMathVariable ( mNode ) ) {
857
- retArr . push ( Math [ mNode . property . name ] ) ;
858
- return retArr ;
859
- }
860
- switch ( mNode . property . name ) {
861
- case 'r' : retArr . push ( `user_${ mNode . object . name } .r` ) ; return retArr ;
862
- case 'g' : retArr . push ( `user_${ mNode . object . name } .g` ) ; return retArr ;
863
- case 'b' : retArr . push ( `user_${ mNode . object . name } .b` ) ; return retArr ;
864
- case 'a' : retArr . push ( `user_${ mNode . object . name } .a` ) ; return retArr ;
864
+ case 'value.value' :
865
+ {
866
+ if ( typeof mNode . property . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
867
+ if ( this . isAstMathVariable ( mNode ) ) {
868
+ retArr . push ( Math [ mNode . property . name ] ) ;
869
+ return retArr ;
870
+ }
871
+ switch ( mNode . property . name ) {
872
+ case 'r' :
873
+ retArr . push ( `user_${ mNode . object . name } .r` ) ;
874
+ return retArr ;
875
+ case 'g' :
876
+ retArr . push ( `user_${ mNode . object . name } .g` ) ;
877
+ return retArr ;
878
+ case 'b' :
879
+ retArr . push ( `user_${ mNode . object . name } .b` ) ;
880
+ return retArr ;
881
+ case 'a' :
882
+ retArr . push ( `user_${ mNode . object . name } .a` ) ;
883
+ return retArr ;
884
+ }
885
+ break ;
865
886
}
866
- break ;
867
- }
868
- case 'this.constants.value' : {
869
- if ( typeof mNode . property . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
870
- name = 'constants_' + mNode . property . name ;
871
- type = this . getConstantType ( mNode . property . name ) ;
872
- if ( ! type ) {
873
- throw this . astErrorOutput ( 'Constant has no type' , mNode ) ;
887
+ case 'this.constants.value' :
888
+ {
889
+ if ( typeof mNode . property . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
890
+ name = 'constants_' + mNode . property . name ;
891
+ type = this . getConstantType ( mNode . property . name ) ;
892
+ if ( ! type ) {
893
+ throw this . astErrorOutput ( 'Constant has no type' , mNode ) ;
894
+ }
895
+ break ;
874
896
}
875
- break ;
876
- }
877
- case 'this.constants.value[]' : {
897
+ case 'this.constants.value[]' :
898
+ {
878
899
if ( typeof mNode . object . property . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
879
900
name = 'constants_' + mNode . object . property . name ;
880
901
type = this . getConstantType ( mNode . object . property . name ) ;
@@ -884,7 +905,8 @@ class WebGLFunctionNode extends FunctionNode {
884
905
xProperty = mNode . property ;
885
906
break ;
886
907
}
887
- case 'this.constants.value[][]' : {
908
+ case 'this.constants.value[][]' :
909
+ {
888
910
if ( typeof mNode . object . object . property . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
889
911
name = 'constants_' + mNode . object . object . property . name ;
890
912
type = this . getConstantType ( mNode . object . object . property . name ) ;
@@ -895,7 +917,8 @@ class WebGLFunctionNode extends FunctionNode {
895
917
xProperty = mNode . property ;
896
918
break ;
897
919
}
898
- case 'this.constants.value[][][]' : {
920
+ case 'this.constants.value[][][]' :
921
+ {
899
922
if ( typeof mNode . object . object . object . property . name !== 'string' ) throw this . astErrorOutput ( 'Unexpected expression' , mNode ) ;
900
923
name = 'constants_' + mNode . object . object . object . property . name ;
901
924
type = this . getConstantType ( mNode . object . object . object . property . name ) ;
@@ -1345,8 +1368,8 @@ class WebGLFunctionNode extends FunctionNode {
1345
1368
1346
1369
getMemberExpressionPropertyMarkup ( property ) {
1347
1370
if ( ! property ) {
1348
- throw new Error ( 'Property not set' ) ;
1349
- }
1371
+ throw new Error ( 'Property not set' ) ;
1372
+ }
1350
1373
const type = this . firstAvailableTypeFromAst ( property ) ;
1351
1374
const result = [ ] ;
1352
1375
if ( type === 'Number' ) {
@@ -1396,4 +1419,4 @@ const typeLookupMap = {
1396
1419
1397
1420
module . exports = {
1398
1421
WebGLFunctionNode
1399
- } ;
1422
+ } ;
0 commit comments