task ItemCreate(Cobj,No,Charge_Success,Charge_Failed,x,y)//玉消ししたときに発生する。装填率を上げたりする
{
		let obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj, imgBorder);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj, 4);
		ObjEffect_SetVertexXY(obj, 0, -4, -4);
		ObjEffect_SetVertexXY(obj, 1, 4,  -4);
		ObjEffect_SetVertexXY(obj, 2, 4, 4);
		ObjEffect_SetVertexXY(obj, 3,  -4,  4);
		
		ObjEffect_SetVertexUV(obj, 0,  173,  119);
		ObjEffect_SetVertexUV(obj, 1,  180, 119);
		ObjEffect_SetVertexUV(obj, 2, 180,  126);
		ObjEffect_SetVertexUV(obj, 3, 173, 126);
		ObjEffect_SetLayer(obj,3);
		Obj_SetPosition(obj,x,y);
		let speed=0.2;
		let angle=atan2(y-Obj_GetY(Cobj),x-Obj_GetX(Cobj));

		if(GetCommonDataDefault("BunSpell",false)==true)
		{
			wait(30);
		}

		loop(10)
		{
			Obj_SetPosition(obj,Obj_GetX(obj)+speed*cos(angle),Obj_GetY(obj)+speed*sin(angle));
		yield;
		}
		let speed=8;
		while(!Obj_BeDeleted(obj))
		{
			let sangle=atan2(GetPlayerY-Obj_GetY(obj),GetPlayerX-Obj_GetX(obj));
			Obj_SetPosition(obj,Obj_GetX(obj)+speed*cos(sangle),Obj_GetY(obj)+speed*sin(sangle));
			if(((Obj_GetX(obj)-GetPlayerX)^2+(Obj_GetY(obj)-GetPlayerY)^2)^0.5<10)
			{
				if(No==photoNo)
				{
					if(Charge<Charge_Failed/5)
					{
						Charge+=0.3;
					}
					else if(Charge<Charge_Failed/4)
					{
						Charge+=0.25;
					}
					else if(Charge<Charge_Failed/3)
					{
						Charge+=0.2;
					}
					else if(Charge<Charge_Failed/2)
					{
						Charge+=0.15;
					}
					else if(Charge<Charge_Failed/1)
					{
						Charge+=0.1;
					}
				}
				else
				{
					if(Charge<Charge_Success/5)
					{
						Charge+=0.3;
					}
					else if(Charge<Charge_Success/4)
					{
						Charge+=0.25;
					}
					else if(Charge<Charge_Success/3)
					{
						Charge+=0.20;
					}
					else if(Charge<Charge_Success/2)
					{
						Charge+=0.15;
					}
					else if(Charge<Charge_Success/1)
					{
						Charge+=0.10;
					}
				}
				EffectItemCreate;
				PlaySE("seScore.wav");
				Obj_Delete(obj);
			}
		yield;
		}
		
}

