From 52af410f5184af8805fb533ac262fac237277964 Mon Sep 17 00:00:00 2001 From: Squareys Date: Sun, 3 May 2020 10:23:05 +0200 Subject: [PATCH] Shaders: Add Weights and JointIndices attribute types Signed-off-by: Squareys --- src/Magnum/Shaders/Generic.h | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/Magnum/Shaders/Generic.h b/src/Magnum/Shaders/Generic.h index 0bf5209f7..b309e9ce9 100644 --- a/src/Magnum/Shaders/Generic.h +++ b/src/Magnum/Shaders/Generic.h @@ -126,13 +126,13 @@ both bitangents and object ID for instancing, \n 6 -* *Reserved* --- vertex weights +@ref Weights 7 -* *Reserved* --- bone indices +@ref JointIds @@ -150,13 +150,13 @@ both bitangents and object ID for instancing, \n 10 -* *Reserved* --- 2nd vertex weights +@ref SecondaryWeights 11 -* *Reserved* --- 2nd bone indices +@ref SecondaryJointIds @@ -381,7 +381,21 @@ template struct Generic { */ typedef GL::Attribute<5, Vector3> Normal; - /* 6, 7 reserved for vertex weights / bone IDs */ + /** + * @brief Skin weights + * + * @ref Magnum::Vector4 "Vector4", four weights of influence per @ref JointIndices. + * Corresponds to @ref Trade::MeshAttribute::Weights. + */ + typedef GL::Attribute<6, Vector4> Weights; + + /** + * @brief Joint IDs + * + * @ref Magnum::Vector4ui "Vector4ui", four joint indices that may affect the vertex. + * Corresponds to @ref Trade::MeshAttribute::JointIds. + */ + typedef GL::Attribute<7, Vector4ui> JointIds; /** * @brief (Instanced) transformation matrix @@ -478,6 +492,11 @@ struct BaseGeneric { #ifndef MAGNUM_TARGET_GLES2 typedef GL::Attribute<4, UnsignedInt> ObjectId; #endif + typedef GL::Attribute<6, Vector4> Weights; + typedef GL::Attribute<7, Vector4> JointIds; + + typedef GL::Attribute<10, Vector4> SecondaryWeights; + typedef GL::Attribute<11, Vector4> SecondaryJointIds; typedef GL::Attribute<15, Vector2> TextureOffset; @@ -506,7 +525,6 @@ template<> struct Generic<3>: BaseGeneric { typedef GL::Attribute<3, Vector4> Tangent4; typedef GL::Attribute<4, Vector3> Bitangent; /* also ObjectId */ typedef GL::Attribute<5, Vector3> Normal; - /* 6, 7 reserved for vertex weights / bone IDs */ typedef GL::Attribute<8, Matrix4> TransformationMatrix; /* 9, 10, 11 occupied by TransformationMatrix */