From 5f10170dbfe82d6d776f23934e3b028044f170c4 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Jul 2012 03:16:52 +0600 Subject: [PATCH] Procedure: minor AGAL compiler optimization --- src/alternativa/engine3d/materials/compiler/Procedure.as | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/alternativa/engine3d/materials/compiler/Procedure.as b/src/alternativa/engine3d/materials/compiler/Procedure.as index a2a80cb..9ce487b 100644 --- a/src/alternativa/engine3d/materials/compiler/Procedure.as +++ b/src/alternativa/engine3d/materials/compiler/Procedure.as @@ -312,6 +312,7 @@ package alternativa.engine3d.materials.compiler { if (variables.length > 1) throw new Error("Syntax error. Unknown novel error."); } + private const agalParser:RegExp = /[A-Za-z]+(((\[.+\])|(\d+))(\.[xyzw]{1,4})?(\ *\<.*>)?)?/g; private function writeAGALExpression(source:String):void { var commentIndex:int = source.indexOf("//"); if (commentIndex >= 0) { @@ -349,7 +350,7 @@ package alternativa.engine3d.materials.compiler { // You can not use kil in fragment shader // TODO: try to move regexp in static - var operands:Array = source.match(/[A-Za-z]+(((\[.+\])|(\d+))(\.[xyzw]{1,4})?(\ *\<.*>)?)?/g); + var operands:Array = source.match(agalParser); // It is possible not use the input parameter. It is optimization of the linker // Determine the size of constant