From d4b7df65b1f726b7d139373728ec1431f6f6a552 Mon Sep 17 00:00:00 2001 From: Abe Pazos Date: Sun, 28 Aug 2022 20:23:58 +0000 Subject: [PATCH] [orx-shader-phrases] mat2 is valid GLSL but was missing (#271) --- orx-shader-phrases/src/commonMain/kotlin/ShaderPreprocessor.kt | 2 +- orx-shader-phrases/src/jvmTest/kotlin/TestFunctionNameRx.kt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/orx-shader-phrases/src/commonMain/kotlin/ShaderPreprocessor.kt b/orx-shader-phrases/src/commonMain/kotlin/ShaderPreprocessor.kt index 15f351e3..81972f7c 100644 --- a/orx-shader-phrases/src/commonMain/kotlin/ShaderPreprocessor.kt +++ b/orx-shader-phrases/src/commonMain/kotlin/ShaderPreprocessor.kt @@ -61,7 +61,7 @@ object ShaderPhraseRegistry { */ fun getGLSLFunctionName(glsl: String): String { val functionRex = - Regex("""\s*(float|int|[bi]?vec[234]|mat[34])\s+(\w+)\s*\(.*\).*""") + Regex("""\s*(float|int|[bi]?vec[234]|mat[234])\s+(\w+)\s*\(.*\).*""") val defs = glsl.split("\n").filter { functionRex.matches(it) }.take(1).mapNotNull { diff --git a/orx-shader-phrases/src/jvmTest/kotlin/TestFunctionNameRx.kt b/orx-shader-phrases/src/jvmTest/kotlin/TestFunctionNameRx.kt index 75544cf3..00ec5104 100644 --- a/orx-shader-phrases/src/jvmTest/kotlin/TestFunctionNameRx.kt +++ b/orx-shader-phrases/src/jvmTest/kotlin/TestFunctionNameRx.kt @@ -17,6 +17,7 @@ object TestFunctionNameRx : Spek({ "vec4 ggg() {" to "ggg", "vec3 hhh() {" to "hhh", "vec2 iii() {" to "iii", + "mat2 ii2() {" to "ii2", "mat3 jjj() {" to "jjj", "mat4 kkk() {" to "kkk", "float lll() {" to "lll",