| 104 | } |
| 105 | |
| 106 | void zLasso_InterpToGuide(zLasso* lasso) |
| 107 | { |
| 108 | xVec3 rad1; |
| 109 | xVec3 rad2; |
| 110 | |
| 111 | RwV3d* v; |
| 112 | S32 numVerts; |
| 113 | |
| 114 | if (sCurrentGuide != NULL) |
| 115 | { |
| 116 | numVerts = sCurrentGuide->poly->Data->geometry->numTriangles; |
| 117 | v = sCurrentGuide->poly->Data->geometry->morphTarget->verts; |
| 118 | xVec3Init(&lasso->tgCenter, 0.0f, 0.0f, 0.0f); |
| 119 | |
| 120 | S32 vertMapIdx = 0; |
| 121 | for (S32 i = 0; i < numVerts; i++) |
| 122 | { |
| 123 | xVec3AddTo(&lasso->tgCenter, (xVec3*)v + sCurrentGuide->vertMap[vertMapIdx]); |
| 124 | vertMapIdx += 1; |
| 125 | } |
| 126 | |
| 127 | xVec3SMul(&lasso->tgCenter, &lasso->tgCenter, 1.0f / (f32)numVerts); |
| 128 | xVec3Sub(&rad1, (xVec3*)v + sCurrentGuide->vertMap[0], &lasso->tgCenter); |
| 129 | xVec3Sub(&rad2, (xVec3*)v + sCurrentGuide->vertMap[1], &lasso->tgCenter); |
| 130 | |
| 131 | lasso->tgRadius = xVec3Normalize(&rad1, &rad1); |
| 132 | |
| 133 | xVec3Cross(&lasso->tgNormal, &rad1, &rad2); |
| 134 | xVec3Normalize(&lasso->tgNormal, &lasso->tgNormal); |
| 135 | |
| 136 | if (lasso->tgNormal.y < 0.0f) |
| 137 | { |
| 138 | xVec3Inv(&lasso->tgNormal, &lasso->tgNormal); |
| 139 | } |
| 140 | |
| 141 | xMat4x3Toworld(&lasso->tgCenter, (xMat4x3*)sCurrentGuide->poly->Mat, &lasso->tgCenter); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | void zLasso_Render(zLasso* l) |
| 146 | { |
no test coverage detected