MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / zLasso_InterpToGuide

Function zLasso_InterpToGuide

src/SB/Game/zLasso.cpp:106–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106void 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
145void zLasso_Render(zLasso* l)
146{

Callers 1

LassoFlyCBFunction · 0.70

Calls 8

xVec3InitFunction · 0.85
xVec3AddToFunction · 0.85
xVec3SMulFunction · 0.85
xVec3SubFunction · 0.85
xVec3CrossFunction · 0.85
xVec3InvFunction · 0.85
xMat4x3ToworldFunction · 0.85
xVec3NormalizeFunction · 0.50

Tested by

no test coverage detected