mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 03:53:34 +02:00
As a temporary hack, render the mesh with the most blendshapes with the head
color (other meshes white).
This commit is contained in:
parent
fd41a075ed
commit
1b9444cb39
2 changed files with 17 additions and 6 deletions
|
@ -48,6 +48,8 @@ bool BlendFace::render(float alpha) {
|
|||
// enable normalization under the expectation that the GPU can do it faster
|
||||
glEnable(GL_NORMALIZE);
|
||||
|
||||
glColor4f(_owningHead->getSkinColor().r, _owningHead->getSkinColor().g, _owningHead->getSkinColor().b, alpha);
|
||||
|
||||
for (int i = 0; i < _meshIDs.size(); i++) {
|
||||
const VerticesIndices& ids = _meshIDs.at(i);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ids.first);
|
||||
|
@ -56,12 +58,12 @@ bool BlendFace::render(float alpha) {
|
|||
const FBXMesh& mesh = _geometry.meshes.at(i);
|
||||
int vertexCount = mesh.vertices.size();
|
||||
|
||||
if (mesh.blendshapes.isEmpty()) {
|
||||
// all meshes after the first are white
|
||||
if (i == 1) {
|
||||
glColor4f(1.0f, 1.0f, 1.0f, alpha);
|
||||
|
||||
} else {
|
||||
glColor4f(_owningHead->getSkinColor().r, _owningHead->getSkinColor().g, _owningHead->getSkinColor().b, alpha);
|
||||
|
||||
}
|
||||
|
||||
if (!mesh.blendshapes.isEmpty()) {
|
||||
_blendedVertices.resize(max(_blendedVertices.size(), vertexCount));
|
||||
_blendedNormals.resize(_blendedVertices.size());
|
||||
memcpy(_blendedVertices.data(), mesh.vertices.constData(), vertexCount * sizeof(glm::vec3));
|
||||
|
|
|
@ -376,9 +376,18 @@ FBXGeometry extractFBXGeometry(const FBXNode& node) {
|
|||
mesh.blendshapes[extracted.index] = extracted.blendshape;
|
||||
}
|
||||
|
||||
// as a temporary hack, put the mesh with the most blendshapes on top; assume it to be the face
|
||||
FBXGeometry geometry;
|
||||
int mostBlendshapes = 0;
|
||||
int mostBlendshapesIndex = 0;
|
||||
foreach (const FBXMesh& mesh, meshes) {
|
||||
geometry.meshes.append(mesh);
|
||||
if (mesh.blendshapes.size() > mostBlendshapes) {
|
||||
geometry.meshes.prepend(mesh);
|
||||
mostBlendshapes = mesh.blendshapes.size();
|
||||
|
||||
} else {
|
||||
geometry.meshes.append(mesh);
|
||||
}
|
||||
}
|
||||
|
||||
return geometry;
|
||||
|
|
Loading…
Reference in a new issue