Example #1
0
void warpPortalMatrix(portal_s* p, float* m) //3x3
{
	if(!m)return;
	
	vect3Df_s x=warpPortalVector(p,vect3Df(m[0],m[3],m[6]));
	vect3Df_s y=warpPortalVector(p,vect3Df(m[1],m[4],m[7]));
	vect3Df_s z=warpPortalVector(p,vect3Df(m[2],m[5],m[8]));
	
	m[0]=x.x;m[3]=x.y;m[6]=x.z;
	m[1]=y.x;m[4]=y.y;m[7]=y.z;
	m[2]=z.x;m[5]=z.y;m[8]=z.z;
}
Example #2
0
void warpPlayer(portal_s* p, player_s* pl)
{
	if(!p || !pl)return;
	camera_s* c = &pl->camera;

	camera_s new_camera = *c;

	if(gravityGunObject)gravityGunObject = NULL; // TEMP : TODO better solution

	float tmp1[4*4], tmp2[4*4];
	transposeMatrix44(p->target->matrix, tmp1);
	new_camera.position = vaddf(p->target->position, warpPortalVector(p, vsubf(c->position, p->position)));
	multMatrix44((float*)new_camera.orientation, p->matrix, tmp2);
	rotateMatrixY(tmp1, M_PI, true);
	multMatrix44(tmp2, tmp1, (float*)new_camera.orientation);

	memcpy(new_camera.modelview, new_camera.orientation, sizeof(mtx44));
	translateMatrix((float*)new_camera.modelview, -new_camera.position.x, -new_camera.position.y, -new_camera.position.z);

	pl->object.position = new_camera.position;
	pl->object.speed = warpPortalVector(p, pl->object.speed);
	*c = new_camera;
}
Example #3
0
void warpEnergyBall(portal_s* p, energyBall_s* eb)
{
	if(!p->target)return;
	eb->position=vaddf(warpPortalVector(p,vsubf(eb->position,p->position)),p->target->position);
	eb->direction=warpPortalVector(p,eb->direction);
}