-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswell-integration.cpp
32 lines (28 loc) · 1015 Bytes
/
swell-integration.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <string.h>
#include "swell-integration.h"
#include "AnimationGeneration.cpp"
#include "modeldata.pb.h"
using namespace swellanimations;
Animation* generateTestData(ModelData* modelData) {
Node model = modelData->model();
Animation* animation = new Animation();
for (int x = 0; x < modelData->controlpoints_size(); x++) {
Node* node = animation->add_frames();
node->CopyFrom(model);
node->set_allocated_position(modelData->mutable_controlpoints(x));
}
return animation;
}
void* generateAnimation(char* a, int size, unsigned int& responseSize) {
ModelData* modelData = new ModelData();
modelData->ParseFromArray(a, size);
//Animation* animation = generateTestData(modelData);
Animation* animation = getFrames(modelData);
responseSize = animation->ByteSize();
void* response = malloc(responseSize);
animation->SerializeToArray(response, responseSize);
return response;
}