History

Sprinkle locks everywhere.

Howard Stearns committed 11 years ago

Commit 475331a1 parent 0e183958 files · +45 −4Browse files

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

Unified · Split

libraries/render-utils/src/Model.cpp+18−4
@@ -1285,7 +1285,9 @@ void Model::simulateInternal(float deltaTime) { · 1284 unmodified lines
12851285 const FBXGeometry& geometry = _geometry->getFBXGeometry();
12861286 glm::mat4 parentTransform = glm::scale(_scale) * glm::translate(_offset) * geometry.offset;
12871287 updateRig(deltaTime, parentTransform);
1288−
1288+}
1289+void Model::updateClusterMatrices() {
1290+ const FBXGeometry& geometry = _geometry->getFBXGeometry();
12891291 glm::mat4 zeroScale(glm::vec4(0.0f, 0.0f, 0.0f, 0.0f),
12901292 glm::vec4(0.0f, 0.0f, 0.0f, 0.0f),
12911293 glm::vec4(0.0f, 0.0f, 0.0f, 0.0f),
@@ -1419,15 +1421,17 @@ AABox Model::getPartBounds(int meshIndex, int partIndex) { · 127 unmodified lines
14191421 return AABox();
14201422 }
14211423
1424+ avatarLockForWriteIfApplicable();
14221425 if (meshIndex < _meshStates.size()) {
14231426 const MeshState& state = _meshStates.at(meshIndex);
14241427 bool isSkinned = state.clusterMatrices.size() > 1;
14251428 if (isSkinned) {
14261429 // if we're skinned return the entire mesh extents because we can't know for sure our clusters don't move us
1427− return calculateScaledOffsetAABox(_geometry->getFBXGeometry().meshExtents);
1430+ AABox box = calculateScaledOffsetAABox(_geometry->getFBXGeometry().meshExtents);
1431+ avatarLockReleaseIfApplicable();
1432+ return box;
14281433 }
14291434 }
1430−
14311435 if (_geometry->getFBXGeometry().meshes.size() > meshIndex) {
14321436
14331437 // FIX ME! - This is currently a hack because for some mesh parts our efforts to calculate the bounding
@@ -1443,8 +1447,11 @@ AABox Model::getPartBounds(int meshIndex, int partIndex) { · 9 unmodified lines
14431447 //
14441448 // If we not skinned use the bounds of the subMesh for all it's parts
14451449 const FBXMesh& mesh = _geometry->getFBXGeometry().meshes.at(meshIndex);
1446− return calculateScaledOffsetExtents(mesh.meshExtents);
1450+ AABox box = calculateScaledOffsetExtents(mesh.meshExtents);
1451+ avatarLockReleaseIfApplicable();
1452+ return box;
14471453 }
1454+ avatarLockReleaseIfApplicable();
14481455 return AABox();
14491456 }
14501457
@@ -1482,6 +1489,9 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 31 unmodified lines
14821489 return;
14831490 }
14841491
1492+ avatarLockForWriteIfApplicable();
1493+ updateClusterMatrices();
1494+
14851495 const NetworkMesh& networkMesh = *(networkMeshes.at(meshIndex).get());
14861496 const FBXMesh& mesh = geometry.meshes.at(meshIndex);
14871497 const MeshState& state = _meshStates.at(meshIndex);
@@ -1536,6 +1546,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 48 unmodified lines
15361546 _meshGroupsKnown = false; // regenerate these lists next time around.
15371547 _readyWhenAdded = false; // in case any of our users are using scenes
15381548 invalidCalculatedMeshBoxes(); // if we have to reload, we need to assume our mesh boxes are all invalid
1549+ avatarLockReleaseIfApplicable();
15391550 return; // FIXME!
15401551 }
15411552
@@ -1543,6 +1554,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 1 unmodified line
15431554 int vertexCount = mesh.vertices.size();
15441555 if (vertexCount == 0) {
15451556 // sanity check
1557+ avatarLockReleaseIfApplicable();
15461558 return; // FIXME!
15471559 }
15481560
@@ -1587,6 +1599,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 38 unmodified lines
15871599
15881600 // guard against partially loaded meshes
15891601 if (partIndex >= (int)networkMesh._parts.size() || partIndex >= mesh.parts.size()) {
1602+ avatarLockReleaseIfApplicable();
15901603 return;
15911604 }
15921605
@@ -1703,6 +1716,7 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, bool tran · 110 unmodified lines
17031716 args->_details._trianglesRendered += part.triangleIndices.size() / INDICES_PER_TRIANGLE;
17041717 args->_details._quadsRendered += part.quadIndices.size() / INDICES_PER_QUAD;
17051718 }
1719+ avatarLockReleaseIfApplicable();
17061720 }
17071721
17081722 void Model::segregateMeshGroups() {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t