mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 04:24:47 +02:00
fooling around to get the cluster working
This commit is contained in:
parent
336f16e634
commit
8a1f3648f9
5 changed files with 23 additions and 22 deletions
|
@ -1502,7 +1502,7 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
||||||
hfm::Shape& shape = partShapes[i];
|
hfm::Shape& shape = partShapes[i];
|
||||||
shape.mesh = meshIndex;
|
shape.mesh = meshIndex;
|
||||||
shape.meshPart = i;
|
shape.meshPart = i;
|
||||||
shape.transform = transformIndex;
|
shape.joint = transformIndex;
|
||||||
|
|
||||||
auto matName = mesh.parts[i].materialID;
|
auto matName = mesh.parts[i].materialID;
|
||||||
auto materialIt = materialNameToID.find(matName.toStdString());
|
auto materialIt = materialNameToID.find(matName.toStdString());
|
||||||
|
|
|
@ -314,7 +314,7 @@ public:
|
||||||
uint32_t mesh { UNDEFINED_KEY };
|
uint32_t mesh { UNDEFINED_KEY };
|
||||||
uint32_t meshPart { UNDEFINED_KEY };
|
uint32_t meshPart { UNDEFINED_KEY };
|
||||||
uint32_t material { UNDEFINED_KEY };
|
uint32_t material { UNDEFINED_KEY };
|
||||||
uint32_t transform { UNDEFINED_KEY }; // The hfm::Joint associated with this shape, containing transform information
|
uint32_t joint { UNDEFINED_KEY }; // The hfm::Joint associated with this shape, containing transform information
|
||||||
// TODO: Have all serializers calculate hfm::Shape::transformedExtents in world space where they previously calculated hfm::Mesh::meshExtents. Change all code that uses hfm::Mesh::meshExtents to use this instead.
|
// TODO: Have all serializers calculate hfm::Shape::transformedExtents in world space where they previously calculated hfm::Mesh::meshExtents. Change all code that uses hfm::Mesh::meshExtents to use this instead.
|
||||||
Extents transformedExtents; // The precise extents of the meshPart vertices in world space, after transform information is applied, while not taking into account rigging/skinning
|
Extents transformedExtents; // The precise extents of the meshPart vertices in world space, after transform information is applied, while not taking into account rigging/skinning
|
||||||
uint32_t dynamicTransform { UNDEFINED_KEY };
|
uint32_t dynamicTransform { UNDEFINED_KEY };
|
||||||
|
|
|
@ -33,7 +33,7 @@ bool CauterizedModel::updateGeometry() {
|
||||||
if (_isCauterized && needsFullUpdate) {
|
if (_isCauterized && needsFullUpdate) {
|
||||||
assert(_cauterizeMeshStates.empty());
|
assert(_cauterizeMeshStates.empty());
|
||||||
const HFMModel& hfmModel = getHFMModel();
|
const HFMModel& hfmModel = getHFMModel();
|
||||||
const auto& hfmDynamicTransforms = hfmModel.dynamicTransforms;
|
/* const auto& hfmDynamicTransforms = hfmModel.dynamicTransforms;
|
||||||
for (int i = 0; i < hfmDynamicTransforms.size(); i++) {
|
for (int i = 0; i < hfmDynamicTransforms.size(); i++) {
|
||||||
const auto& dynT = hfmDynamicTransforms[i];
|
const auto& dynT = hfmDynamicTransforms[i];
|
||||||
MeshState state;
|
MeshState state;
|
||||||
|
@ -44,9 +44,8 @@ bool CauterizedModel::updateGeometry() {
|
||||||
}
|
}
|
||||||
_cauterizeMeshStates.append(state);
|
_cauterizeMeshStates.append(state);
|
||||||
_meshStates.push_back(state);
|
_meshStates.push_back(state);
|
||||||
}
|
}*/
|
||||||
|
foreach (const HFMMesh& mesh, hfmModel.meshes) {
|
||||||
/* foreach (const HFMMesh& mesh, hfmModel.meshes) {
|
|
||||||
Model::MeshState state;
|
Model::MeshState state;
|
||||||
if (_useDualQuaternionSkinning) {
|
if (_useDualQuaternionSkinning) {
|
||||||
state.clusterDualQuaternions.resize(mesh.clusters.size());
|
state.clusterDualQuaternions.resize(mesh.clusters.size());
|
||||||
|
@ -55,7 +54,7 @@ bool CauterizedModel::updateGeometry() {
|
||||||
state.clusterMatrices.resize(mesh.clusters.size());
|
state.clusterMatrices.resize(mesh.clusters.size());
|
||||||
_cauterizeMeshStates.append(state);
|
_cauterizeMeshStates.append(state);
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
return needsFullUpdate;
|
return needsFullUpdate;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +67,7 @@ void CauterizedModel::createRenderItemSet() {
|
||||||
// all of our mesh vectors must match in size
|
// all of our mesh vectors must match in size
|
||||||
if (meshes.size() != _meshStates.size()) {
|
if (meshes.size() != _meshStates.size()) {
|
||||||
qCDebug(renderutils) << "WARNING!!!! Mesh Sizes don't match! We will not segregate mesh groups yet.";
|
qCDebug(renderutils) << "WARNING!!!! Mesh Sizes don't match! We will not segregate mesh groups yet.";
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should not have any existing renderItems if we enter this section of code
|
// We should not have any existing renderItems if we enter this section of code
|
||||||
|
@ -241,9 +240,10 @@ void CauterizedModel::updateRenderItems() {
|
||||||
|
|
||||||
const auto& shapeState = self->getShapeState(i);
|
const auto& shapeState = self->getShapeState(i);
|
||||||
|
|
||||||
|
// const auto& meshState = self->getMeshState(meshIndex);
|
||||||
const auto& meshState = self->getMeshState(meshIndex);
|
// const auto& cauterizedMeshState = self->getCauterizeMeshState(meshIndex);
|
||||||
const auto& cauterizedMeshState = self->getCauterizeMeshState(meshIndex);
|
MeshState meshState;
|
||||||
|
MeshState cauterizedMeshState;
|
||||||
|
|
||||||
bool invalidatePayloadShapeKey = self->shouldInvalidatePayloadShapeKey(meshIndex);
|
bool invalidatePayloadShapeKey = self->shouldInvalidatePayloadShapeKey(meshIndex);
|
||||||
bool useDualQuaternionSkinning = self->getUseDualQuaternionSkinning();
|
bool useDualQuaternionSkinning = self->getUseDualQuaternionSkinning();
|
||||||
|
|
|
@ -209,14 +209,14 @@ ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, in
|
||||||
|
|
||||||
auto& modelMesh = model->getNetworkModel()->getMeshes().at(_meshIndex);
|
auto& modelMesh = model->getNetworkModel()->getMeshes().at(_meshIndex);
|
||||||
_meshNumVertices = (int)modelMesh->getNumVertices();
|
_meshNumVertices = (int)modelMesh->getNumVertices();
|
||||||
const Model::MeshState& state = model->getMeshState(_meshIndex);
|
// const Model::MeshState& state = model->getMeshState(_meshIndex);
|
||||||
|
|
||||||
updateMeshPart(modelMesh, partIndex);
|
updateMeshPart(modelMesh, partIndex);
|
||||||
|
|
||||||
if (useDualQuaternionSkinning) {
|
if (useDualQuaternionSkinning) {
|
||||||
computeAdjustedLocalBound(state.clusterDualQuaternions);
|
// computeAdjustedLocalBound(state.clusterDualQuaternions);
|
||||||
} else {
|
} else {
|
||||||
computeAdjustedLocalBound(state.clusterMatrices);
|
// computeAdjustedLocalBound(state.clusterMatrices);
|
||||||
}
|
}
|
||||||
|
|
||||||
Transform renderTransform = transform;
|
Transform renderTransform = transform;
|
||||||
|
|
|
@ -233,7 +233,8 @@ void Model::updateRenderItems() {
|
||||||
auto meshIndex = self->_modelMeshRenderItemShapes[i].meshIndex;
|
auto meshIndex = self->_modelMeshRenderItemShapes[i].meshIndex;
|
||||||
|
|
||||||
const auto& shapeState = self->getShapeState(i);
|
const auto& shapeState = self->getShapeState(i);
|
||||||
const auto& meshState = self->getMeshState(meshIndex);
|
// const auto& meshState = self->getMeshState(meshIndex);
|
||||||
|
MeshState meshState;
|
||||||
|
|
||||||
bool invalidatePayloadShapeKey = self->shouldInvalidatePayloadShapeKey(meshIndex);
|
bool invalidatePayloadShapeKey = self->shouldInvalidatePayloadShapeKey(meshIndex);
|
||||||
bool useDualQuaternionSkinning = self->getUseDualQuaternionSkinning();
|
bool useDualQuaternionSkinning = self->getUseDualQuaternionSkinning();
|
||||||
|
@ -290,9 +291,9 @@ void Model::updateShapeStatesFromRig() {
|
||||||
const auto& shapes = hfmModel.shapes;
|
const auto& shapes = hfmModel.shapes;
|
||||||
_shapeStates.resize(shapes.size());
|
_shapeStates.resize(shapes.size());
|
||||||
for (int s = 0; s < shapes.size(); ++s) {
|
for (int s = 0; s < shapes.size(); ++s) {
|
||||||
uint32_t jointId = shapes[s].transform;
|
uint32_t jointId = shapes[s].joint;
|
||||||
if (jointId < (uint32_t) _rig.getJointStateCount()) {
|
if (jointId < (uint32_t) _rig.getJointStateCount()) {
|
||||||
_shapeStates[s]._rootFromJointTransform = _rig.getJointTransform(shapes[s].transform);
|
_shapeStates[s]._rootFromJointTransform = _rig.getJointTransform(jointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,7 +317,7 @@ bool Model::updateGeometry() {
|
||||||
|
|
||||||
const HFMModel& hfmModel = getHFMModel();
|
const HFMModel& hfmModel = getHFMModel();
|
||||||
const auto& hfmDynamicTransforms = hfmModel.dynamicTransforms;
|
const auto& hfmDynamicTransforms = hfmModel.dynamicTransforms;
|
||||||
/* int i = 0;
|
/* int i = 0;
|
||||||
for (const auto& mesh: hfmModel.meshes) {
|
for (const auto& mesh: hfmModel.meshes) {
|
||||||
MeshState state;
|
MeshState state;
|
||||||
state.clusterDualQuaternions.resize(mesh.clusters.size());
|
state.clusterDualQuaternions.resize(mesh.clusters.size());
|
||||||
|
@ -325,13 +326,13 @@ bool Model::updateGeometry() {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
for (int i = 0; i < hfmDynamicTransforms.size(); i++) {
|
/*for (int i = 0; i < hfmDynamicTransforms.size(); i++) {
|
||||||
const auto& dynT = hfmDynamicTransforms[i];
|
const auto& dynT = hfmDynamicTransforms[i];
|
||||||
MeshState state;
|
MeshState state;
|
||||||
state.clusterDualQuaternions.resize(dynT.clusters.size());
|
state.clusterDualQuaternions.resize(dynT.clusters.size());
|
||||||
state.clusterMatrices.resize(dynT.clusters.size());
|
state.clusterMatrices.resize(dynT.clusters.size());
|
||||||
_meshStates.push_back(state);
|
_meshStates.push_back(state);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
needFullUpdate = true;
|
needFullUpdate = true;
|
||||||
emit rigReady();
|
emit rigReady();
|
||||||
|
@ -1476,7 +1477,7 @@ void Model::createRenderItemSet() {
|
||||||
// all of our mesh vectors must match in size
|
// all of our mesh vectors must match in size
|
||||||
if (meshes.size() != _meshStates.size()) {
|
if (meshes.size() != _meshStates.size()) {
|
||||||
qCDebug(renderutils) << "WARNING!!!! Mesh Sizes don't match! " << meshes.size() << _meshStates.size() << " We will not segregate mesh groups yet.";
|
qCDebug(renderutils) << "WARNING!!!! Mesh Sizes don't match! " << meshes.size() << _meshStates.size() << " We will not segregate mesh groups yet.";
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should not have any existing renderItems if we enter this section of code
|
// We should not have any existing renderItems if we enter this section of code
|
||||||
|
@ -1516,7 +1517,7 @@ void Model::createRenderItemSet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::isRenderable() const {
|
bool Model::isRenderable() const {
|
||||||
return (!_shapeStates.empty() && !_meshStates.empty()) || (isLoaded() && _renderGeometry->getMeshes().empty());
|
return (!_shapeStates.empty() /* && !_meshStates.empty()*/) || (isLoaded() && _renderGeometry->getMeshes().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<unsigned int> Model::getMeshIDsFromMaterialID(QString parentMaterialName) {
|
std::set<unsigned int> Model::getMeshIDsFromMaterialID(QString parentMaterialName) {
|
||||||
|
|
Loading…
Reference in a new issue