Merge branch 'glt2anim' of https://github.com/haroonq/assimp into glt2anim
commit
bfe1dc2914
|
@ -973,9 +973,14 @@ inline void ExtractTranslationSampler(Asset& asset, std::string& animId, Ref<Buf
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
const vec3 kZeros = {0, 0, 0};
|
const vec3 kZeros = {0, 0, 0};
|
||||||
std::vector<float> times(numKeyframes);
|
std::vector<float> times(numKeyframes);
|
||||||
std::vector<vec3> values(numKeyframes, kZeros);
|
std::vector<vec3> values(numKeyframes, kZeros);
|
||||||
|
=======
|
||||||
|
std::vector<float> times(numKeyframes);
|
||||||
|
std::vector<vec3> values(numKeyframes);
|
||||||
|
>>>>>>> 57d3d71b6ec68f41a10c1da2f01d096f1308e88c
|
||||||
for (unsigned int i = 0; i < numKeyframes; ++i) {
|
for (unsigned int i = 0; i < numKeyframes; ++i) {
|
||||||
const aiVectorKey& key = nodeChannel->mPositionKeys[i];
|
const aiVectorKey& key = nodeChannel->mPositionKeys[i];
|
||||||
// mTime is measured in ticks, but GLTF time is measured in seconds, so convert.
|
// mTime is measured in ticks, but GLTF time is measured in seconds, so convert.
|
||||||
|
@ -997,9 +1002,14 @@ inline void ExtractScaleSampler(Asset& asset, std::string& animId, Ref<Buffer>&
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
const vec3 kZeros = {0, 0, 0};
|
const vec3 kZeros = {0, 0, 0};
|
||||||
std::vector<float> times(numKeyframes);
|
std::vector<float> times(numKeyframes);
|
||||||
std::vector<vec3> values(numKeyframes, kZeros);
|
std::vector<vec3> values(numKeyframes, kZeros);
|
||||||
|
=======
|
||||||
|
std::vector<float> times(numKeyframes);
|
||||||
|
std::vector<vec3> values(numKeyframes);
|
||||||
|
>>>>>>> 57d3d71b6ec68f41a10c1da2f01d096f1308e88c
|
||||||
for (unsigned int i = 0; i < numKeyframes; ++i) {
|
for (unsigned int i = 0; i < numKeyframes; ++i) {
|
||||||
const aiVectorKey& key = nodeChannel->mScalingKeys[i];
|
const aiVectorKey& key = nodeChannel->mScalingKeys[i];
|
||||||
// mTime is measured in ticks, but GLTF time is measured in seconds, so convert.
|
// mTime is measured in ticks, but GLTF time is measured in seconds, so convert.
|
||||||
|
@ -1021,9 +1031,14 @@ inline void ExtractRotationSampler(Asset& asset, std::string& animId, Ref<Buffer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
const vec4 kZeros = {0, 0, 0, 0};
|
const vec4 kZeros = {0, 0, 0, 0};
|
||||||
std::vector<float> times(numKeyframes);
|
std::vector<float> times(numKeyframes);
|
||||||
std::vector<vec4> values(numKeyframes, kZeros);
|
std::vector<vec4> values(numKeyframes, kZeros);
|
||||||
|
=======
|
||||||
|
std::vector<float> times(numKeyframes);
|
||||||
|
std::vector<vec4> values(numKeyframes);
|
||||||
|
>>>>>>> 57d3d71b6ec68f41a10c1da2f01d096f1308e88c
|
||||||
for (unsigned int i = 0; i < numKeyframes; ++i) {
|
for (unsigned int i = 0; i < numKeyframes; ++i) {
|
||||||
const aiQuatKey& key = nodeChannel->mRotationKeys[i];
|
const aiQuatKey& key = nodeChannel->mRotationKeys[i];
|
||||||
// mTime is measured in ticks, but GLTF time is measured in seconds, so convert.
|
// mTime is measured in ticks, but GLTF time is measured in seconds, so convert.
|
||||||
|
|
|
@ -751,9 +751,15 @@ static void BuildVertexWeightMapping(Ref<Mesh>& mesh, std::vector<std::vector<ai
|
||||||
attr.weight[0]->ExtractData(weights);
|
attr.weight[0]->ExtractData(weights);
|
||||||
attr.joint[0]->ExtractData(indices);
|
attr.joint[0]->ExtractData(indices);
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
for (int i = 0; i < num_vertices; ++i) {
|
for (int i = 0; i < num_vertices; ++i) {
|
||||||
for (int j = 0; j < 4; ++j) {
|
for (int j = 0; j < 4; ++j) {
|
||||||
const unsigned int bone = indices[i].values[j];
|
const unsigned int bone = indices[i].values[j];
|
||||||
|
=======
|
||||||
|
for (unsigned int i = 0; i < num_vertices; ++i) {
|
||||||
|
for (unsigned int j = 0; j < 4; ++j) {
|
||||||
|
const int bone = indices[i].values[j];
|
||||||
|
>>>>>>> 57d3d71b6ec68f41a10c1da2f01d096f1308e88c
|
||||||
const float weight = weights[i].values[j];
|
const float weight = weights[i].values[j];
|
||||||
if (weight > 0 && bone >= 0 && bone < map.size()) {
|
if (weight > 0 && bone >= 0 && bone < map.size()) {
|
||||||
map[bone].reserve(8);
|
map[bone].reserve(8);
|
||||||
|
@ -894,7 +900,11 @@ aiNodeAnim* CreateNodeAnim(glTF2::Asset& r, Node& node, AnimationSamplers& sampl
|
||||||
samplers.translation->output->ExtractData(values);
|
samplers.translation->output->ExtractData(values);
|
||||||
anim->mNumPositionKeys = samplers.translation->input->count;
|
anim->mNumPositionKeys = samplers.translation->input->count;
|
||||||
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
|
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
|
||||||
|
<<<<<<< HEAD
|
||||||
for (unsigned int i = 0; i < anim->mNumPositionKeys; ++i) {
|
for (unsigned int i = 0; i < anim->mNumPositionKeys; ++i) {
|
||||||
|
=======
|
||||||
|
for (int i = 0; i < anim->mNumPositionKeys; ++i) {
|
||||||
|
>>>>>>> 57d3d71b6ec68f41a10c1da2f01d096f1308e88c
|
||||||
anim->mPositionKeys[i].mTime = times[i] * kMillisecondsFromSeconds;
|
anim->mPositionKeys[i].mTime = times[i] * kMillisecondsFromSeconds;
|
||||||
anim->mPositionKeys[i].mValue = values[i];
|
anim->mPositionKeys[i].mValue = values[i];
|
||||||
}
|
}
|
||||||
|
@ -916,7 +926,11 @@ aiNodeAnim* CreateNodeAnim(glTF2::Asset& r, Node& node, AnimationSamplers& sampl
|
||||||
samplers.rotation->output->ExtractData(values);
|
samplers.rotation->output->ExtractData(values);
|
||||||
anim->mNumRotationKeys = samplers.rotation->input->count;
|
anim->mNumRotationKeys = samplers.rotation->input->count;
|
||||||
anim->mRotationKeys = new aiQuatKey[anim->mNumRotationKeys];
|
anim->mRotationKeys = new aiQuatKey[anim->mNumRotationKeys];
|
||||||
|
<<<<<<< HEAD
|
||||||
for (unsigned int i = 0; i < anim->mNumRotationKeys; ++i) {
|
for (unsigned int i = 0; i < anim->mNumRotationKeys; ++i) {
|
||||||
|
=======
|
||||||
|
for (int i = 0; i < anim->mNumRotationKeys; ++i) {
|
||||||
|
>>>>>>> 57d3d71b6ec68f41a10c1da2f01d096f1308e88c
|
||||||
anim->mRotationKeys[i].mTime = times[i] * kMillisecondsFromSeconds;
|
anim->mRotationKeys[i].mTime = times[i] * kMillisecondsFromSeconds;
|
||||||
anim->mRotationKeys[i].mValue.x = values[i].w;
|
anim->mRotationKeys[i].mValue.x = values[i].w;
|
||||||
anim->mRotationKeys[i].mValue.y = values[i].x;
|
anim->mRotationKeys[i].mValue.y = values[i].x;
|
||||||
|
@ -942,7 +956,11 @@ aiNodeAnim* CreateNodeAnim(glTF2::Asset& r, Node& node, AnimationSamplers& sampl
|
||||||
samplers.scale->output->ExtractData(values);
|
samplers.scale->output->ExtractData(values);
|
||||||
anim->mNumScalingKeys = samplers.scale->input->count;
|
anim->mNumScalingKeys = samplers.scale->input->count;
|
||||||
anim->mScalingKeys = new aiVectorKey[anim->mNumScalingKeys];
|
anim->mScalingKeys = new aiVectorKey[anim->mNumScalingKeys];
|
||||||
|
<<<<<<< HEAD
|
||||||
for (unsigned int i = 0; i < anim->mNumScalingKeys; ++i) {
|
for (unsigned int i = 0; i < anim->mNumScalingKeys; ++i) {
|
||||||
|
=======
|
||||||
|
for (int i = 0; i < anim->mNumScalingKeys; ++i) {
|
||||||
|
>>>>>>> 57d3d71b6ec68f41a10c1da2f01d096f1308e88c
|
||||||
anim->mScalingKeys[i].mTime = times[i] * kMillisecondsFromSeconds;
|
anim->mScalingKeys[i].mTime = times[i] * kMillisecondsFromSeconds;
|
||||||
anim->mScalingKeys[i].mValue = values[i];
|
anim->mScalingKeys[i].mValue = values[i];
|
||||||
}
|
}
|
||||||
|
@ -965,7 +983,11 @@ std::unordered_map<unsigned int, AnimationSamplers> GatherSamplers(Animation& an
|
||||||
std::unordered_map<unsigned int, AnimationSamplers> samplers;
|
std::unordered_map<unsigned int, AnimationSamplers> samplers;
|
||||||
for (unsigned int c = 0; c < anim.channels.size(); ++c) {
|
for (unsigned int c = 0; c < anim.channels.size(); ++c) {
|
||||||
Animation::Channel& channel = anim.channels[c];
|
Animation::Channel& channel = anim.channels[c];
|
||||||
|
<<<<<<< HEAD
|
||||||
if (channel.sampler >= static_cast<int>(anim.samplers.size())) {
|
if (channel.sampler >= static_cast<int>(anim.samplers.size())) {
|
||||||
|
=======
|
||||||
|
if (channel.sampler >= anim.samplers.size()) {
|
||||||
|
>>>>>>> 57d3d71b6ec68f41a10c1da2f01d096f1308e88c
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue