History

Re-name FBXGeometry to HFMGeometry and do the same for related classes

sabrina-shanman committed 8 years ago

Commit becee7f1 parent e01401252 files · +578 −578Browse files

Showing the changes to libraries/render-utils/src/Model.cpp (1 of 52 files). Show all

Unified · Split

libraries/render-utils/src/Model.cpp+38−38
@@ -183,7 +183,7 @@ bool Model::shouldInvalidatePayloadShapeKey(int meshIndex) { · 182 unmodified lines
183183 return true;
184184 }
185185
186− const FBXGeometry& geometry = getFBXGeometry();
186+ const HFMGeometry& geometry = getHFMGeometry();
187187 const auto& networkMeshes = getGeometry()->getMeshes();
188188 // if our index is ever out of range for either meshes or networkMeshes, then skip it, and set our _meshGroupsKnown
189189 // to false to rebuild out mesh groups.
@@ -278,7 +278,7 @@ void Model::setRenderItemsNeedUpdate() { · 88 unmodified lines
278278
279279 void Model::reset() {
280280 if (isLoaded()) {
281− const FBXGeometry& geometry = getFBXGeometry();
281+ const HFMGeometry& geometry = getHFMGeometry();
282282 _rig.reset(geometry);
283283 emit rigReset();
284284 emit rigReady();
@@ -295,13 +295,13 @@ bool Model::updateGeometry() { · 10 unmodified lines
295295 _needsReload = false;
296296
297297 // TODO: should all Models have a valid _rig?
298− if (_rig.jointStatesEmpty() && getFBXGeometry().joints.size() > 0) {
298+ if (_rig.jointStatesEmpty() && getHFMGeometry().joints.size() > 0) {
299299 initJointStates();
300300 assert(_meshStates.empty());
301301
302− const FBXGeometry& fbxGeometry = getFBXGeometry();
302+ const HFMGeometry& hfmGeometry = getHFMGeometry();
303303 int i = 0;
304− foreach (const FBXMesh& mesh, fbxGeometry.meshes) {
304+ foreach (const HFMMesh& mesh, hfmGeometry.meshes) {
305305 MeshState state;
306306 state.clusterDualQuaternions.resize(mesh.clusters.size());
307307 state.clusterMatrices.resize(mesh.clusters.size());
@@ -319,7 +319,7 @@ bool Model::updateGeometry() { · 11 unmodified lines
319319
320320 // virtual
321321 void Model::initJointStates() {
322− const FBXGeometry& geometry = getFBXGeometry();
322+ const HFMGeometry& geometry = getHFMGeometry();
323323 glm::mat4 modelOffset = glm::scale(_scale) * glm::translate(_offset);
324324
325325 _rig.initJointStates(geometry, modelOffset);
@@ -363,7 +363,7 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g · 37 unmodified lines
363363 int bestShapeID = 0;
364364 int bestSubMeshIndex = 0;
365365
366− const FBXGeometry& geometry = getFBXGeometry();
366+ const HFMGeometry& geometry = getHFMGeometry();
367367 if (!_triangleSetsValid) {
368368 calculateTriangleSets(geometry);
369369 }
@@ -506,7 +506,7 @@ bool Model::findParabolaIntersectionAgainstSubMeshes(const glm::vec3& origin, co · 136 unmodified lines
506506 int bestShapeID = 0;
507507 int bestSubMeshIndex = 0;
508508
509− const FBXGeometry& geometry = getFBXGeometry();
509+ const HFMGeometry& geometry = getHFMGeometry();
510510 if (!_triangleSetsValid) {
511511 calculateTriangleSets(geometry);
512512 }
@@ -641,7 +641,7 @@ bool Model::convexHullContains(glm::vec3 point) { · 128 unmodified lines
641641 QMutexLocker locker(&_mutex);
642642
643643 if (!_triangleSetsValid) {
644− calculateTriangleSets(getFBXGeometry());
644+ calculateTriangleSets(getHFMGeometry());
645645 }
646646
647647 // If we are inside the models box, then consider the submeshes...
@@ -753,14 +753,14 @@ bool Model::replaceScriptableModelMeshPart(scriptable::ScriptableModelBasePointe · 105 unmodified lines
753753 }
754754 // update triangles for picking
755755 {
756− FBXGeometry geometry;
756+ HFMGeometry geometry;
757757 for (const auto& newMesh : meshes) {
758− FBXMesh mesh;
758+ HFMMesh mesh;
759759 mesh._mesh = newMesh.getMeshPointer();
760760 mesh.vertices = buffer_helpers::mesh::attributeToVector<glm::vec3>(mesh._mesh, gpu::Stream::POSITION);
761761 int numParts = (int)newMesh.getMeshPointer()->getNumParts();
762762 for (int partID = 0; partID < numParts; partID++) {
763− FBXMeshPart part;
763+ HFMMeshPart part;
764764 part.triangleIndices = buffer_helpers::bufferToVector<int>(mesh._mesh->getIndexBuffer(), "part.triangleIndices");
765765 mesh.parts << part;
766766 }
@@ -789,12 +789,12 @@ scriptable::ScriptableModelBase Model::getScriptableModel() { · 22 unmodified lines
789789 return result;
790790 }
791791
792− const FBXGeometry& geometry = getFBXGeometry();
792+ const HFMGeometry& geometry = getHFMGeometry();
793793 int numberOfMeshes = geometry.meshes.size();
794794 int shapeID = 0;
795795 for (int i = 0; i < numberOfMeshes; i++) {
796− const FBXMesh& fbxMesh = geometry.meshes.at(i);
797− if (auto mesh = fbxMesh._mesh) {
796+ const HFMMesh& hfmMesh = geometry.meshes.at(i);
797+ if (auto mesh = hfmMesh._mesh) {
798798 result.append(mesh);
799799
800800 int numParts = (int)mesh->getNumParts();
@@ -808,7 +808,7 @@ scriptable::ScriptableModelBase Model::getScriptableModel() { · 7 unmodified lines
808808 return result;
809809 }
810810
811−void Model::calculateTriangleSets(const FBXGeometry& geometry) {
811+void Model::calculateTriangleSets(const HFMGeometry& geometry) {
812812 PROFILE_RANGE(render, __FUNCTION__);
813813
814814 int numberOfMeshes = geometry.meshes.size();
@@ -818,14 +818,14 @@ void Model::calculateTriangleSets(const FBXGeometry& geometry) { · 3 unmodified lines
818818 _modelSpaceMeshTriangleSets.resize(numberOfMeshes);
819819
820820 for (int i = 0; i < numberOfMeshes; i++) {
821− const FBXMesh& mesh = geometry.meshes.at(i);
821+ const HFMMesh& mesh = geometry.meshes.at(i);
822822
823823 const int numberOfParts = mesh.parts.size();
824824 auto& meshTriangleSets = _modelSpaceMeshTriangleSets[i];
825825 meshTriangleSets.resize(numberOfParts);
826826
827827 for (int j = 0; j < numberOfParts; j++) {
828− const FBXMeshPart& part = mesh.parts.at(j);
828+ const HFMMeshPart& part = mesh.parts.at(j);
829829
830830 auto& partTriangleSet = meshTriangleSets[j];
831831
@@ -1114,7 +1114,7 @@ Extents Model::getBindExtents() const { · 282 unmodified lines
11141114 if (!isActive()) {
11151115 return Extents();
11161116 }
1117− const Extents& bindExtents = getFBXGeometry().bindExtents;
1117+ const Extents& bindExtents = getHFMGeometry().bindExtents;
11181118 Extents scaledExtents = { bindExtents.minimum * _scale, bindExtents.maximum * _scale };
11191119 return scaledExtents;
11201120 }
@@ -1128,12 +1128,12 @@ Extents Model::getMeshExtents() const { · 7 unmodified lines
11281128 if (!isActive()) {
11291129 return Extents();
11301130 }
1131− const Extents& extents = getFBXGeometry().meshExtents;
1131+ const Extents& extents = getHFMGeometry().meshExtents;
11321132
11331133 // even though our caller asked for "unscaled" we need to include any fst scaling, translation, and rotation, which
11341134 // is captured in the offset matrix
1135− glm::vec3 minimum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.minimum, 1.0f));
1136− glm::vec3 maximum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.maximum, 1.0f));
1135+ glm::vec3 minimum = glm::vec3(getHFMGeometry().offset * glm::vec4(extents.minimum, 1.0f));
1136+ glm::vec3 maximum = glm::vec3(getHFMGeometry().offset * glm::vec4(extents.maximum, 1.0f));
11371137 Extents scaledExtents = { minimum * _scale, maximum * _scale };
11381138 return scaledExtents;
11391139 }
@@ -1143,12 +1143,12 @@ Extents Model::getUnscaledMeshExtents() const { · 3 unmodified lines
11431143 return Extents();
11441144 }
11451145
1146− const Extents& extents = getFBXGeometry().meshExtents;
1146+ const Extents& extents = getHFMGeometry().meshExtents;
11471147
11481148 // even though our caller asked for "unscaled" we need to include any fst scaling, translation, and rotation, which
11491149 // is captured in the offset matrix
1150− glm::vec3 minimum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.minimum, 1.0f));
1151− glm::vec3 maximum = glm::vec3(getFBXGeometry().offset * glm::vec4(extents.maximum, 1.0f));
1150+ glm::vec3 minimum = glm::vec3(getHFMGeometry().offset * glm::vec4(extents.minimum, 1.0f));
1151+ glm::vec3 maximum = glm::vec3(getHFMGeometry().offset * glm::vec4(extents.maximum, 1.0f));
11521152 Extents scaledExtents = { minimum, maximum };
11531153
11541154 return scaledExtents;
@@ -1171,11 +1171,11 @@ void Model::setJointTranslation(int index, bool valid, const glm::vec3& translat · 16 unmodified lines
11711171 }
11721172
11731173 int Model::getParentJointIndex(int jointIndex) const {
1174− return (isActive() && jointIndex != -1) ? getFBXGeometry().joints.at(jointIndex).parentIndex : -1;
1174+ return (isActive() && jointIndex != -1) ? getHFMGeometry().joints.at(jointIndex).parentIndex : -1;
11751175 }
11761176
11771177 int Model::getLastFreeJointIndex(int jointIndex) const {
1178− return (isActive() && jointIndex != -1) ? getFBXGeometry().joints.at(jointIndex).freeLineage.last() : -1;
1178+ return (isActive() && jointIndex != -1) ? getHFMGeometry().joints.at(jointIndex).freeLineage.last() : -1;
11791179 }
11801180
11811181 void Model::setTextures(const QVariantMap& textures) {
@@ -1275,7 +1275,7 @@ QStringList Model::getJointNames() const { · 93 unmodified lines
12751275 Q_RETURN_ARG(QStringList, result));
12761276 return result;
12771277 }
1278− return isActive() ? getFBXGeometry().getJointNames() : QStringList();
1278+ return isActive() ? getHFMGeometry().getJointNames() : QStringList();
12791279 }
12801280
12811281 void Model::setScaleToFit(bool scaleToFit, const glm::vec3& dimensions, bool forceRescale) {
@@ -1415,12 +1415,12 @@ void Model::updateClusterMatrices() { · 133 unmodified lines
14151415 }
14161416
14171417 _needsUpdateClusterMatrices = false;
1418− const FBXGeometry& geometry = getFBXGeometry();
1418+ const HFMGeometry& geometry = getHFMGeometry();
14191419 for (int i = 0; i < (int) _meshStates.size(); i++) {
14201420 MeshState& state = _meshStates[i];
1421− const FBXMesh& mesh = geometry.meshes.at(i);
1421+ const HFMMesh& mesh = geometry.meshes.at(i);
14221422 for (int j = 0; j < mesh.clusters.size(); j++) {
1423− const FBXCluster& cluster = mesh.clusters.at(j);
1423+ const HFMCluster& cluster = mesh.clusters.at(j);
14241424 if (_useDualQuaternionSkinning) {
14251425 auto jointPose = _rig.getJointPose(cluster.jointIndex);
14261426 Transform jointTransform(jointPose.rot(), jointPose.scale(), jointPose.trans());
@@ -1505,7 +1505,7 @@ void Model::createRenderItemSet() { · 78 unmodified lines
15051505 // Run through all of the meshes, and place them into their segregated, but unsorted buckets
15061506 int shapeID = 0;
15071507 uint32_t numMeshes = (uint32_t)meshes.size();
1508− auto& fbxGeometry = getFBXGeometry();
1508+ auto& hfmGeometry = getHFMGeometry();
15091509 for (uint32_t i = 0; i < numMeshes; i++) {
15101510 const auto& mesh = meshes.at(i);
15111511 if (!mesh) {
@@ -1515,7 +1515,7 @@ void Model::createRenderItemSet() { · 3 unmodified lines
15151515 // Create the render payloads
15161516 int numParts = (int)mesh->getNumParts();
15171517 for (int partIndex = 0; partIndex < numParts; partIndex++) {
1518− initializeBlendshapes(fbxGeometry.meshes[i], i);
1518+ initializeBlendshapes(hfmGeometry.meshes[i], i);
15191519 _modelMeshRenderItems << std::make_shared<ModelMeshPartPayload>(shared_from_this(), i, partIndex, shapeID, transform, offset);
15201520 auto material = getGeometry()->getShapeMaterial(shapeID);
15211521 _modelMeshMaterialNames.push_back(material ? material->getName() : "");
@@ -1600,7 +1600,7 @@ void Model::removeMaterial(graphics::MaterialPointer material, const std::string · 78 unmodified lines
16001600 class CollisionRenderGeometry : public Geometry {
16011601 public:
16021602 CollisionRenderGeometry(graphics::MeshPointer mesh) {
1603− _fbxGeometry = std::make_shared<FBXGeometry>();
1603+ _hfmGeometry = std::make_shared<HFMGeometry>();
16041604 std::shared_ptr<GeometryMeshes> meshes = std::make_shared<GeometryMeshes>();
16051605 meshes->push_back(mesh);
16061606 _meshes = meshes;
@@ -1656,9 +1656,9 @@ void Blender::run() { · 49 unmodified lines
16561656 if (_model && _model->isLoaded()) {
16571657 DETAILED_PROFILE_RANGE_EX(simulation_animation, __FUNCTION__, 0xFFFF0000, 0, { { "url", _model->getURL().toString() } });
16581658 int offset = 0;
1659− auto meshes = _model->getFBXGeometry().meshes;
1659+ auto meshes = _model->getHFMGeometry().meshes;
16601660 int meshIndex = 0;
1661− foreach(const FBXMesh& mesh, meshes) {
1661+ foreach(const HFMMesh& mesh, meshes) {
16621662 auto modelMeshBlendshapeOffsets = _model->_blendshapeOffsets.find(meshIndex++);
16631663 if (mesh.blendshapes.isEmpty() || modelMeshBlendshapeOffsets == _model->_blendshapeOffsets.end()) {
16641664 // Not blendshaped or not initialized
@@ -1688,7 +1688,7 @@ void Blender::run() { · 23 unmodified lines
16881688 }
16891689
16901690 float normalCoefficient = vertexCoefficient * NORMAL_COEFFICIENT_SCALE;
1691− const FBXBlendshape& blendshape = mesh.blendshapes.at(i);
1691+ const HFMBlendshape& blendshape = mesh.blendshapes.at(i);
16921692
16931693 tbb::parallel_for(tbb::blocked_range<int>(0, blendshape.indices.size()), [&](const tbb::blocked_range<int>& range) {
16941694 for (auto j = range.begin(); j < range.end(); j++) {
@@ -1731,7 +1731,7 @@ bool Model::maybeStartBlender() { · 36 unmodified lines
17311731 return false;
17321732 }
17331733
1734−void Model::initializeBlendshapes(const FBXMesh& mesh, int index) {
1734+void Model::initializeBlendshapes(const HFMMesh& mesh, int index) {
17351735 if (mesh.blendshapes.empty()) {
17361736 // mesh doesn't have blendshape, did we allocate one though ?
17371737 if (_blendshapeOffsets.find(index) != _blendshapeOffsets.end()) {