Fix glslify relative imports + inner module imports

This commit is contained in:
Ricardo Matias
2020-04-25 10:10:40 +02:00
committed by Edwin Jakobs
parent 400347aad1
commit 9f3e43c39e
47 changed files with 1389 additions and 62 deletions

View File

@@ -42,11 +42,12 @@ object TestGlslify : Spek({
describe("should import everything in order + write naming") {
val url = resourceUrl("/a.glsl")
val processed = preprocessGlslifyFromUrl(url, glslifyPath = glslifyPath)
println(processed)
processed shouldContainAll listOf(
"float add(float a, float b)",
"float multiply(float a, float b)",
"float equation(float a, float b)",
"float subtract(float a, float b)",
"float luminance(vec3 color)",
"void main()"
)
@@ -81,5 +82,18 @@ float luma(vec4 color) {
return dot(color.rgb, vec3(0.299, 0.587, 0.114));
}"""
}
describe("should import multiple from same package") {
val shader = """#version 330
#pragma glslify: snoise = require(glsl-noise/simplex/2d)
#pragma glslify: cnoise = require(glsl-noise/classic/2d)
"""
val processed = preprocessGlslify(shader, glslifyPath = glslifyPath)
processed shouldContainAll listOf(
"float snoise(vec2 v)",
"float cnoise(vec2 P)"
)
}
}
})