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

Function xMovePointSplineSetup

src/SB/Core/x/xMovePoint.cpp:72–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void xMovePointSplineSetup(xMovePoint* m)
73{
74 xMovePoint *w0, *w1, *w2, *w3;
75 xVec3 points[2];
76 xVec3 p1, p2;
77
78 if (m->asset->bezIndex != 1)
79 return;
80 if (m->spl)
81 return;
82
83 w0 = m->prev;
84 w1 = m;
85 w2 = m->nodes[0];
86
87 points[0] = *w0->pos;
88 if (w2->asset->bezIndex > 0)
89 {
90 w3 = w2->nodes[0];
91 p1 = *w1->pos;
92 p2 = *w2->pos;
93 points[1] = *w3->pos;
94 }
95 else
96 {
97 p1.x = (1 / 3.f) * w0->pos->x + (2 / 3.f) * w1->pos->x;
98 p1.y = (1 / 3.f) * w0->pos->y + (2 / 3.f) * w1->pos->y;
99 p1.z = (1 / 3.f) * w0->pos->z + (2 / 3.f) * w1->pos->z;
100 p2.x = (2 / 3.f) * w1->pos->x + (1 / 3.f) * w2->pos->x;
101 p2.y = (2 / 3.f) * w1->pos->y + (1 / 3.f) * w2->pos->y;
102 p2.z = (2 / 3.f) * w1->pos->z + (1 / 3.f) * w2->pos->z;
103 points[1] = *w2->pos;
104 }
105
106 m->spl = xSpline3_Bezier(points, NULL, 2, 0, &p1, &p2);
107 xSpline3_ArcInit(m->spl, 20);
108}
109
110F32 xMovePointGetNext(const xMovePoint* m, const xMovePoint* prev, xMovePoint** next, xVec3* hdng)
111{

Callers 1

zSceneSetupFunction · 0.50

Calls 2

xSpline3_BezierFunction · 0.70
xSpline3_ArcInitFunction · 0.70

Tested by

no test coverage detected