Exemplo n.º 1
0
Arquivo: bot.c Projeto: icanhas/yantar
/*
 * BotImport_DebugLineShow
 */
static void
BotImport_DebugLineShow(int line, Vec3 start, Vec3 end, int color)
{
	Vec3	points[4], dir, cross, up = {0, 0, 1};
	float	dot;

	copyv3(start, points[0]);
	copyv3(start, points[1]);
	/* points[1][2] -= 2; */
	copyv3(end, points[2]);
	/* points[2][2] -= 2; */
	copyv3(end, points[3]);


	subv3(end, start, dir);
	normv3(dir);
	dot = dotv3(dir, up);
	if(dot > 0.99 || dot < -0.99) setv3(cross, 1, 0, 0);
	else crossv3(dir, up, cross);

	normv3(cross);

	saddv3(points[0], 2, cross, points[0]);
	saddv3(points[1], -2, cross, points[1]);
	saddv3(points[2], -2, cross, points[2]);
	saddv3(points[3], 2, cross, points[3]);

	BotImport_DebugPolygonShow(line, color, 4, points);
}
Exemplo n.º 2
0
/*
==================
BotImport_DebugLineShow
==================
*/
static void BotImport_DebugLineShow(int line, vec3_t start, vec3_t end, int color) {
	vec3_t points[4], dir, cross, up = {0, 0, 1};
	float dot;

	VectorCopy(start, points[0]);
	VectorCopy(start, points[1]);
	//points[1][2] -= 2;
	VectorCopy(end, points[2]);
	//points[2][2] -= 2;
	VectorCopy(end, points[3]);


	VectorSubtract(end, start, dir);
	VectorNormalize(dir);
	dot = DotProduct(dir, up);
	if (dot > 0.99 || dot < -0.99) VectorSet(cross, 1, 0, 0);
	else CrossProduct(dir, up, cross);

	VectorNormalize(cross);

	VectorMA(points[0], 2, cross, points[0]);
	VectorMA(points[1], -2, cross, points[1]);
	VectorMA(points[2], -2, cross, points[2]);
	VectorMA(points[3], 2, cross, points[3]);

	BotImport_DebugPolygonShow(line, color, 4, points);
}
Exemplo n.º 3
0
/*
==================
BotImport_DebugLineShow
==================
*/
void BotImport_DebugLineShow(int line, bvec3_t start, bvec3_t end, int color) {
	bvec3_t points[4], tmp;
	avec3_t dir, cross, up = {AFIXED_0, AFIXED_0, AFIXED_1};
	afixed dot;

	VectorCopy(start, points[0]);
	VectorCopy(start, points[1]);
	//points[1][2] -= 2;
	VectorCopy(end, points[2]);
	//points[2][2] -= 2;
	VectorCopy(end, points[3]);


	VectorSubtract(end, start, tmp);
	VectorNormalizeB2A(tmp, dir);
	dot = FIXED_VEC3DOT(dir, up);
	if (dot > AFIXED(0,99) || dot < -AFIXED(0,99)) VectorSet(cross, AFIXED_1, AFIXED_0, AFIXED_0);
	else CrossProduct(dir, up, cross);

	VectorNormalize(cross);

	FIXED_VEC3MA_R(points[0], BFIXED(2,0), cross, points[0]);
	FIXED_VEC3MA_R(points[1], -BFIXED(2,0), cross, points[1]);
	FIXED_VEC3MA_R(points[2], -BFIXED(2,0), cross, points[2]);
	FIXED_VEC3MA_R(points[3], BFIXED(2,0), cross, points[3]);

	BotImport_DebugPolygonShow(line, color, 4, points);
}