Пример #1
0
int DrawRotaGraphF(float x,float y,float scale,float angle,int gh,int trans,int turn)
{
	DXPGRAPHICSHANDLE *gptr;
	GHANDLE2GPTR(gptr,gh);
	register int w = gptr->u1 - gptr->u0;
	register int h = gptr->v1 - gptr->v0;

//	pspvfpu_use_matrices(NULL,0,VMAT0 | VMAT1 | VMAT2);//なんか用途がよくわからない
	ScePspFMatrix4 pos;

	__asm__ volatile(
		"mtv		%1,		S000\n"			//scale
		"mtv		%2,		S001\n"			//angle

		"vcst.s		S002,	VFPU_2_PI\n"	//angleをラジアン単位からVFPU内部の角度単位に直す
		"vmul.s		S001,	S001[-x],	S002\n"

		"vmidt.t	M100\n"					//回転行列を作成
		"vrot.t		C100,	S001,	[c,s,0]\n"
		"vrot.t		C110,	S001,	[-s,c,0]\n"

		"vmscl.t	M100,	M100,	S000\n"	//回転行列をscale倍する

		"mtv		%3,		S102\n"			//x,y座標を回転行列に入れる。これで変換用の行列が完成する
		"mtv		%4,		S112\n"

		"mtv		%5,		S220\n"			//画像の縦、横の大きさ
		"mtv		%6,		S221\n"
		"vi2f.p		C220,	C220,	1\n"	//int→float変換と同時に1/2倍する
		"vone.s		S222\n"					//1をセット。[w,h,1]というベクトルができるので、これらを変換する

		"vmov.t		C200,	C220[-x,-y,1]\n"//[-w,-h-1]
		"vmov.t		C210,	C220[x,-y,1]\n"//[w,-h-1]
		"vmov.t		C230,	C220[-x,y,1]\n"//[-w,h-1]

		"vtfm3.t	C020,	M100,	C220\n"//行列変換
		"vtfm3.t	C000,	M100,	C200\n"
		"vtfm3.t	C010,	M100,	C210\n"
		"vtfm3.t	C030,	M100,	C230\n"

		"usv.q		C020,	32 + %0\n"//変換したデータの書き出し
		"usv.q		C000,	0  + %0\n"
		"usv.q		C010,	16 + %0\n"
		"usv.q		C030,	48 + %0\n"
		:"=m"(pos): "r"(scale), "r"(angle), "r"(x), "r"(y),"r"(w),"r"(h)
	);

	if(turn)return DrawModiGraphF(pos.y.x,pos.y.y,pos.x.x,pos.x.y,pos.w.x,pos.w.y,pos.z.x,pos.z.y,gh,trans);
	return DrawModiGraphF(pos.x.x,pos.x.y,pos.y.x,pos.y.y,pos.z.x,pos.z.y,pos.w.x,pos.w.y,gh,trans);
}
Пример #2
0
void graph_lazer(){
	int i;
	SetDrawMode( DX_DRAWMODE_BILINEAR ) ;//線形補完描画
	for(i=0;i<LAZER_MAX;i++){//敵の弾幕数分ループ
		if(lazer[i].flag>0){//弾幕データがオンなら
			SetDrawBlendMode( DX_BLENDMODE_ADD, 255) ;
			DrawRotaGraphF(//発射位置のエフェクトを描画
				lazer[i].startpt.x+FX,lazer[i].startpt.y+FY,1.0,0,
				img_lazer_moto[lazer[i].knd][lazer[i].col],TRUE
			);
			DrawModiGraphF(//レーザーを描画
				lazer[i].disppt[0].x+FX, lazer[i].disppt[0].y+FY, 
				lazer[i].disppt[1].x+FX, lazer[i].disppt[1].y+FY, 
				lazer[i].disppt[2].x+FX, lazer[i].disppt[2].y+FY, 
				lazer[i].disppt[3].x+FX, lazer[i].disppt[3].y+FY, 
				img_lazer[lazer[i].knd][lazer[i].col],TRUE
			);
			SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0) ;
/*			myDrawSquare(//当たり判定範囲を表示
				lazer[i].outpt[0].x+FX,lazer[i].outpt[0].y+FY,
				lazer[i].outpt[1].x+FX,lazer[i].outpt[1].y+FY,
				lazer[i].outpt[2].x+FX,lazer[i].outpt[2].y+FY,
				lazer[i].outpt[3].x+FX,lazer[i].outpt[3].y+FY
			);*/
		}
	}
}
Пример #3
0
//3次元回転描画
void DrawImpl::rot3D(const Vector2& pos, const Vector2& exRate, float zRot, float xRot, float yRot, int gHandle, int turnFlag){
	MATRIX m;
	int w, h;
	GetGraphSize(gHandle, &w, &h);
	w = (int)(w*exRate.x);
	h = (int)(h*exRate.y);
	if (turnFlag == TRUE)
		w *= -1;
	VECTOR v[4] = { VGet(-(float)w / 2, -(float)h / 2, 0), VGet((float)w / 2, -(float)h / 2, 0)
		, VGet(-(float)w / 2, (float)h / 2, 0), VGet((float)w / 2, (float)h / 2, 0) };

	m = MGetRotZ(zRot);
	for (int i = 0; i < 4; i++)
		v[i] = VTransform(v[i], m);
	if (xRot != 0.0f)
	{
		m = MGetRotX(xRot);
		for (int i = 0; i < 4; i++)
			v[i] = VTransform(v[i], m);
	}
	if (yRot != 0.0f)
	{
		m = MGetRotY(yRot);
		for (int i = 0; i < 4; i++)
			v[i] = VTransform(v[i], m);
	}

	DrawModiGraphF(pos.x + v[0].x, pos.y + v[0].y, pos.x + v[1].x, pos.y + v[1].y, pos.x + v[3].x, pos.y + v[3].y, pos.x + v[2].x, pos.y + v[2].y, gHandle, TRUE);
}
Пример #4
0
//楕円上にグラフを描画 rで円の半径・rate:縦にrをrateの比の分ひしゃげさせる・angle:回転角
void DrawImpl::modiOval(const Vector2& pos, double r, double rate, double angle, int GrHandle, int alpha, int blendMode){
	float gx[4];
	float gy[4];
	float dr = PI * -0.75;
	for (int i = 0; i < 4; i++){
		float dangle = PI * 0.5;
		gx[i] = pos.x + r * cos(angle + i * dangle - dr);
		gy[i] = pos.y + rate * r * sin(angle + i * dangle - dr);
	}

	SetDrawBlendMode(blendMode, alpha);
	DrawModiGraphF(
		gx[0] + dx, gy[0] + dy,
		gx[1] + dx, gy[1] + dy,
		gx[2] + dx, gy[2] + dy,
		gx[3] + dx, gy[3] + dy, GrHandle, 1);
}
Пример #5
0
int DrawModiGraphF( double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, int GrHandle, int TransFlag ){
	return DrawModiGraphF( (float)x1, (float)y1, (float)x2, (float)y2, (float)x3, (float)y3, (float)x4, (float)y4, GrHandle, TransFlag ) ;
}