-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor remote visualizer stuff to support non-RGB pixel formats.
- Loading branch information
Showing
2 changed files
with
107 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package baaahs.gl.glsl | ||
|
||
import baaahs.describe | ||
import baaahs.gl.override | ||
import baaahs.toBeSpecified | ||
import baaahs.toEqual | ||
import ch.tutteli.atrium.api.verbs.expect | ||
import org.spekframework.spek2.Spek | ||
import org.spekframework.spek2.dsl.Skip | ||
|
||
object GlslTypeSpec : Spek({ | ||
describe<GlslType> { | ||
val type by value<GlslType> { toBeSpecified() } | ||
|
||
describe("arrays") { | ||
override(type) { GlslType.Int.arrayOf(8) } | ||
|
||
it("has valid a GLSL declaration") { | ||
expect(type.glslLiteral) | ||
.toEqual("int[8]") | ||
} | ||
} | ||
|
||
describe("structs") { | ||
override(type) { | ||
GlslType.Struct( | ||
"FixtureInfo", | ||
"origin" to GlslType.Vec3, | ||
"heading" to GlslType.Vec3, | ||
"matrix" to GlslType.Matrix4 | ||
) | ||
} | ||
|
||
it("#toGlsl generates valid a GLSL declaration") { | ||
expect((type as GlslType.Struct).toGlsl(GlslCode.Namespace("pfx"), emptySet())) | ||
.toEqual( | ||
""" | ||
struct pfx_FixtureInfo { | ||
vec3 origin; | ||
vec3 heading; | ||
mat4 matrix; | ||
}; | ||
""".trimIndent() + "\n\n" | ||
) | ||
} | ||
|
||
context("with arrays") { | ||
override(type) { | ||
GlslType.Struct( | ||
"FixtureInfo", | ||
"origin" to GlslType.Vec3.arrayOf(3), | ||
"heading" to GlslType.Vec3, | ||
"matrix" to GlslType.Matrix4 | ||
) | ||
} | ||
|
||
it( | ||
"#toGlsl generates valid a GLSL declaration", | ||
skip = Skip.Yes("Fix position of array marker in declaration.") | ||
) { | ||
expect((type as GlslType.Struct).toGlsl(GlslCode.Namespace("pfx"), emptySet())) | ||
.toEqual( | ||
""" | ||
struct pfx_FixtureInfo { | ||
vec3 origin[3]; | ||
vec3 heading; | ||
mat4 matrix; | ||
}; | ||
""".trimIndent() + "\n\n" | ||
) | ||
} | ||
} | ||
} | ||
} | ||
}) |