Esempio n. 1
0
void idSplineList::buildSpline()
{
	//int start = Sys_Milliseconds();
	clearSpline();

	for(int i = 3; i < controlPoints.Num(); i++)
	{
		for(float tension = 0.0f; tension < 1.001f; tension += granularity)
		{
			float x = 0;
			float y = 0;
			float z = 0;

			for(int j = 0; j < 4; j++)
			{
				x += controlPoints[i - (3 - j)]->x * calcSpline(j, tension);
				y += controlPoints[i - (3 - j)]->y * calcSpline(j, tension);
				z += controlPoints[i - (3 - j)]->z * calcSpline(j, tension);
			}

			splinePoints.Append(new idVec3(x, y, z));
		}
	}

	dirty = false;
	//Com_Printf("Spline build took %f seconds\n", (float)(Sys_Milliseconds() - start) / 1000);
}
Esempio n. 2
0
/*
================
idSplineList::clear
================
*/
void idSplineList::clear() {
	clearControl();
	clearSpline();
	splineTime.Clear();
	selected = NULL;
	dirty = true;
	activeSegment = 0;
	granularity = 0.025f;
	pathColor = idVec4(1.0f, 0.5f, 0.0f, 1.0f);
	controlColor = idVec4(0.7f, 0.0f, 1.0f, 1.0f);
	segmentColor = idVec4(0.0f, 0.0f, 1.0f, 1.0);
	activeColor = idVec4(1.0f, 0.0f, 0.0f, 1.0f);
}