History

Fixed rotation polarity and weights are now 16 bit.

Anthony J. Thibault committed 8 years ago

Commit b69edce1 parent 5bb0b065 files · +12 −66Browse files

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

Unified · Split

libraries/render-utils/src/CauterizedModel.cpp+1−49
@@ -113,12 +113,7 @@ void CauterizedModel::updateClusterMatrices() { · 112 unmodified lines
113113 for (int i = 0; i < (int)_meshStates.size(); i++) {
114114 Model::MeshState& state = _meshStates[i];
115115 const FBXMesh& mesh = geometry.meshes.at(i);
116−#if defined(SKIN_DQ)
117− // HACK: FOR DQ go thru reverse order!
118− for (int j = mesh.clusters.size() - 1; j >= 0; j--) {
119−#else
120116 for (int j = 0; j < mesh.clusters.size(); j++) {
121−#endif
122117 const FBXCluster& cluster = mesh.clusters.at(j);
123118
124119 auto jointMatrix = _rig.getJointTransform(cluster.jointIndex);
@@ -132,25 +127,6 @@ void CauterizedModel::updateClusterMatrices() { · 7 unmodified lines
132127 glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, m);
133128 AnimPose p(m);
134129 state.clusterTransforms[j] = Model::TransformDualQuaternion(m);
135−
136− // AJT: HACK n^2!!!! fix me, find parent clusterTransform.
137− int parentIndex = _rig.getJointParentIndex(cluster.jointIndex);
138− int parentClusterIndex = -1;
139− // scan for parent!
140− for (int ii = mesh.clusters.size() - 1; ii > j; ii--) {
141− if (mesh.clusters[ii].jointIndex == parentIndex) {
142− parentClusterIndex = ii;
143− break;
144− }
145− }
146−
147− // ensure that we have the same polarity as our parent!
148− if (parentClusterIndex >= 0) {
149− //if (state.clusterTransforms[parentClusterIndex]._dq.dot(state.clusterTransforms[j]._dq) < 0.0f) {
150− if (glm::dot(state.clusterTransforms[parentClusterIndex]._dq.real(), state.clusterTransforms[j]._dq.real()) < 0.0f) {
151− state.clusterTransforms[j]._dq = -state.clusterTransforms[j]._dq;
152− }
153− }
154130 #else
155131 glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, state.clusterTransforms[j]);
156132 #endif
@@ -171,12 +147,7 @@ void CauterizedModel::updateClusterMatrices() { · 14 unmodified lines
171147 Model::MeshState& state = _cauterizeMeshStates[i];
172148 const FBXMesh& mesh = geometry.meshes.at(i);
173149
174−#if defined(SKIN_DQ)
175− // HACK: FOR DQ go thru reverse order!
176− for (int j = mesh.clusters.size() - 1; j >= 0; j--) {
177−#else
178− for (int j = 0; j < mesh.clusters.size(); j++) {
179−#endif
150+ for (int j = 0; j < mesh.clusters.size(); j++) {
180151 const FBXCluster& cluster = mesh.clusters.at(j);
181152
182153 auto jointMatrix = _rig.getJointTransform(cluster.jointIndex);
@@ -194,25 +165,6 @@ void CauterizedModel::updateClusterMatrices() { · 11 unmodified lines
194165 glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, m);
195166 AnimPose p(m);
196167 state.clusterTransforms[j] = Model::TransformDualQuaternion(m);
197−
198− // AJT: HACK n^2!!!! fix me, find parent clusterTransform.
199− int parentIndex = _rig.getJointParentIndex(cluster.jointIndex);
200− int parentClusterIndex = -1;
201− // scan for parent!
202− for (int ii = mesh.clusters.size() - 1; ii > j; ii--) {
203− if (mesh.clusters[ii].jointIndex == parentIndex) {
204− parentClusterIndex = ii;
205− break;
206− }
207− }
208−
209− // ensure that we have the same polarity as our parent!
210− if (parentClusterIndex >= 0) {
211− //if (state.clusterTransforms[parentClusterIndex]._dq.dot(state.clusterTransforms[j]._dq) < 0.0f) {
212− if (glm::dot(state.clusterTransforms[parentClusterIndex]._dq.real(), state.clusterTransforms[j]._dq.real()) < 0.0f) {
213− state.clusterTransforms[j]._dq = -state.clusterTransforms[j]._dq;
214− }
215− }
216168 #else
217169 glm_mat4u_mul(jointMatrix, cluster.inverseBindMatrix, state.clusterTransforms[j]);
218170 #endif

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