From 31f2c79271cb39a116b8b411080b298668c33127 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 6 Apr 2016 09:39:42 +0300 Subject: [PATCH] bump mapping vertex attributes --- src/dlangui/graphics/scene/effect.d | 4 ++++ src/dlangui/graphics/scene/mesh.d | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/dlangui/graphics/scene/effect.d b/src/dlangui/graphics/scene/effect.d index f68a6b63..717c4c2b 100644 --- a/src/dlangui/graphics/scene/effect.d +++ b/src/dlangui/graphics/scene/effect.d @@ -143,6 +143,10 @@ class Effect : GLProgram { return getAttribLocation(DefaultAttribute.a_texCoord); case NORMAL: return getAttribLocation(DefaultAttribute.a_normal); + case TANGENT: + return getAttribLocation(DefaultAttribute.a_tangent); + case BINORMAL: + return getAttribLocation(DefaultAttribute.a_binormal); default: return super.getVertexElementLocation(type); } diff --git a/src/dlangui/graphics/scene/mesh.d b/src/dlangui/graphics/scene/mesh.d index 5412f51e..6895795e 100644 --- a/src/dlangui/graphics/scene/mesh.d +++ b/src/dlangui/graphics/scene/mesh.d @@ -119,6 +119,10 @@ enum VertexElementType : ubyte { POSITION = 0, NORMAL, COLOR, + TANGENT, + BINORMAL, + BLENDWEIGHTS, + BLENDINDICES, TEXCOORD0, TEXCOORD1, TEXCOORD2, @@ -168,11 +172,16 @@ struct VertexElement { this(VertexElementType type, ubyte size = 0) { if (size == 0) { + // autoassign default size switch(type) with (VertexElementType) { case POSITION: case NORMAL: + case TANGENT: + case BINORMAL: size = 3; break; + case BLENDWEIGHTS: + case BLENDINDICES: case COLOR: size = 4; break; @@ -503,7 +512,9 @@ class Mesh : RefCountedObject { } static Mesh createCubeMesh(vec3 pos, float d=1, vec4 color = vec4(1,1,1,1)) { - Mesh mesh = new Mesh(VertexFormat(VertexElementType.POSITION, VertexElementType.COLOR, VertexElementType.TEXCOORD0)); + Mesh mesh = new Mesh(VertexFormat(VertexElementType.POSITION, VertexElementType.COLOR, VertexElementType.TEXCOORD0 + //, VertexElementType.TANGENT, VertexElementType.BINORMAL + )); mesh.addCubeMesh(pos, d, color); return mesh; }