mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-14 11:46:56 +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];
|
||||
shape.mesh = meshIndex;
|
||||
shape.meshPart = i;
|
||||
shape.transform = transformIndex;
|
||||
shape.joint = transformIndex;
|
||||
|
||||
auto matName = mesh.parts[i].materialID;
|
||||
auto materialIt = materialNameToID.find(matName.toStdString());
|
||||
|
|
|
@ -314,7 +314,7 @@ public:
|
|||
uint32_t mesh { UNDEFINED_KEY };
|
||||
uint32_t meshPart { 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.
|
||||
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 };
|
||||
|
|
|
@ -33,7 +33,7 @@ bool CauterizedModel::updateGeometry() {
|
|||
if (_isCauterized && needsFullUpdate) {
|
||||
assert(_cauterizeMeshStates.empty());
|
||||
const HFMModel& hfmModel = getHFMModel();
|
||||
const auto& hfmDynamicTransforms = hfmModel.dynamicTransforms;
|
||||
/* const auto& hfmDynamicTransforms = hfmModel.dynamicTransforms;
|
||||
for (int i = 0; i < hfmDynamicTransforms.size(); i++) {
|
||||
const auto& dynT = hfmDynamicTransforms[i];
|
||||
MeshState state;
|
||||
|
@ -44,9 +44,8 @@ bool CauterizedModel::updateGeometry() {
|
|||
}
|
||||
_cauterizeMeshStates.append(state);
|
||||
_meshStates.push_back(state);
|
||||
}
|
||||
|
||||
/* foreach (const HFMMesh& mesh, hfmModel.meshes) {
|
||||
}*/
|
||||
foreach (const HFMMesh& mesh, hfmModel.meshes) {
|
||||
Model::MeshState state;
|
||||
if (_useDualQuaternionSkinning) {
|
||||
state.clusterDualQuaternions.resize(mesh.clusters.size());
|
||||
|
@ -55,7 +54,7 @@ bool CauterizedModel::updateGeometry() {
|
|||
state.clusterMatrices.resize(mesh.clusters.size());
|
||||
_cauterizeMeshStates.append(state);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
return needsFullUpdate;
|
||||
}
|
||||
|
@ -68,7 +67,7 @@ void CauterizedModel::createRenderItemSet() {
|
|||
// all of our mesh vectors must match in size
|
||||
if (meshes.size() != _meshStates.size()) {
|
||||
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
|
||||
|
@ -241,9 +240,10 @@ void CauterizedModel::updateRenderItems() {
|
|||
|
||||
const auto& shapeState = self->getShapeState(i);
|
||||
|
||||
|
||||
const auto& meshState = self->getMeshState(meshIndex);
|
||||
const auto& cauterizedMeshState = self->getCauterizeMeshState(meshIndex);
|
||||
// const auto& meshState = self->getMeshState(meshIndex);
|
||||
// const auto& cauterizedMeshState = self->getCauterizeMeshState(meshIndex);
|
||||
MeshState meshState;
|
||||
MeshState cauterizedMeshState;
|
||||
|
||||
bool invalidatePayloadShapeKey = self->shouldInvalidatePayloadShapeKey(meshIndex);
|
||||
bool useDualQuaternionSkinning = self->getUseDualQuaternionSkinning();
|
||||
|
|
|
@ -209,14 +209,14 @@ ModelMeshPartPayload::ModelMeshPartPayload(ModelPointer model, int meshIndex, in
|
|||
|
||||
auto& modelMesh = model->getNetworkModel()->getMeshes().at(_meshIndex);
|
||||
_meshNumVertices = (int)modelMesh->getNumVertices();
|
||||
const Model::MeshState& state = model->getMeshState(_meshIndex);
|
||||
// const Model::MeshState& state = model->getMeshState(_meshIndex);
|
||||
|
||||
updateMeshPart(modelMesh, partIndex);
|
||||
|
||||
if (useDualQuaternionSkinning) {
|
||||
computeAdjustedLocalBound(state.clusterDualQuaternions);
|
||||
// computeAdjustedLocalBound(state.clusterDualQuaternions);
|
||||
} else {
|
||||
computeAdjustedLocalBound(state.clusterMatrices);
|
||||
// computeAdjustedLocalBound(state.clusterMatrices);
|
||||
}
|
||||
|
||||
Transform renderTransform = transform;
|
||||
|
|
|
@ -233,7 +233,8 @@ void Model::updateRenderItems() {
|
|||
auto meshIndex = self->_modelMeshRenderItemShapes[i].meshIndex;
|
||||
|
||||
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 useDualQuaternionSkinning = self->getUseDualQuaternionSkinning();
|
||||
|
@ -290,9 +291,9 @@ void Model::updateShapeStatesFromRig() {
|
|||
const auto& shapes = hfmModel.shapes;
|
||||
_shapeStates.resize(shapes.size());
|
||||
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()) {
|
||||
_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 auto& hfmDynamicTransforms = hfmModel.dynamicTransforms;
|
||||
/* int i = 0;
|
||||
/* int i = 0;
|
||||
for (const auto& mesh: hfmModel.meshes) {
|
||||
MeshState state;
|
||||
state.clusterDualQuaternions.resize(mesh.clusters.size());
|
||||
|
@ -325,13 +326,13 @@ bool Model::updateGeometry() {
|
|||
i++;
|
||||
}
|
||||
*/
|
||||
for (int i = 0; i < hfmDynamicTransforms.size(); i++) {
|
||||
/*for (int i = 0; i < hfmDynamicTransforms.size(); i++) {
|
||||
const auto& dynT = hfmDynamicTransforms[i];
|
||||
MeshState state;
|
||||
state.clusterDualQuaternions.resize(dynT.clusters.size());
|
||||
state.clusterMatrices.resize(dynT.clusters.size());
|
||||
_meshStates.push_back(state);
|
||||
}
|
||||
}*/
|
||||
|
||||
needFullUpdate = true;
|
||||
emit rigReady();
|
||||
|
@ -1476,7 +1477,7 @@ void Model::createRenderItemSet() {
|
|||
// all of our mesh vectors must match in 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.";
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
// 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 {
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue