Просмотр исходного кода

TSLEncoder: Fix transpilation issues. (#30410)

* TSLEncoder: Fix number imports.

* GLSLDecoder: Improve uint support.

* GLSLDecoder: Fix CodeQL feedback.
Michael Herzog 11 месяцев назад
Родитель
Сommit
84b5607155
2 измененных файлов с 4 добавлено и 2 удалено
  1. 2 2
      examples/jsm/transpiler/GLSLDecoder.js
  2. 2 0
      examples/jsm/transpiler/TSLEncoder.js

+ 2 - 2
examples/jsm/transpiler/GLSLDecoder.js

@@ -461,11 +461,11 @@ class GLSLDecoder {
 			const isHex = /^(0x)/.test( firstToken.str );
 
 			if ( isHex ) type = 'int';
-			else if ( /u$/.test( firstToken.str ) ) type = 'uint';
+			else if ( /u$|U$/.test( firstToken.str ) ) type = 'uint';
 			else if ( /f|e|\./.test( firstToken.str ) ) type = 'float';
 			else type = 'int';
 
-			let str = firstToken.str.replace( /u|i$/, '' );
+			let str = firstToken.str.replace( /u|U|i$/, '' );
 
 			if ( isHex === false ) {
 

+ 2 - 0
examples/jsm/transpiler/TSLEncoder.js

@@ -255,6 +255,8 @@ class TSLEncoder {
 
 			code = node.expression.type + '( ' + node.type + ' ' + node.expression.value + ' )';
 
+			this.addImport( node.expression.type );
+
 		} else if ( node.isUnary ) {
 
 			let type = unaryLib[ node.type ];

粤ICP备19079148号