Rework UI architecture and blendshape animation
[opengl.git] / blendshapes.hpp
index fd3bcc4264cbb6a0957b32e275c603e9e3d9ad82..d7081b1e48c673a0d3ca91dc8893a433dcaf499a 100644 (file)
@@ -1,10 +1,26 @@
 #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);