Commit 5b075674 authored by Michael Migliore's avatar Michael Migliore
Browse files

Fix glTF morphing and static skinning

parent 9f94c2e7
Pipeline #226216 running with stage
......@@ -498,6 +498,8 @@ void vtkGLTFImporter::ImportActors(vtkRenderer* renderer)
nodeIdStack.push(childNodeId);
}
}
this->ApplySkinningMorphing();
}
//------------------------------------------------------------------------------
......@@ -671,8 +673,13 @@ void vtkGLTFImporter::UpdateTimeStep(double timestep)
this->ImportCameras(this->Renderer);
auto model = this->Loader->GetInternalModel();
this->ApplySkinningMorphing();
}
//----------------------------------------------------------------------------
void vtkGLTFImporter::ApplySkinningMorphing()
{
const auto& model = this->Loader->GetInternalModel();
int scene = model->DefaultScene;
// List of nodes to import
......@@ -730,6 +737,15 @@ void vtkGLTFImporter::UpdateTimeStep(double timestep)
size_t nbWeights = vtkMath::Min<size_t>(node.Weights.size(), 4);
uniforms->SetUniform1fv("morphWeights", static_cast<int>(nbWeights), node.Weights.data());
}
else
{
vtkGLTFDocumentLoader::Mesh& mesh = model->Meshes[node.Mesh];
if (!mesh.Weights.empty())
{
size_t nbWeights = vtkMath::Min<size_t>(mesh.Weights.size(), 4);
uniforms->SetUniform1fv("morphWeights", static_cast<int>(nbWeights), mesh.Weights.data());
}
}
}
// Add node's children to stack
......
......@@ -155,6 +155,8 @@ protected:
void ImportCameras(vtkRenderer* renderer) override;
void ImportLights(vtkRenderer* renderer) override;
void ApplySkinningMorphing();
char* FileName = nullptr;
std::map<int, vtkSmartPointer<vtkCamera>> Cameras;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment