mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Another source code update on skeletal animation article.
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#define MAX_BONE_INFLUENCE 4
|
||||
|
||||
struct Vertex {
|
||||
// position
|
||||
glm::vec3 Position;
|
||||
@@ -23,6 +25,10 @@ struct Vertex {
|
||||
glm::vec3 Tangent;
|
||||
// bitangent
|
||||
glm::vec3 Bitangent;
|
||||
//bone indexes which will influence this vertex
|
||||
int m_BoneIDs[MAX_BONE_INFLUENCE];
|
||||
//weights from each bone
|
||||
float m_Weights[MAX_BONE_INFLUENCE];
|
||||
};
|
||||
|
||||
struct Texture {
|
||||
@@ -127,7 +133,13 @@ private:
|
||||
// vertex bitangent
|
||||
glEnableVertexAttribArray(4);
|
||||
glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, Bitangent));
|
||||
// ids
|
||||
glEnableVertexAttribArray(5);
|
||||
glVertexAttribIPointer(5, 4, GL_INT, sizeof(Vertex), (void*)offsetof(Vertex, m_BoneIDs));
|
||||
|
||||
// weights
|
||||
glEnableVertexAttribArray(6);
|
||||
glVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, m_Weights));
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user