Пример #1
0
static int marisa_star_projectile(Projectile *p, int t) {
    float c = 0.3 * psin(t * 0.2);
    p->color = rgb(1 - c, 0.7 + 0.3 * psin(t * 0.1), 0.9 + c/3);

    int r = accelerated(p, t);

    PARTICLE(
        .texture_ptr = get_tex("proj/maristar"),
        .pos = p->pos,
        .color = p->color,
        .rule = timeout,
        .args = { 10 },
        .draw_rule = marisa_star_trail_draw,
        .type = PlrProj,
    );

    if(t == EVENT_DEATH) {
        PARTICLE(
            .texture_ptr = get_tex("proj/maristar"),
            .pos = p->pos,
            .color = p->color,
            .rule = timeout,
            .draw_rule = GrowFade,
            .args = { 40, 2 },
            .type = PlrProj,
            .angle = frand() * 2 * M_PI,
            .flags = PFLAG_DRAWADD,
        );
    }
Пример #2
0
void vrpn_3DMicroscribe::ConvertOriToQuat(float ori[3])
{
	float real0,real1,real2,real;
	float imag0,imag1,imag2,imag[3];

	real0= pcos(ori[0]/2);
	real1= pcos(ori[1]/2);
	real2= pcos(ori[2]/2);
	
	imag0 = psin(ori[0]/2); 
	imag1 = psin(ori[1]/2); 
	imag2 = psin(ori[2]/2); 

	// merge the first two quats
	real = real0 * real1 ;

	if ( real > 1 )
		real = 1;
	else if ( real < -1 )
		real = -1;

	imag[0] = imag0 * real1;
	imag[1] = real0 * imag1;
	imag[2] = imag0 * imag1;

	// merge previous result with last quat

	d_quat[0] = real * real2 - imag[2] * imag2 ;

	if ( d_quat[0] > 1 )
		d_quat[0] = 1;
	else if ( d_quat[0] < -1 )
		d_quat[0] = -1;

	d_quat[1] = imag[0] * real2 + imag[1] * imag2;
	d_quat[2] = imag[1] * real2 - imag[0] * imag2;
	d_quat[3] = real * imag2 + imag[2] * real2;
	
}
Пример #3
0
int main (int argc, char const * argv [])

{
	static char const * optv [] =
	{
		"",
		"pibfile [< scalers]",
		"load prescalers into int6000 and qca7000 parameter file",
		(char const *) (0)
	};
	struct _file_ pib;
	signed c;
	optind = 1;
	while ((c = getoptv (argc, argv, optv)) != -1)
	{
		switch ((char) (c))
		{
		default:
			break;
		}
	}
	argc -= optind;
	argv += optind;
	if (argc > 1)
	{
		error (1, ECANCELED, "Only one target file allowed");
	}
	if ((argc) && (* argv))
	{
		pib.name = * argv;
		if ((pib.file = open (pib.name, O_BINARY|O_RDWR)) == -1)
		{
			error (1, errno, "Can't open %s", pib.name);
		}
		else if (pibfile (&pib))
		{
			error (1, errno, "Bad PIB file: %s", pib.name);
		}
		else if (psin (&pib))
		{
			error (1, ECANCELED, "%s", pib.name);
		}
		else if (piblock (&pib))
		{
			error (1, ECANCELED, "%s", pib.name);
		}
		close (pib.file);
	}
	return (0);
}