Browse Source

Shaders: Add Weights and JointIndices attribute types

Signed-off-by: Squareys <squareys@googlemail.com>
pull/444/head
Squareys 6 years ago
parent
commit
fc940721e6
  1. 29
      src/Magnum/Shaders/Generic.h

29
src/Magnum/Shaders/Generic.h

@ -126,13 +126,13 @@ both bitangents and object ID for instancing, \n
<tr> <tr>
<td>6</td> <td>6</td>
<td colspan="3"> <td colspan="3">
* *Reserved* --- vertex weights @ref Weights
</td> </td>
</tr> </tr>
<tr> <tr>
<td>7</td> <td>7</td>
<td colspan="3"> <td colspan="3">
* *Reserved* --- bone indices @ref JointIndices
</td> </td>
</tr> </tr>
<tr> <tr>
@ -150,13 +150,13 @@ both bitangents and object ID for instancing, \n
<tr> <tr>
<td>10</td> <td>10</td>
<td colspan="2"> <td colspan="2">
* *Reserved* --- 2nd vertex weights @ref Weights
</td> </td>
</tr> </tr>
<tr> <tr>
<td>11</td> <td>11</td>
<td colspan="2"> <td colspan="2">
* *Reserved* --- 2nd bone indices @ref JointIndices
</td> </td>
</tr> </tr>
<tr> <tr>
@ -358,7 +358,26 @@ template<UnsignedInt dimensions> struct Generic {
*/ */
typedef GL::Attribute<5, Vector3> Normal; 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.
*/
// TODO: E.g. gltf supports importing multiple sets of 4 weights (WEIGHTS_0 [0;3], WEIGHTS_1 [4;7])
// I suppose these would require special shaders and it's fine to only support 4 for the GenericShaders
typedef GL::Attribute<6, Vector4> Weights;
/**
* @brief Joint indices
*
* @ref Magnum::Vector4 "Vector4", four weights of influence per @ref JointIndices.
* Corresponds to @ref Trade::MeshAttribute::Weights.
*/
// TODO: E.g. gltf supports importing multiple sets of 4 indices (JOINTS_0 [0;3], JOINTS_1 [4;7])
// I suppose these would require special shaders and it's fine to only support 4 for the GenericShaders
// TODO: This is called "Joints" in gltf.
typedef GL::Attribute<7, Vector4> JointIndices;
/** /**
* @brief (Instanced) transformation matrix * @brief (Instanced) transformation matrix

Loading…
Cancel
Save