#include "model.hpp"
-struct Blendshapes {
+
+struct Blendshape {
+ std::string name;
+ std::vector<glm::vec3> deltas;
+ float weight;
+};
+
+struct BlendshapeModel {
Model *model;
std::vector<glm::vec3> neutral;
- std::vector<std::vector<glm::vec3>> deltas;
+ std::vector<Blendshape> blendshapes;
+ std::vector<std::vector<float>> animation;
+ unsigned long curFrame = 0;
};
-void createBlendshapes(std::vector<std::string> blendshapes, std::string neutral, Program p, Blendshapes *res);
+typedef std::pair<int, int> VertIdx;
+
+void loadBlendshapes(std::string dir, Program p, BlendshapeModel *bsModel);
+/* void createBlendshapes(std::vector<std::string> blendshapes, std::string neutral, Program p, BlendshapeModel *res); */
+
+void interpolateBlendshapes(BlendshapeModel *b);
+
+void solveWeights(BlendshapeModel *b, std::map<VertIdx, glm::vec3> manips);
-void interpolateBlendshapes(Blendshapes *b, std::vector<float> amounts);
+void stepBlendshapeAnim(BlendshapeModel *b);