task AddShootingScore(Chara,Cobj,CAngle,PX,PY,No)//写真のスコア計算及び加算
{
	let DrawX=GetCenterX;
	if(GetPlayerX<GetCenterX)
	{
		DrawX=GetCenterX;
	}
	else
	{
		DrawX=GetCenterX-160;
	}
		let DrawY=GetCenterY-140;//DrawYは表示されるたびに+10or15される
		let DrawYPlus=8;
		let BasePoint=GetCommonDataDefault("BasePoint",0);
		let RiskPoint=GetCommonDataDefault("RiskPoint",0);

		DrawShootBonus("BasePoint",DrawX,DrawY,No);
		ShootBonumNumDraw(BasePoint,DrawX+100,DrawY,false,false,No);

		DrawY+=DrawYPlus;

		let Color=["RedShot","BlueShot","YellowShot","GreenShot","PurpleShot","CyanShot","OrangeShot","WhiteShot"];
		let color=0;
		let colornum=0;
		let Dis=((GetEnemyInfo(1,ENEMY_X)-GetPlayerX)^2+(GetEnemyInfo(1,ENEMY_Y)-GetPlayerY)^2)^0.5;

		if(!GetCommonDataDefault("BunSpell",false))
		{//専用スペルでないときはIDが０
			Dis=((GetEnemyInfo(0,ENEMY_X)-GetPlayerX)^2+(GetEnemyInfo(0,ENEMY_Y)-GetPlayerY)^2)^0.5;
		}
		//		DrawShootBonus("OrangeShot",DrawX,DrawY-50,No);
		//		ShootBonumNumDraw(300,DrawX+100,DrawY-50,true,false,No);
		ascent(let i in 0..8)//ColorShotの判定
		{
			if(GetCommonDataDefault(Color[i],0)>=30)
			{
				if(i<=7)
				{
				BasePoint+=300;
				DrawShootBonus(Color[i],DrawX,DrawY,No);
				ShootBonumNumDraw(300,DrawX+100,DrawY,true,false,No);
				DrawY+=DrawYPlus;
				}
			}
			if(GetCommonDataDefault(Color[i],0)>0)
			{
				color+=1;//色が何種類あるか数える
				colornum+=GetCommonDataDefault(Color[i],0);//弾がいくつあるか数える
			}
			SetCommonData(Color[i],0);//初期化
		}

		if(color>=4 && colornum>=30)//ColorfulShotの判定
		{
			BasePoint+=900;
			DrawShootBonus("ColorfulShot",DrawX,DrawY,No);
			ShootBonumNumDraw(900,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}

		if(color>=7)//RainbowShotの判定
		{
			BasePoint+=2100;
			DrawShootBonus("RainbowShot",DrawX,DrawY,No);
			ShootBonumNumDraw(2100,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}

		if(!GetCommonDataDefault("BunSpell",false))
		{//専用スペルでないときはClearShot判定はない（できない）
			SetCommonData("ClearShot",1);
		}
	
		let PosAngle=(atan2(GetEnemyInfo(1,ENEMY_Y)-GetPlayerY,GetEnemyInfo(1,ENEMY_X)-GetPlayerX)+360)%360;//角度により相対位置を判断する

	if(No>=0)
	{
		if(BasePoint==0)
		{//ソロショット判定
			BasePoint+=100;
			DrawShootBonus("SoloShot",DrawX,DrawY,No);
			ShootBonumNumDraw(100,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}		
		if(GetCommonDataDefault("ClearShot",0)==0)//ClearShotの判定、スペル側の弾の座標を常に確認することで判定している
		{
			BasePoint+=600;
			DrawShootBonus("ClearShot",DrawX,DrawY,No);
			ShootBonumNumDraw(600,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}
		SetCommonData("ClearShot",0);

		if(Dis<=60)//MacroShotの判定
		{
			if(Dis<=30)//一定距離以内ならMaxBonus1000
			{
				BasePoint+=1000;
				DrawShootBonus("MacroBonus",DrawX,DrawY,No);
				ShootBonumNumDraw(1000,DrawX+100,DrawY,true,false,No);
				DrawY+=DrawYPlus;
			}
			else
			{
				BasePoint+=trunc(500*(60-Dis)/30+500);
				DrawShootBonus("MacroBonus",DrawX,DrawY,No);
				ShootBonumNumDraw(500*(60-Dis)/30+500,DrawX+100,DrawY,true,false,No);
				DrawY+=DrawYPlus;
			}
		}

		if(!GetCommonDataDefault("BunSpell",false))
		{//専用スペルでないときはIDが０
			PosAngle=(atan2(GetEnemyInfo(0,ENEMY_Y)-GetPlayerY,GetEnemyInfo(0,ENEMY_X)-GetPlayerX)+360)%360;//角度により相対位置を判断する
		}

		if(225<=PosAngle && PosAngle<=315)
		{
			BasePoint+=100;
			DrawShootBonus("FrontShot",DrawX,DrawY,No);
			ShootBonumNumDraw(100,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}

		if((135<PosAngle && PosAngle<225) || (0<=PosAngle && PosAngle<45) || (315<PosAngle && PosAngle<360))
		{
			BasePoint+=200;
			DrawShootBonus("SideShot",DrawX,DrawY,No);
			ShootBonumNumDraw(200,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}

		if(45<=PosAngle && PosAngle<=135)
		{
			BasePoint+=300;
			DrawShootBonus("BackShot",DrawX,DrawY,No);
			ShootBonumNumDraw(300,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}

		if(RiskPoint>0)//RiskShotの判定、ClearShotと同じように判定
		{
			BasePoint+=RiskPoint;
			DrawShootBonus("RiskPoint",DrawX,DrawY,No);
			ShootBonumNumDraw(RiskPoint,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}

		if(GetCommonDataDefault("SoloShot",false)==true)//未実装
		{
			BasePoint+=100;
		}
	}
	else
	{
		if(BasePoint==0 && Collision_Line_Circle(Obj_GetX(Cobj)-PY*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)-PY*sin(CAngle+CameraDir-90),Obj_GetX(Cobj)+PY*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)+PY*sin(CAngle+CameraDir-90),PX*2,GetPlayerX,GetPlayerY,0))
		{//ソロショット判定
			BasePoint+=100;
			DrawShootBonus("SoloShot",DrawX,DrawY,No);
			ShootBonumNumDraw(100,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}
	}

		if(GetCommonDataDefault("OyajiBonus",0)==1)//ClearShotの判定、スペル側の弾の座標を常に確認することで判定している
		{
			BasePoint+=222;
			DrawShootBonus("OyajiBonus",DrawX,DrawY,No);
			ShootBonumNumDraw(222,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
			SetCommonData("OyajiBonus",0);
		}
		if(GetCommonDataDefault("CatBonus",0)==1)//ClearShotの判定、スペル側の弾の座標を常に確認することで判定している
		{
			BasePoint+=666;
			DrawShootBonus("CatBonus",DrawX,DrawY,No);
			ShootBonumNumDraw(666,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
			SetCommonData("CatBonus",0);
		}
	DrawY+=DrawYPlus/2;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		if(No>=0)
		{

		let Distance1;
		if(GetCommonDataDefault("BunSpell",false)==true)
		{
			Distance1=((GetEnemyInfo(1,ENEMY_X)-Obj_GetX(Cobj))^2+(GetEnemyInfo(1,ENEMY_Y)-Obj_GetY(Cobj))^2)^0.5;//写真の中心からボスまでの距離
		}
		else
		{
			Distance1=((GetEnemyInfo(0,ENEMY_X)-Obj_GetX(Cobj))^2+(GetEnemyInfo(0,ENEMY_Y)-Obj_GetY(Cobj))^2)^0.5;//写真の中心からボスまでの距離
		}
		let Distance2=((PX)^2+(PY)^2)^0.5*4/5;//BossShotが１．２倍（最小）になるまでの距離
		let Adjust=0;
		if(Distance1>Distance2)
		{
			Adjust=0;
		}
		else
		{
			Adjust=(Distance2-Distance1)/Distance2;
		}
		let Rate=trunc((Adjust*0.8+1.2)*100);
		BasePoint=BasePoint*Rate/100;
		DrawShootBonus("BossShot",DrawX,DrawY,No);
		ShootBonumNumDraw(Rate,DrawX+100,DrawY,false,true,No);
	
		DrawY+=DrawYPlus;

		if(Collision_Line_Circle(Obj_GetX(Cobj)-PY*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)-PY*sin(CAngle+CameraDir-90),Obj_GetX(Cobj)+PY*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)+PY*sin(CAngle+CameraDir-90),PX*2,GetPlayerX,GetPlayerY,0))
		{//写真内に自分かいるかどうか判定
			BasePoint=BasePoint*1.5;
			DrawShootBonus("TwoShot",DrawX,DrawY,No);
			ShootBonumNumDraw(150,DrawX+100,DrawY,false,true,No);
			DrawY+=DrawYPlus;
		}

		if(GetCommonDataDefault("NiceShot",0)>0)
		{//スペル側で値を設定している
			BasePoint=BasePoint*GetCommonDataDefault("NiceShot",0);
			DrawShootBonus("NiceShot",DrawX,DrawY,No);
			ShootBonumNumDraw(GetCommonDataDefault("NiceShot",0)*100,DrawX+100,DrawY,false,true,No);
			DrawY+=DrawYPlus;
		}
		SetCommonData("NiceShot",0);

		let AngleRate=floor(absolute(PosAngle-CAngle)%90);//AngleBonus正しいかどうかは疑問。
		let AngleBonusPlus;
		if(Chara=="AYA")
		{
			AngleBonusPlus=0.3;
		}
		else
		{
			AngleBonusPlus=0.7;
		}
			if((CameraDir/90)%2==1)
			{
				AngleRate=trunc(((90-AngleRate)*AngleBonusPlus/90+1)*100)/100;
			}
			else
			{
				AngleRate=trunc(((AngleRate)*AngleBonusPlus/90+1)*100)/100;
			}
			BasePoint=BasePoint*(AngleRate);
			DrawShootBonus("AngleBonus",DrawX,DrawY,No);
			ShootBonumNumDraw(AngleRate*100,DrawX+100,DrawY,false,true,No);
			DrawY+=DrawYPlus;
		}
		else
		{
			if(Collision_Line_Circle(Obj_GetX(Cobj)-PY*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)-PY*sin(CAngle+CameraDir-90),Obj_GetX(Cobj)+PY*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)+PY*sin(CAngle+CameraDir-90),PX*2,GetPlayerX,GetPlayerY,0))
			{//写真内に自分かいるかどうか判定
				BasePoint=BasePoint*1.2;
				DrawShootBonus("SelfShot",DrawX,DrawY,No);
				ShootBonumNumDraw(120,DrawX+100,DrawY,false,true,No);
			}
			if(BasePoint==0)
			{
				DrawShootBonus("EmptyShot",DrawX,DrawY,No);
				ShootBonumNumDraw(0,DrawX+100,DrawY,false,true,No);
			}
			DrawY+=DrawYPlus;
		}

		if(UsedDebugKey)
		{//写真内に自分かいるかどうか判定
			BasePoint=BasePoint*0.00;
			DrawShootBonus("DebugShot",DrawX,DrawY,No);
			ShootBonumNumDraw(0.00,DrawX+100,DrawY,false,true,No);
			DrawY+=DrawYPlus;
		}

		DrawY+=DrawYPlus*0.5;
		DrawShootBonus("ResultScore",DrawX,DrawY,No);
		ShootBonumNumDraw(BasePoint,DrawX+100,DrawY,false,false,No);
		
			
		AddScore(BasePoint);	

		let DX=GetClipMaxX+40+65*((photoNo%10)%3);
		let DY=GetCenterY+50+65*trunc((photoNo%10)/3);
		if((photoNo%10)<=4)
		{
			DX=GetClipMaxX+80;
			DY=GetCenterY-170+(No%10)*85+25;
		}
		else
		{
			DX=GetClipMaxX+165;
			DY=GetCenterY-170+((No%10)-5)*85+25;
		}
		ShootBonumNumDraw(BasePoint,DX,DY,false,false,No);
		if(GetCommonDataDefault("HiBasePoint",0)<BasePoint && No>=0)
		{
			SetCommonData("HiBasePoint",BasePoint);//一番高い得点を保存、最後にステージ側で記録する
			SetCommonData("BestShootNo",No);
		}
		SetCommonData("BasePoint",0);
		SetCommonData("RiskPoint",0);
}


function ShootRange(obj,CAngle,CDAngle,X,Y,PX,PY,OriAngle1,OriDis1,OriAngle2,OriDis2,OriAngle3,OriDis3,OriAngle4,OriDis4)
{//写真の切り取り方を指定する。１５００行あるとか酷い。簡略化できるの？
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////頂点の一つがシーン外にある場合/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[0]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY-(Y[0]-GetClipMinY)/sin(360-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(Y[0]-GetClipMinY)/cos(360-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMinY)/tan(360-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  X[0]-(Y[0]-GetClipMinY)*tan(360-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(Y[0]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY-(Y[0]-GetClipMaxY)/sin(360-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(Y[0]-GetClipMaxY)/cos(360-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMaxY)/tan(360-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  X[0]-(Y[0]-GetClipMaxY)*tan(360-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(X[0]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMinX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(X[0]-GetClipMinX)/sin(CAngle-180+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX,  Y[0]-(X[0]-GetClipMinX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX,  Y[0]+(X[0]-GetClipMinX)/tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(X[0]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMaxX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(X[0]-GetClipMaxX)/sin(CAngle-180+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX,  Y[0]-(X[0]-GetClipMaxX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX,  Y[0]+(X[0]-GetClipMaxX)/tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[1]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMinY)/cos(CAngle-180+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, -PY-(Y[1]-GetClipMinY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2,  X[1]-(Y[1]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(Y[1]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMaxY)/cos(CAngle-180+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, -PY-(Y[1]-GetClipMaxY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2,  X[1]-(Y[1]-GetClipMaxY)/tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}


		if(X[1]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(X[1]-GetClipMinX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY-(X[1]-GetClipMinX)/sin(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, Y[1]-(X[1]-GetClipMinX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  GetClipMinX, Y[1]+(X[1]-GetClipMinX)/tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(X[1]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(X[1]-GetClipMaxX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY-(X[1]-GetClipMaxX)/sin(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, Y[1]-(X[1]-GetClipMaxX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  GetClipMaxX, Y[1]+(X[1]-GetClipMaxX)/tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[2]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMinY)/sin(360-CAngle-180-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 3, PX+(Y[2]-GetClipMinY)/cos(360-CAngle-180-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMinY)/tan(360-CAngle-180-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, X[2]-(Y[2]-GetClipMinY)*tan(360-CAngle-180-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(Y[2]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMaxY)/sin(360-CAngle-180-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 3, PX+(Y[2]-GetClipMaxY)/cos(360-CAngle-180-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMaxY)/tan(360-CAngle-180-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, X[2]-(Y[2]-GetClipMaxY)*tan(360-CAngle-180-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(X[2]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMinX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX+(X[2]-GetClipMinX)/sin(CAngle+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX,  Y[2]-(X[2]-GetClipMinX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX,  Y[2]+(X[2]-GetClipMinX)/tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(X[2]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMaxX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX+(X[2]-GetClipMaxX)/sin(CAngle+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX,  Y[2]-(X[2]-GetClipMaxX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX,  Y[2]+(X[2]-GetClipMaxX)/tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[3]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(Y[3]-GetClipMinY)/cos(CAngle-360+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY+(Y[3]-GetClipMinY)/sin(CAngle-360+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3,X[3]+(Y[3]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 4, X[3]-(Y[3]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		}

		if(Y[3]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(Y[3]-GetClipMaxY)/cos(CAngle-360+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY+(Y[3]-GetClipMaxY)/sin(CAngle-360+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3,X[3]+(Y[3]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 4, X[3]-(Y[3]-GetClipMaxY)/tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		}

		if(X[3]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(X[3]-GetClipMinX)/cos(CAngle-270+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY+(X[3]-GetClipMinX)/sin(CAngle-270+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX, Y[3]-(X[3]-GetClipMinX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, GetClipMinX, Y[3]+(X[3]-GetClipMinX)/tan(CAngle-270+CDAngle-90));
		}

		if(X[3]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(X[3]-GetClipMaxX)/cos(CAngle-270+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY+(X[3]-GetClipMaxX)/sin(CAngle-270+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX, Y[3]-(X[3]-GetClipMaxX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, GetClipMaxX, Y[3]+(X[3]-GetClipMaxX)/tan(CAngle-270+CDAngle-90));
		}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////頂点の二つがＸ座標、Ｙ座標同士でシーン外にある場合///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[0]<GetClipMinY && Y[1]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(Y[0]-GetClipMinY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY-(Y[1]-GetClipMinY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]-(Y[0]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  X[1]-(Y[1]-GetClipMinY)/tan(CAngle-180+CDAngle-90), GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}

		if(Y[0]>GetClipMaxY && Y[1]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(Y[0]-GetClipMaxY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY-(Y[1]-GetClipMaxY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]-(Y[0]-GetClipMaxY)/tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  X[1]-(Y[1]-GetClipMaxY)/tan(CAngle-180+CDAngle-90), GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}

		if(X[0]<GetClipMinX && X[1]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMinX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY-(X[1]-GetClipMinX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX,  Y[0]-(X[0]-GetClipMinX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, Y[1]-(X[1]-GetClipMinX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}


		if(X[0]>GetClipMaxX && X[1]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMaxX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY-(X[1]-GetClipMaxX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX,  Y[0]-(X[0]-GetClipMaxX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, Y[1]-(X[1]-GetClipMaxX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[1]<GetClipMinY && Y[2]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMinY)/sin(270-CAngle-CDAngle+90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX+(Y[2]-GetClipMinY)/sin(270-CAngle-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMinY)/tan(270-CAngle-CDAngle+90), GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMinY)/tan(270-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}

		if(Y[1]>GetClipMaxY && Y[2]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMaxY)/sin(270-CAngle-CDAngle+90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX+(Y[2]-GetClipMaxY)/sin(270-CAngle-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMaxY)/tan(270-CAngle-CDAngle+90), GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMaxY)/tan(270-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}

		if(X[1]<GetClipMinX && X[2]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(X[1]-GetClipMinX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX+(X[2]-GetClipMinX)/cos(CAngle-90+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, Y[1]-(X[1]-GetClipMinX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX,  Y[2]-(X[2]-GetClipMinX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}

		if(X[1]>GetClipMaxX && X[2]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(X[1]-GetClipMaxX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX+(X[2]-GetClipMaxX)/cos(CAngle-90+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, Y[1]-(X[1]-GetClipMaxX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX,  Y[2]-(X[2]-GetClipMaxX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[2]<GetClipMinY && Y[3]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMinY)/sin(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY+(Y[3]-GetClipMinY)/sin(CAngle+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMinY)/tan(CAngle+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, X[3]+(Y[3]-GetClipMinY)/tan(CAngle+CDAngle-90), GetClipMinY);
		}

		if(Y[2]>GetClipMaxY && Y[3]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMaxY)/sin(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY+(Y[3]-GetClipMaxY)/sin(CAngle+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMaxY)/tan(CAngle+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, X[3]+(Y[3]-GetClipMaxY)/tan(CAngle+CDAngle-90), GetClipMaxY);
		}

		if(X[2]<GetClipMinX && X[3]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMinX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY+(X[3]-GetClipMinX)/cos(CAngle+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX,  Y[2]-(X[2]-GetClipMinX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX, Y[3]-(X[3]-GetClipMinX)*tan(CAngle+CDAngle-90));
		}

		if(X[2]>GetClipMaxX && X[3]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMaxX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY+(X[3]-GetClipMaxX)/cos(CAngle+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX,  Y[2]-(X[2]-GetClipMaxX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX, Y[3]-(X[3]-GetClipMaxX)*tan(CAngle+CDAngle-90));
		}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[3]<GetClipMinY && Y[0]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX-(Y[0]-GetClipMinY)/sin(CAngle-270+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(Y[3]-GetClipMinY)/sin(CAngle-270+CDAngle-90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]-(Y[0]-GetClipMinY)/tan(CAngle-270+CDAngle-90), GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3]-(Y[3]-GetClipMinY)/tan(CAngle-270+CDAngle-90), GetClipMinY);
		}

		if(Y[3]>GetClipMaxY && Y[0]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX-(Y[0]-GetClipMaxY)/sin(CAngle-270+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(Y[3]-GetClipMaxY)/sin(CAngle-270+CDAngle-90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]-(Y[0]-GetClipMaxY)/tan(CAngle-270+CDAngle-90), GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3]-(Y[3]-GetClipMaxY)/tan(CAngle-270+CDAngle-90), GetClipMaxY);
		}

		if(X[3]<GetClipMinX && X[0]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX-(X[0]-GetClipMinX)/cos(CAngle+90+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(X[3]-GetClipMinX)/cos(CAngle+90+CDAngle-90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX,  Y[0]-(X[0]-GetClipMinX)*tan(CAngle+90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX, Y[3]-(X[3]-GetClipMinX)*tan(CAngle+90+CDAngle-90));
		}

		if(X[3]>GetClipMaxX && X[0]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX-(X[0]-GetClipMaxX)/cos(CAngle+90+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(X[3]-GetClipMaxX)/cos(CAngle+90+CDAngle-90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX,  Y[0]-(X[0]-GetClipMaxX)*tan(CAngle+90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX, Y[3]-(X[3]-GetClipMaxX)*tan(CAngle+90+CDAngle-90));
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////隣の頂点の二つがＸ座標、Ｙ座標違いででシーン外にあり、シーン端が写真内にない場合/////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
		if(X[0]<GetClipMinX && Y[1]<GetClipMinY && Y[0]+(X[0]-GetClipMinX)/tan(CAngle-180+CDAngle-90)>GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 6);
		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMinX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(X[0]-GetClipMinX)/sin(CAngle-180+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX+(Y[1]-GetClipMinY)/cos(CAngle-180+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, -PY-(Y[1]-GetClipMinY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 4, PX, PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX,  Y[0]-(X[0]-GetClipMinX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX,  Y[0]+(X[0]-GetClipMinX)/tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  X[1]+(Y[1]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3,  X[1]-(Y[1]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 4, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 5, X[3], Y[3]);
		}

		if(X[1]<GetClipMinX && Y[2]<GetClipMinY && Y[1]+(X[1]-GetClipMinX)/tan(CAngle-90+CDAngle-90)>GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(X[1]-GetClipMinX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY-(X[1]-GetClipMinX)/sin(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY+(Y[2]-GetClipMinY)/sin(360-CAngle-180-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 4, PX+(Y[2]-GetClipMinY)/cos(360-CAngle-180-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, Y[1]-(X[1]-GetClipMinX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  GetClipMinX, Y[1]+(X[1]-GetClipMinX)/tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[2]+(Y[2]-GetClipMinY)/tan(360-CAngle-180-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 4, X[2]-(Y[2]-GetClipMinY)*tan(360-CAngle-180-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 5, X[3], Y[3]);
		}

		if(X[2]<GetClipMinX && Y[3]<GetClipMinY && Y[2]+(X[2]-GetClipMinX)/tan(CAngle+CDAngle-90)>GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMinX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX+(X[2]-GetClipMinX)/sin(CAngle+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX-(Y[3]-GetClipMinY)/cos(CAngle-360+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY+(Y[3]-GetClipMinY)/sin(CAngle-360+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX,  Y[2]-(X[2]-GetClipMinX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX,  Y[2]+(X[2]-GetClipMinX)/tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, X[3]+(Y[3]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 5, X[3]-(Y[3]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		}

		if(X[3]<GetClipMinX && Y[0]<GetClipMinY && Y[3]+(X[3]-GetClipMinX)/tan(CAngle-270+CDAngle-90)>GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY-(Y[0]-GetClipMinY)/sin(360-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(Y[0]-GetClipMinY)/cos(360-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX-(X[3]-GetClipMinX)/cos(CAngle-270+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY+(X[3]-GetClipMinX)/sin(CAngle-270+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMinY)/tan(360-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  X[0]-(Y[0]-GetClipMinY)*tan(360-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, GetClipMinX, Y[3]-(X[3]-GetClipMinX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 5, GetClipMinX, Y[3]+(X[3]-GetClipMinX)/tan(CAngle-270+CDAngle-90));
		}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[0]<GetClipMinY && X[1]>GetClipMaxX && X[0]-(Y[0]-GetClipMinY)*tan(360-CAngle-CDAngle+90)<GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY-(Y[0]-GetClipMinY)/sin(360-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(Y[0]-GetClipMinY)/cos(360-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX+(X[1]-GetClipMaxX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX,  -PY-(X[1]-GetClipMaxX)/sin(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 4, PX, PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMinY)/tan(360-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1, X[0]-(Y[0]-GetClipMinY)*tan(360-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2,  GetClipMaxX, Y[1]-(X[1]-GetClipMaxX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3,  GetClipMaxX, Y[1]+(X[1]-GetClipMaxX)/tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 5, X[3], Y[3]);
		}

		if(Y[1]<GetClipMinY && X[2]>GetClipMaxX && X[1]-(Y[1]-GetClipMinY)/tan(CAngle-180+CDAngle-90)<GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMinY)/cos(CAngle-180+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, -PY-(Y[1]-GetClipMinY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY+(X[2]-GetClipMaxX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 4, PX+(X[2]-GetClipMaxX)/sin(CAngle+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2,  X[1]-(Y[1]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX,  Y[2]-(X[2]-GetClipMaxX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, GetClipMaxX,  Y[2]+(X[2]-GetClipMaxX)/tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 5, X[3], Y[3]);
		}

		if(Y[2]<GetClipMinY && X[3]>GetClipMaxX && X[2]-(Y[2]-GetClipMinY)/tan(CAngle-180+CDAngle-90)<GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMinY)/sin(360-CAngle-180-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 3, PX+(Y[2]-GetClipMinY)/cos(360-CAngle-180-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX-(X[3]-GetClipMaxX)/cos(CAngle-270+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY+(X[3]-GetClipMaxX)/sin(CAngle-270+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMinY)/tan(360-CAngle-180-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, X[2]-(Y[2]-GetClipMinY)*tan(360-CAngle-180-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 4, GetClipMaxX, Y[3]-(X[3]-GetClipMaxX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 5, GetClipMaxX, Y[3]+(X[3]-GetClipMaxX)/tan(CAngle-270+CDAngle-90));
		}

		if(Y[3]<GetClipMinY && X[0]>GetClipMaxX && X[3]-(Y[3]-GetClipMinY)/tan(CAngle-180+CDAngle-90)<GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMaxX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(X[0]-GetClipMaxX)/sin(CAngle-180+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX-(Y[3]-GetClipMinY)/cos(CAngle-360+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY+(Y[3]-GetClipMinY)/sin(CAngle-360+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX,  Y[0]-(X[0]-GetClipMaxX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX,  Y[0]+(X[0]-GetClipMaxX)/tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3]+(Y[3]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 5, X[3]-(Y[3]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(X[0]>GetClipMaxX && Y[1]>GetClipMaxY && Y[0]-(X[0]-GetClipMaxX)*tan(CAngle-180+CDAngle-90)<GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMaxX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(X[0]-GetClipMaxX)/sin(CAngle-180+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX+(Y[1]-GetClipMaxY)/cos(CAngle-180+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, -PY-(Y[1]-GetClipMaxY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 4, PX, PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX,  Y[0]-(X[0]-GetClipMaxX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX,  Y[0]+(X[0]-GetClipMaxX)/tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  X[1]+(Y[1]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3,  X[1]-(Y[1]-GetClipMaxY)/tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 4, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 5, X[3], Y[3]);
		}

		if(X[1]>GetClipMaxX && Y[2]>GetClipMaxY && Y[1]-(X[1]-GetClipMaxX)*tan(CAngle-180+CDAngle-90)<GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(X[1]-GetClipMaxX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY-(X[1]-GetClipMaxX)/sin(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY+(Y[2]-GetClipMaxY)/sin(360-CAngle-180-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 4, PX+(Y[2]-GetClipMaxY)/cos(360-CAngle-180-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, Y[1]-(X[1]-GetClipMaxX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  GetClipMaxX, Y[1]+(X[1]-GetClipMaxX)/tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[2]+(Y[2]-GetClipMaxY)/tan(360-CAngle-180-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 4, X[2]-(Y[2]-GetClipMaxY)*tan(360-CAngle-180-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 5, X[3], Y[3]);
		}

		if(X[2]>GetClipMaxX && Y[3]>GetClipMaxY && Y[2]-(X[2]-GetClipMaxX)*tan(CAngle-180+CDAngle-90)<GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMaxX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX+(X[2]-GetClipMaxX)/sin(CAngle+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX-(Y[3]-GetClipMaxY)/cos(CAngle-360+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY+(Y[3]-GetClipMaxY)/sin(CAngle-360+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX,  Y[2]-(X[2]-GetClipMaxX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX,  Y[2]+(X[2]-GetClipMaxX)/tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, X[3]+(Y[3]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 5, X[3]-(Y[3]-GetClipMaxY)/tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		}

		if(X[3]>GetClipMaxX && Y[0]>GetClipMaxY && Y[3]-(X[3]-GetClipMaxX)*tan(CAngle-180+CDAngle-90)<GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY-(Y[0]-GetClipMaxY)/sin(360-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(Y[0]-GetClipMaxY)/cos(360-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX-(X[3]-GetClipMaxX)/cos(CAngle-270+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY+(X[3]-GetClipMaxX)/sin(CAngle-270+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMaxY)/tan(360-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  X[0]-(Y[0]-GetClipMaxY)*tan(360-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, GetClipMaxX, Y[3]-(X[3]-GetClipMaxX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 5, GetClipMaxX, Y[3]+(X[3]-GetClipMaxX)/tan(CAngle-270+CDAngle-90));
		}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[0]>GetClipMaxY && X[1]<GetClipMinX && X[0]+(Y[0]-GetClipMaxY)/tan(360-CAngle-CDAngle+90)>GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY-(Y[0]-GetClipMaxY)/sin(360-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(Y[0]-GetClipMaxY)/cos(360-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX+(X[1]-GetClipMinX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX,  -PY-(X[1]-GetClipMinX)/sin(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 4, PX, PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMaxY)/tan(360-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  X[0]-(Y[0]-GetClipMaxY)*tan(360-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2,  GetClipMinX, Y[1]-(X[1]-GetClipMinX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3,  GetClipMinX, Y[1]+(X[1]-GetClipMinX)/tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 5, X[3], Y[3]);
		}

		if(Y[1]>GetClipMaxY && X[2]<GetClipMinX && X[1]+(Y[1]-GetClipMaxY)/tan(360-CAngle-CDAngle+90)>GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMaxY)/cos(CAngle-180+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, -PY-(Y[1]-GetClipMaxY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY+(X[2]-GetClipMinX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 4, PX+(X[2]-GetClipMinX)/sin(CAngle+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2,  X[1]-(Y[1]-GetClipMaxY)/tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX,  Y[2]-(X[2]-GetClipMinX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, GetClipMinX,  Y[2]+(X[2]-GetClipMinX)/tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 5, X[3], Y[3]);
		}

		if(Y[2]>GetClipMaxY && X[3]<GetClipMinX && X[2]+(Y[2]-GetClipMaxY)/tan(360-CAngle-CDAngle+90)>GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMaxY)/sin(360-CAngle-180-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 3, PX+(Y[2]-GetClipMaxY)/cos(360-CAngle-180-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX-(X[3]-GetClipMinX)/cos(CAngle-270+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY+(X[3]-GetClipMinX)/sin(CAngle-270+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMaxY)/tan(360-CAngle-180-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, X[2]-(Y[2]-GetClipMaxY)*tan(360-CAngle-180-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 4, GetClipMinX, Y[3]-(X[3]-GetClipMinX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 5, GetClipMinX, Y[3]+(X[3]-GetClipMinX)/tan(CAngle-270+CDAngle-90));
		}

		if(Y[3]>GetClipMaxY && X[0]<GetClipMinX && X[3]+(Y[3]-GetClipMaxY)/tan(360-CAngle-CDAngle+90)>GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 6);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMinX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(X[0]-GetClipMinX)/sin(CAngle-180+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX-(Y[3]-GetClipMaxY)/cos(CAngle-360+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 5,  -PX,  PY+(Y[3]-GetClipMaxY)/sin(CAngle-360+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX,  Y[0]-(X[0]-GetClipMinX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX,  Y[0]+(X[0]-GetClipMinX)/tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3]+(Y[3]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 5, X[3]-(Y[3]-GetClipMaxY)/tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////隣の頂点の二つがＸ座標、Ｙ座標違いででシーン外にあり、シーン端が写真内にある場合/////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(X[0]<GetClipMinX && Y[1]<GetClipMinY && Y[0]+(X[0]-GetClipMinX)/tan(CAngle-180+CDAngle-90)<=GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMinX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, OriDis1*sin(OriAngle1-90+CAngle-180+CDAngle-90),OriDis1*cos(OriAngle1-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY-(Y[1]-GetClipMinY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMinX,  Y[0]-(X[0]-GetClipMinX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2,  X[1]-(Y[1]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(X[1]<GetClipMinX && Y[2]<GetClipMinY && Y[1]+(X[1]-GetClipMinX)/tan(CAngle-90+CDAngle-90)<=GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(X[1]-GetClipMinX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, OriDis1*sin(OriAngle1-90+CAngle-180+CDAngle-90),OriDis1*cos(OriAngle1-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX+(Y[2]-GetClipMinY)/cos(360-CAngle-180-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, Y[1]-(X[1]-GetClipMinX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  GetClipMinX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, X[2]-(Y[2]-GetClipMinY)*tan(360-CAngle-180-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(X[2]<GetClipMinX && Y[3]<GetClipMinY && Y[2]+(X[2]-GetClipMinX)/tan(CAngle+CDAngle-90)<=GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMinX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, OriDis1*sin(OriAngle1-90+CAngle-180+CDAngle-90),OriDis1*cos(OriAngle1-90+CAngle-180+CDAngle-90));	
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY+(Y[3]-GetClipMinY)/sin(CAngle-360+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX,  Y[2]-(X[2]-GetClipMinX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3,  GetClipMinX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 4, X[3]-(Y[3]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		}

		if(X[3]<GetClipMinX && Y[0]<GetClipMinY && Y[3]+(X[3]-GetClipMinX)/tan(CAngle-270+CDAngle-90)<=GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX-(Y[0]-GetClipMinY)/cos(360-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(X[3]-GetClipMinX)/cos(CAngle-270+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 4, OriDis1*sin(OriAngle1-90+CAngle-180+CDAngle-90),OriDis1*cos(OriAngle1-90+CAngle-180+CDAngle-90));
		

		ObjEffect_SetVertexUV(obj, 0,  X[0]-(Y[0]-GetClipMinY)*tan(360-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX, Y[3]-(X[3]-GetClipMinX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4,  GetClipMinX, GetClipMinY);
		}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[0]<GetClipMinY && X[1]>GetClipMaxX && X[0]-(Y[0]-GetClipMinY)*tan(360-CAngle-CDAngle+90)>=GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY-(Y[0]-GetClipMinY)/sin(360-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 1, OriDis2*sin(OriAngle2-90+CAngle-180+CDAngle-90),OriDis2*cos(OriAngle2-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY-(X[1]-GetClipMaxX)/sin(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMinY)/tan(360-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2,  GetClipMaxX, Y[1]+(X[1]-GetClipMaxX)/tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(Y[1]<GetClipMinY && X[2]>GetClipMaxX && X[1]-(Y[1]-GetClipMinY)/tan(CAngle-180+CDAngle-90)>=GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMinY)/cos(CAngle-180+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, OriDis2*sin(OriAngle2-90+CAngle-180+CDAngle-90),OriDis2*cos(OriAngle2-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX+(X[2]-GetClipMaxX)/sin(CAngle+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
	
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2,  GetClipMaxX, GetClipMinY);	
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX,  Y[2]+(X[2]-GetClipMaxX)/tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(Y[2]<GetClipMinY && X[3]>GetClipMaxX && X[2]-(Y[2]-GetClipMinY)/tan(-(CAngle-180+CDAngle-90))>=GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMinY)/sin(360-CAngle-180-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 3, OriDis2*sin(OriAngle2-90+CAngle-180+CDAngle-90),OriDis2*cos(OriAngle2-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY+(X[3]-GetClipMaxX)/sin(CAngle-270+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMinY)/tan(360-CAngle-180-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3,  GetClipMaxX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 4, GetClipMaxX, Y[3]+(X[3]-GetClipMaxX)/tan(CAngle-270+CDAngle-90));
		}

		if(Y[3]<GetClipMinY && X[0]>GetClipMaxX && X[3]-(Y[3]-GetClipMinY)/tan(CAngle-180+CDAngle-90)>=GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX-(X[0]-GetClipMaxX)/sin(CAngle-180+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(Y[3]-GetClipMinY)/cos(CAngle-360+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 4, OriDis2*sin(OriAngle2-90+CAngle-180+CDAngle-90),OriDis2*cos(OriAngle2-90+CAngle-180+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX,  Y[0]+(X[0]-GetClipMaxX)/tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3]+(Y[3]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 4,  GetClipMaxX, GetClipMinY);
		}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(X[0]>GetClipMaxX && Y[1]>GetClipMaxY && Y[0]+(X[0]-GetClipMaxX)*tan(CAngle-180+CDAngle-90)>=GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMaxX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, OriDis3*sin(OriAngle3-90+CAngle-180+CDAngle-90),OriDis3*cos(OriAngle3-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX, -PY-(Y[1]-GetClipMaxY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX,  Y[0]-(X[0]-GetClipMaxX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2,  X[1]-(Y[1]-GetClipMaxY)/tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(X[1]>GetClipMaxX && Y[2]>GetClipMaxY && Y[1]-(X[1]-GetClipMaxX)*tan(CAngle-180+CDAngle-90)>=GetClipMaxY)
		{

		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(X[1]-GetClipMaxX)/cos(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, OriDis3*sin(OriAngle3-90+CAngle-180+CDAngle-90),OriDis3*cos(OriAngle3-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX+(Y[2]-GetClipMaxY)/cos(360-CAngle-180-CDAngle+90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, Y[1]-(X[1]-GetClipMaxX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2,  GetClipMaxX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, X[2]-(Y[2]-GetClipMaxY)*tan(360-CAngle-180-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(X[2]>GetClipMaxX && Y[3]>GetClipMaxY && Y[2]+(X[2]-GetClipMaxX)*tan(CAngle-180+CDAngle-90)>=GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMaxX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, OriDis3*sin(OriAngle3-90+CAngle-180+CDAngle-90),OriDis3*cos(OriAngle3-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY+(Y[3]-GetClipMaxY)/sin(CAngle-360+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX,  Y[2]-(X[2]-GetClipMaxX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3,  GetClipMaxX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 4, X[3]-(Y[3]-GetClipMaxY)/tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		}

		if(X[3]>GetClipMaxX && Y[0]>GetClipMaxY && Y[3]-(X[3]-GetClipMaxX)*tan(CAngle-180+CDAngle-90)>=GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 5);


		ObjEffect_SetVertexXY(obj, 0, -PX-(Y[0]-GetClipMaxY)/cos(360-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(X[3]-GetClipMaxX)/cos(CAngle-270+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 4, OriDis3*sin(OriAngle3-90+CAngle-180+CDAngle-90),OriDis3*cos(OriAngle3-90+CAngle-180+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]-(Y[0]-GetClipMaxY)*tan(360-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX, Y[3]-(X[3]-GetClipMaxX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4,  GetClipMaxX, GetClipMaxY);
		}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[0]>GetClipMaxY && X[1]<GetClipMinX && X[0]-(Y[0]-GetClipMaxY)/tan(360-CAngle-CDAngle+90)<=GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX,-PY-(Y[0]-GetClipMaxY)/sin(360-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 1, OriDis4*sin(OriAngle4-90+CAngle-180+CDAngle-90),OriDis4*cos(OriAngle4-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX,  -PY-(X[1]-GetClipMinX)/sin(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX, PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMaxY)/tan(360-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2,  GetClipMinX, Y[1]+(X[1]-GetClipMinX)/tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(Y[1]>GetClipMaxY && X[2]<GetClipMinX && X[1]+(Y[1]-GetClipMaxY)/tan(360-CAngle-CDAngle+90)<=GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMaxY)/cos(CAngle-180+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, OriDis4*sin(OriAngle4-90+CAngle-180+CDAngle-90),OriDis4*cos(OriAngle4-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3, PX+(X[2]-GetClipMinX)/sin(CAngle+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2,  GetClipMinX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX,  Y[2]+(X[2]-GetClipMinX)/tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 4, X[3], Y[3]);
		}

		if(Y[2]>GetClipMaxY && X[3]<GetClipMinX && X[2]-(Y[2]-GetClipMaxY)/tan(360-CAngle-CDAngle+90)<=GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMaxY)/sin(360-CAngle-180-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 3, OriDis4*sin(OriAngle4-90+CAngle-180+CDAngle-90),OriDis4*cos(OriAngle4-90+CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 4,  -PX,  PY+(X[3]-GetClipMinX)/sin(CAngle-270+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMaxY)/tan(360-CAngle-180-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3,  GetClipMinX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 4, GetClipMinX, Y[3]+(X[3]-GetClipMinX)/tan(CAngle-270+CDAngle-90));
		}

		if(Y[3]>GetClipMaxY && X[0]<GetClipMinX && X[3]+(Y[3]-GetClipMaxY)/tan(360-CAngle-CDAngle+90)<=GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 5);


		ObjEffect_SetVertexXY(obj, 0, -PX-(X[0]-GetClipMinX)/sin(CAngle-180+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(Y[3]-GetClipMaxY)/cos(CAngle-360+CDAngle-90),  PY);
		ObjEffect_SetVertexXY(obj, 4, OriDis4*sin(OriAngle4-90+CAngle-180+CDAngle-90),OriDis4*cos(OriAngle4-90+CAngle-180+CDAngle-90));
		

		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX,  Y[0]+(X[0]-GetClipMinX)/tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3]+(Y[3]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 4,  GetClipMinX, GetClipMaxY);
		}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////対角の頂点二つ（頂点の三つ）がシーン外にある場合、シーン内に端が入る場合。入らない状況はある？/////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[1]<GetClipMinY && X[3]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, OriDis1*sin(OriAngle1+CAngle-180-90+CDAngle-90),OriDis1*cos(OriAngle1+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY-(Y[1]-GetClipMinY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(X[3]-GetClipMinX)/cos(270-CAngle-CDAngle+90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  X[1]-(Y[1]-GetClipMinY)/tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX, Y[3]+(X[3]-GetClipMinX)/tan(CAngle-180+CDAngle-90));
		}

		if(X[0]<GetClipMinX && Y[2]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMinX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, OriDis1*sin(OriAngle1+CAngle-180-90+CDAngle-90),OriDis1*cos(OriAngle1+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX+(Y[2]-GetClipMinY)/cos(CAngle-180+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 3, -PX, PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX, Y[0]-(X[0]-GetClipMinX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}

		if(X[1]<GetClipMinX && Y[3]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(X[1]-GetClipMinX)/sin(CAngle+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, OriDis1*sin(OriAngle1+CAngle-180-90+CDAngle-90),OriDis1*cos(OriAngle1+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY+(Y[3]-GetClipMinY)/sin(CAngle+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, Y[1]+(X[1]-GetClipMinX)/tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, X[3]-(Y[3]-GetClipMinY)/tan(CAngle+CDAngle-90), GetClipMinY);
		}

		if(Y[0]<GetClipMinY && X[2]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX-(Y[0]-GetClipMinY)/cos(CAngle+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMinX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  OriDis1*sin(OriAngle1+CAngle-180-90+CDAngle-90),OriDis1*cos(OriAngle1+CAngle-180-90+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMinY)*tan(CAngle+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX,  Y[2]-(X[2]-GetClipMinX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX, GetClipMinY);
		}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(X[1]>GetClipMaxX && Y[3]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 5);

		ObjEffect_SetVertexXY(obj, 0, OriDis2*sin(OriAngle2+CAngle-180-90+CDAngle-90),OriDis2*cos(OriAngle2+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY+(X[1]-GetClipMaxX)/sin(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(Y[3]-GetClipMinY)/sin(CAngle-270+CDAngle-90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, Y[1]+(X[1]-GetClipMaxX)/tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3]-(Y[3]-GetClipMinY)/tan(CAngle-270+CDAngle-90), GetClipMinY);
		}

		if(Y[0]<GetClipMinY && X[2]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(Y[0]-GetClipMinY)/cos(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1,  OriDis2*sin(OriAngle2+CAngle-180-90+CDAngle-90),OriDis2*cos(OriAngle2+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX-(X[2]-GetClipMaxX)/cos(CAngle-270+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMinY)*tan(CAngle-270+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX,  Y[2]+(X[2]-GetClipMaxX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}

		if(Y[1]<GetClipMinY && X[3]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMinY)*sin(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, OriDis2*sin(OriAngle2+CAngle-180-90+CDAngle-90),OriDis2*cos(OriAngle2+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY-(X[3]-GetClipMaxX)*sin(CAngle-90+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMinY)/tan(CAngle-90+CDAngle-90), GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX, Y[3]+(X[3]-GetClipMaxX)/tan(CAngle-90+CDAngle-90));
		}

		if(X[0]>GetClipMaxX && Y[2]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX+(X[0]-GetClipMaxX)/cos(90-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMinY)/cos(90-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 3,  OriDis2*sin(OriAngle2+CAngle-180-90+CDAngle-90),OriDis2*cos(OriAngle2+CAngle-180-90+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX,  Y[0]+(X[0]-GetClipMaxX)*tan(90-CAngle-CDAngle+90));
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMinY)*tan(90-CAngle-CDAngle+90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX, GetClipMinY);
		}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(Y[1]>GetClipMaxY && X[3]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, OriDis3*sin(OriAngle3+CAngle-180-90+CDAngle-90),OriDis3*cos(OriAngle3+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY-(Y[1]-GetClipMaxY)/sin(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(X[3]-GetClipMaxX)/sin(CAngle-180+CDAngle-90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMaxX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMaxY)/tan(CAngle-180+CDAngle-90), GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX, Y[3]+(X[3]-GetClipMaxX)/tan(CAngle-180+CDAngle-90));
		}

		if(X[0]>GetClipMaxX && Y[2]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(X[0]-GetClipMaxX)/cos(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, OriDis3*sin(OriAngle3+CAngle-180-90+CDAngle-90),OriDis3*cos(OriAngle3+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX+(Y[2]-GetClipMaxY)/cos(CAngle-180+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 3, -PX, PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMaxX, Y[0]-(X[0]-GetClipMaxX)*tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2, X[2]+(Y[2]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}

		if(X[1]>GetClipMaxX && Y[3]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX-(X[1]-GetClipMaxX)/sin(CAngle-180+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, OriDis3*sin(OriAngle3+CAngle-180-90+CDAngle-90),OriDis3*cos(OriAngle3+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY-(Y[3]-GetClipMaxY)/sin(CAngle-180+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMaxX, Y[1]+(X[1]-GetClipMaxX)/tan(CAngle-180+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, X[3]-(Y[3]-GetClipMaxY)/tan(CAngle-180+CDAngle-90), GetClipMaxY);
		}

		if(Y[0]>GetClipMaxY && X[2]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX-(Y[0]-GetClipMaxY)/cos(CAngle+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(X[2]-GetClipMaxX)/cos(CAngle+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  OriDis3*sin(OriAngle3+CAngle-180-90+CDAngle-90),OriDis3*cos(OriAngle3+CAngle-180-90+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMaxY)*tan(CAngle+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX,  Y[2]-(X[2]-GetClipMaxX)*tan(CAngle+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, GetClipMaxX, GetClipMaxY);
		}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(X[1]<GetClipMinX && Y[3]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, OriDis4*sin(OriAngle4+CAngle-180-90+CDAngle-90),OriDis4*cos(OriAngle4+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY+(X[1]-GetClipMinX)/sin(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX-(Y[3]-GetClipMaxY)/sin(CAngle-270+CDAngle-90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, Y[1]+(X[1]-GetClipMinX)/tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3]-(Y[3]-GetClipMaxY)/tan(CAngle-270+CDAngle-90), GetClipMaxY);
		}

		if(Y[0]>GetClipMaxY && X[2]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY-(Y[0]-GetClipMaxY)/cos(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1,  OriDis4*sin(OriAngle4+CAngle-180-90+CDAngle-90),OriDis4*cos(OriAngle4+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 2, PX-(X[2]-GetClipMinX)/cos(CAngle-270+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0]+(Y[0]-GetClipMaxY)*tan(CAngle-270+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1,  GetClipMinX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX,  Y[2]-(X[2]-GetClipMinX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}

		if(Y[1]>GetClipMaxY && X[3]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[1]-GetClipMaxY)*sin(CAngle-90+CDAngle-90),  -PY);
		ObjEffect_SetVertexXY(obj, 2, OriDis4*sin(OriAngle4+CAngle-180-90+CDAngle-90),OriDis4*cos(OriAngle4+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY-(X[3]-GetClipMinX)*sin(CAngle-90+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1]+(Y[1]-GetClipMaxY)/tan(CAngle-90+CDAngle-90), GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX, Y[3]+(X[3]-GetClipMinX)/tan(CAngle-90+CDAngle-90));
		}

		if(X[0]<GetClipMinX && Y[2]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX+(X[0]-GetClipMinX)/cos(90-CAngle-CDAngle+90), -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY+(Y[2]-GetClipMaxY)/cos(90-CAngle-CDAngle+90));
		ObjEffect_SetVertexXY(obj, 3,  OriDis4*sin(OriAngle4+CAngle-180-90+CDAngle-90),OriDis4*cos(OriAngle4+CAngle-180-90+CDAngle-90));
		
		ObjEffect_SetVertexUV(obj, 0,  GetClipMinX,  Y[0]+(X[0]-GetClipMinX)*tan(90-CAngle-CDAngle+90));
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2]-(Y[2]-GetClipMaxY)*tan(90-CAngle-CDAngle+90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 3, GetClipMinX, GetClipMaxY);
		}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////全ての頂点がシーン外にある場合/////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		if(X[0]<GetClipMinX && Y[1]<GetClipMinY && Y[2]<GetClipMinY && X[3]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 3);

		ObjEffect_SetVertexXY(obj, 0,  OriDis1*sin(OriAngle1+CAngle-180-90+CDAngle-90),OriDis1*cos(OriAngle1+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[2]-GetClipMinY)/cos(CAngle-180+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 2,  -PX-(X[3]-GetClipMinX)/sin(CAngle-180+CDAngle-90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMinX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1, X[2]+(Y[2]-GetClipMinY)*tan(CAngle-180+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX, Y[3]+(X[3]-GetClipMinX)/tan(CAngle-180+CDAngle-90));
		}

		if(X[2]<GetClipMinX && Y[3]<GetClipMinY && Y[0]<GetClipMinY && X[1]<GetClipMinX)
		{
		ObjEffect_CreateVertex(obj, 3);

		ObjEffect_SetVertexXY(obj, 0,  OriDis1*sin(OriAngle1+CAngle-180-90+CDAngle-90),OriDis1*cos(OriAngle1+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX-(Y[0]-GetClipMinY)/cos(CAngle+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2,  PX+(X[1]-GetClipMinX)/sin(CAngle+CDAngle-90),  -PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMinX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1, X[0]+(Y[0]-GetClipMinY)*tan(CAngle+CDAngle-90),  GetClipMinY);
		ObjEffect_SetVertexUV(obj, 2, GetClipMinX, Y[1]+(X[1]-GetClipMinX)/tan(CAngle+CDAngle-90));
		}

		if(Y[0]<GetClipMinY && X[1]>GetClipMaxX && X[2]>GetClipMaxX && Y[3]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 3);

		ObjEffect_SetVertexXY(obj, 0,  OriDis2*sin(OriAngle2+CAngle-180-90+CDAngle-90),OriDis2*cos(OriAngle2+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX+(X[2]-GetClipMaxX)/cos(CAngle-90+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 2,  -PX+(Y[3]-GetClipMinY)/sin(CAngle-90+CDAngle-90), PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMaxX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1, GetClipMaxX,  Y[2]+(X[2]-GetClipMaxX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, X[3]+(Y[3]-GetClipMinY)/tan(CAngle-90+CDAngle-90), GetClipMinY);
		}

		if(Y[2]<GetClipMinY && X[3]>GetClipMaxX && X[0]>GetClipMaxX && Y[1]<GetClipMinY)
		{
		ObjEffect_CreateVertex(obj, 3);

		ObjEffect_SetVertexXY(obj, 0,  OriDis2*sin(OriAngle2+CAngle-180-90+CDAngle-90),OriDis2*cos(OriAngle2+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX+(X[2]-GetClipMaxX)/cos(CAngle-270+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2,  PX+(Y[3]-GetClipMinY)/sin(CAngle-270+CDAngle-90), -PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMaxX, GetClipMinY);
		ObjEffect_SetVertexUV(obj, 1, GetClipMaxX,  Y[0]+(X[0]-GetClipMaxX)*tan(CAngle-270+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, X[1]+(Y[1]-GetClipMinY)/tan(CAngle-270+CDAngle-90), GetClipMinY);
		}

		if(X[0]>GetClipMaxX && Y[1]>GetClipMaxY && Y[2]>GetClipMaxY && X[3]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 3);

		ObjEffect_SetVertexXY(obj, 0,  OriDis3*sin(OriAngle3+CAngle-180-90+CDAngle-90),OriDis3*cos(OriAngle3+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX+(Y[2]-GetClipMaxY)/cos(CAngle-180+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 2,  -PX-(X[3]-GetClipMaxX)/sin(CAngle-180+CDAngle-90),  PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMaxX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1, X[2]+(Y[2]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX, Y[3]+(X[3]-GetClipMaxX)/tan(CAngle-180+CDAngle-90));
		}

		if(X[2]>GetClipMaxX && Y[3]>GetClipMaxY && Y[0]>GetClipMaxY && X[1]>GetClipMaxX)
		{
		ObjEffect_CreateVertex(obj, 3);

		ObjEffect_SetVertexXY(obj, 0,  OriDis3*sin(OriAngle3+CAngle-180-90+CDAngle-90),OriDis3*cos(OriAngle3+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX+(Y[0]-GetClipMaxY)/cos(CAngle-180+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2,  PX-(X[1]-GetClipMaxX)/sin(CAngle-180+CDAngle-90),  -PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMaxX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1, X[0]+(Y[0]-GetClipMaxY)*tan(CAngle-180+CDAngle-90),  GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 2, GetClipMaxX, Y[1]+(X[1]-GetClipMaxX)/tan(CAngle-180+CDAngle-90));
		}

		if(Y[0]>GetClipMaxY && X[1]<GetClipMinX && X[2]<GetClipMinX && Y[3]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 3);

		ObjEffect_SetVertexXY(obj, 0,  OriDis4*sin(OriAngle4+CAngle-180-90+CDAngle-90),OriDis4*cos(OriAngle4+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, PX+(X[2]-GetClipMinX)/cos(CAngle-90+CDAngle-90), PY);
		ObjEffect_SetVertexXY(obj, 2,  -PX+(Y[3]-GetClipMaxY)/sin(CAngle-90+CDAngle-90), PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMinX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1, GetClipMinX,  Y[2]+(X[2]-GetClipMinX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, X[3]+(Y[3]-GetClipMaxY)/tan(CAngle-90+CDAngle-90), GetClipMaxY);
		}

		if(Y[2]>GetClipMaxY && X[3]<GetClipMinX && X[0]<GetClipMinX && Y[1]>GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 3);

		ObjEffect_SetVertexXY(obj, 0,  OriDis4*sin(OriAngle4+CAngle-180-90+CDAngle-90),OriDis4*cos(OriAngle4+CAngle-180-90+CDAngle-90));
		ObjEffect_SetVertexXY(obj, 1, -PX+(X[0]-GetClipMinX)/cos(CAngle-90+CDAngle-90), -PY);
		ObjEffect_SetVertexXY(obj, 2,  PX+(Y[1]-GetClipMaxY)/sin(CAngle-90+CDAngle-90), -PY);
		
		ObjEffect_SetVertexUV(obj, 0, GetClipMinX, GetClipMaxY);
		ObjEffect_SetVertexUV(obj, 1, GetClipMinX,  Y[0]+(X[0]-GetClipMinX)*tan(CAngle-90+CDAngle-90));
		ObjEffect_SetVertexUV(obj, 2, X[1]+(Y[1]-GetClipMaxY)/tan(CAngle-90+CDAngle-90), GetClipMaxY);
		}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////全ての頂点がシーン内にある場合/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		if(X[0]>GetClipMinX && X[0]<GetClipMaxX && Y[0]>GetClipMinY && Y[0]<GetClipMaxY   &&   X[1]>GetClipMinX && X[1]<GetClipMaxX && Y[1]>GetClipMinY && Y[1]<GetClipMaxY   &&   X[2]>GetClipMinX && X[2]<GetClipMaxX && Y[2]>GetClipMinY && Y[2]<GetClipMaxY   &&   X[3]>GetClipMinX && X[3]<GetClipMaxX && Y[3]>GetClipMinY && Y[3]<GetClipMaxY)
		{
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 0, -PX, -PY);
		ObjEffect_SetVertexXY(obj, 1, PX,  -PY);
		ObjEffect_SetVertexXY(obj, 2, PX, PY);
		ObjEffect_SetVertexXY(obj, 3,  -PX,  PY);
		
		ObjEffect_SetVertexUV(obj, 0,  X[0],  Y[0]);
		ObjEffect_SetVertexUV(obj, 1,  X[1], Y[1]);
		ObjEffect_SetVertexUV(obj, 2, X[2],  Y[2]);
		ObjEffect_SetVertexUV(obj, 3, X[3], Y[3]);
		}
}