Can't have a VertexSpecification!vec3f
John-Colvin opened this issue · 4 comments
John-Colvin commented
you get this:
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d(215,43): Error: type float[3][0] is not an expression
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d(216,17): Error: undefined identifier 'U'
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d(78,21): Error: template instance gfm.opengl.vertex.toGLTypeAndSize!(float[3]) error instantiating
source/app.d(26,5): instantiated from here: VertexSpecification!(Vector!(float, 3))
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Error: this for ptr needs to be type Vector not type gfm.opengl.vertex.VertexSpecification!(Vector!(float, 3))
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector._N is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Error: variable gfm.math.vector.Vector!(float, 3).Vector._N is not accessible from module vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector._T is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Error: type float is not an expression
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector.isConvertible(T) is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector.isForeign(T) is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector.isValidSwizzle(string op, int lastSwizzleClass = -1) is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector.searchElement(char c, string s) is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector.hasNoDuplicates(string s) is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector.isValidSwizzleUnique(string op) is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector.swizzleIndex(char c) is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector.swizzleClassify(char c) is not visible from module gfm.opengl.vertex
../../../.dub/packages/gfm-6.2.0/gfm/opengl/gfm/opengl/vertex.d-mixin-65(65,18): Deprecation: gfm.math.vector.Vector!(float, 3).Vector.swizzleTuple(string op) is not visible from module gfm.opengl.vertex
p0nce commented
I think you are supposed to define a struct containing a vec3f, and instantiating VertexSpecification!ThatStruct
instead.
John-Colvin commented
Sure, that's what I'm doing now, but it seems an unnecessary complication for simple cases
p0nce commented
Marked as enhancement, could be interesting indeed.
p0nce commented
Available as v6.2.3
/// A helper template to define a simple vertex type from a vector type.
/// By default the unique field will be name "position".
/// Note: it's important the struct isn't larger than the vector itself.
///
/// Example:
/// VertexSpecification!(VertexPosition!vec3f);
///
align(1) struct VertexPosition(Vec, string fieldName = "position") if (isVector!Vec)
{
align(1):
mixin("Vec " ~ fieldName ~ ";");
static assert(VertexPosition.sizeof == Vec.sizeof);
}
unittest
{
alias Test = VertexSpecification!(VertexPosition!vec3f);
}