Browse Source

WIP

Signed-off-by: Squareys <squareys@googlemail.com>
pull/444/head
Squareys 6 years ago
parent
commit
29990a7d64
  1. 24
      src/Magnum/MeshTools/Test/CompileGLTest.cpp
  2. 4
      src/Magnum/Shaders/Phong.vert

24
src/Magnum/MeshTools/Test/CompileGLTest.cpp

@ -918,54 +918,54 @@ void CompileGLTest::packedAttributes() {
{Math::pack<Vector3s>(Vector3{-0.75f, -0.75f, -0.35f}),
Math::pack<Vector3s>(Vector3{-0.5f, -0.5f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{0.0f, 0.0f}), 0x00ff00_rgb, 13562,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{ 0.00f, -0.75f, -0.25f}),
Math::pack<Vector3s>(Vector3{ 0.0f, -0.5f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{0.5f, 0.0f}), 0x808000_rgb, 13562,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{ 0.75f, -0.75f, -0.35f}),
Math::pack<Vector3s>(Vector3{ 0.5f, -0.5f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{1.0f, 0.0f}), 0xff0000_rgb, 13562,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{-0.75f, 0.00f, -0.25f}),
Math::pack<Vector3s>(Vector3{-0.5f, 0.0f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{0.0f, 0.5f}), 0x00ff80_rgb, 13562,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{ 0.00f, 0.00f, 0.00f}),
Math::pack<Vector3s>(Vector3{ 0.0f, 0.0f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{0.5f, 0.5f}), 0x808080_rgb, 13562,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{ 0.75f, 0.00f, -0.25f}),
Math::pack<Vector3s>(Vector3{ 0.5f, 0.0f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{1.0f, 0.5f}), 0xff0080_rgb, 13562,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{-0.75f, 0.00f, -0.25f}),
Math::pack<Vector3s>(Vector3{-0.5f, 0.0f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{0.0f, 0.5f}), 0x00ff80_rgb, 26234,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{ 0.00f, 0.00f, 0.00f}),
Math::pack<Vector3s>(Vector3{ 0.0f, 0.0f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{0.5f, 0.5f}), 0x808080_rgb, 26234,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{ 0.75f, 0.00f, -0.25f}),
Math::pack<Vector3s>(Vector3{ 0.5f, 0.0f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{1.0f, 0.5f}), 0xff0080_rgb, 26234,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{-0.75f, 0.75f, -0.35f}),
Math::pack<Vector3s>(Vector3{-0.5f, 0.5f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{0.0f, 1.0f}), 0x00ffff_rgb, 26234,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{ 0.0f, 0.75f, -0.25f}),
Math::pack<Vector3s>(Vector3{ 0.0f, 0.5f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{0.5f, 1.0f}), 0x8080ff_rgb, 26234,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
{Math::pack<Vector3s>(Vector3{ 0.75f, 0.75f, -0.35f}),
Math::pack<Vector3s>(Vector3{ 0.5f, 0.5f, 1.0f}.normalized()),
Math::pack<Vector2us>(Vector2{1.0f, 1.0f}), 0xff00ff_rgb, 26234,
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{0, 1, 2, 3}},
Vector4{0.4f, 0.3f, 0.2f, 0.1f}, Vector4us{2, 1, 0, 3}},
};
static_assert(sizeof(PackedVertex) % 4 == 0,
"the vertex is not 4-byte aligned and that's bad");

4
src/Magnum/Shaders/Phong.vert

@ -190,10 +190,10 @@ void main() {
mat4 skinMatrix;
int i = 0;
for(; i != JOINTS_PER_VERTEX && i != 4; ++i)
skinMatrix += weights[i]*jointMatrices[int(jointIds[i])];
skinMatrix += weights[i]*jointMatrices[jointIds[i]];
#if JOINTS_PER_VERTEX > 4
for(i = 0; i != JOINTS_PER_VERTEX - 4 && i != 4; ++i)
skinMatrix += secondaryWeights[i]*jointMatrices[int(secondaryJointIds[i])];
skinMatrix += secondaryWeights[i]*jointMatrices[secondaryJointIds[i]];
#endif
#endif

Loading…
Cancel
Save