diff --git a/orx-glslify/src/main/kotlin/Glslify.kt b/orx-glslify/src/main/kotlin/Glslify.kt index efe3f46d..1bcdeca8 100644 --- a/orx-glslify/src/main/kotlin/Glslify.kt +++ b/orx-glslify/src/main/kotlin/Glslify.kt @@ -31,7 +31,7 @@ fun preprocessGlslify(source: String, glslifyPath: String = "src/main/resources/ importTree = mutableSetOf() return source.split("\n").map { line -> - if (line.startsWith(PRAGMA_IDENTIFIER)) { + if (line.trimStart().startsWith(PRAGMA_IDENTIFIER)) { Regex(IMPORT_PATT).find(line)?.let { if (it.groupValues.size > 1) { val functionName = it.groupValues[1] diff --git a/orx-glslify/src/test/kotlin/TestGlslify.kt b/orx-glslify/src/test/kotlin/TestGlslify.kt index a7972a22..13f5fbfc 100644 --- a/orx-glslify/src/test/kotlin/TestGlslify.kt +++ b/orx-glslify/src/test/kotlin/TestGlslify.kt @@ -20,7 +20,7 @@ object TestGlslify : Spek({ describe("should download shader with just the module's name") { val shader = """#version 330 -#pragma glslify: luma = require(glsl-luma) + #pragma glslify: luma = require(glsl-luma) """ val processed = preprocessGlslify(shader, glslifyPath = glslifyPath)