task Finder(RectLeft,RectUp,RectRight,RectDown)//ファインダーの挙動。かなり長い。
{
		let scax=1.0;
		let scay=1.0;
		let ScAngle=90;//通常時のカメラの大きさの周期変化させるための値
		let CameraRD=48;//自機からカメラ中心のまでの基本距離
		let SlowRD=0;//低速に時カメラが伸びる距離（４０まで）
		let ChargeAdjust=0;//高速巻き時、カメラの位置を補正するための値
		let AngleAdjust=0;
		if(GetPlayerScriptName=="HATATE.txt")
		{
			AngleAdjust=-90;
		}
		let obj=Obj_Create(OBJ_EFFECT);
		CameraCoordinate = obj;
		ObjEffect_SetTexture(obj, imgCamera);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj, 4);
		
		CentralSetEffectUVzndXY(obj,RectLeft,RectUp,RectRight,RectDown);

		ObjEffect_SetScale(obj, scax,scay);
		ObjEffect_SetLayer(obj,3);
		ascent(let i in 0..4)
		{
			ObjEffect_SetVertexColor(obj,i,100,255,200,200);
		}

		Pdraw(obj);//装填率と可能、不可能を表示するタスク
		FinderPdraw(obj);//ファインダーモード時残り時間％で表示するをタスク
		FinderCircle(obj);//カメラの中心をくるくる回ってるやつ

		loop{
			if(Charge==100)//100%かどうかで若干大きさを変更
			{
				ObjEffect_SetScale(obj, scax-0.2+0.1*cos(ScAngle),scay-0.2+0.1*cos(ScAngle));
			}
			else
			{
				ObjEffect_SetScale(obj, scax-0.3+0.1*cos(ScAngle),scay-0.3+0.1*cos(ScAngle));
			}
			ScAngle+=10;
			if(FinderMode==false)
			{
				if((KeyStateShot=="PUSH" || KeyStateShot=="HOLD") && (KeyStateSlowMove=="KEY_PUSH" || KeyStateSlowMove=="HOLD") && Charge!=100)
				{
					Obj_SetPosition(obj,GetPlayerX+(CameraRD+ChargeAdjust)*cos(CameraAngle),GetPlayerY+(CameraRD+ChargeAdjust)*sin(CameraAngle));
					ObjEffect_SetAngle(obj,0,0,CameraAngle+CameraDir+AngleAdjust);
					if(ChargeAdjust>-48)
					{
						ChargeAdjust-=9.6;
					}
					SlowRD=0;
				}
				else if((KeyStateShot=="PUSH" || KeyStateShot=="HOLD") && (KeyStateSlowMove=="KEY_PUSH" || KeyStateSlowMove=="HOLD") && Charge==100)
				{
					Obj_SetPosition(obj,GetPlayerX+56*cos(CameraAngle),GetPlayerY+56*sin(CameraAngle));
					ObjEffect_SetAngle(obj,0,0,CameraAngle+CameraDir+AngleAdjust);
					SlowRD=0;
					ChargeAdjust=0;
				}
				else
				{
					Obj_SetPosition(obj,GetPlayerX+(CameraRD+SlowRD)*cos(CameraAngle),GetPlayerY+(CameraRD+SlowRD)*sin(CameraAngle));
					ObjEffect_SetAngle(obj,0,0,CameraAngle+CameraDir+AngleAdjust);
					ChargeAdjust=0;
				}
			}

			if(Obj_GetX(obj)<=GetClipMinX)//カメラが画面外に行かないように位置補正
			{
				Obj_SetX(obj,GetClipMinX);
			}
			if(Obj_GetX(obj)>=GetClipMaxX)
			{
				Obj_SetX(obj,GetClipMaxX);
			}
			if(Obj_GetY(obj)<=GetClipMinY)
			{
				Obj_SetY(obj,GetClipMinY);
			}
			if(Obj_GetY(obj)>=GetClipMaxY)
			{
				Obj_SetY(obj,GetClipMaxY);
			}

			if(KeyStateShot=="PUSH"  && (KeyStateSlowMove=="FREE" || KeyStateSlowMove=="PULL" )  && Charge==100 && GetCommonDataDefault("LoseBoss",false)==false)
			{
				if(IsBossExisting==false && IsForbidBomb==true)
				{
				}
				else
				{
				TFinderMode(obj);//ファインダーモードに移行
				ChargeDicrease;//装填率を減らしていく。ファインダーモードの残り時間を表示するために使用。
				}
			}

			if(KeyStateSlowMove=="PUSH" || KeyStateSlowMove=="HOLD")
			{//低速時の望遠
				if(SlowRD<40)
				{
				SlowRD+=1;
				}
				if(GetCommonDataDefault("BunSpell",false)==true)
				{//専用スペルかどうかで場合わけ
					if(((GetPlayerY-GetEnemyInfo(1,ENEMY_Y))^2+(GetPlayerX-GetEnemyInfo(1,ENEMY_X))^2)^0.5>=56 && ((GetPlayerY-GetEnemyInfo(1,ENEMY_Y))^2+(GetPlayerX-GetEnemyInfo(1,ENEMY_X))^2)^0.5<=CameraRD+SlowRD)
					{//一定距離以下の場合距離補正
						Obj_SetX(obj,GetEnemyInfo(1,ENEMY_X));
						Obj_SetY(obj,GetEnemyInfo(1,ENEMY_Y));
						SlowRD-=1;
					}
					if(((GetPlayerY-GetEnemyInfo(1,ENEMY_Y))^2+(GetPlayerX-GetEnemyInfo(1,ENEMY_X))^2)^0.5<56)
					{
						Obj_SetPosition(obj,GetPlayerX+56*cos(CameraAngle),GetPlayerY+56*sin(CameraAngle));
						SlowRD-=1;
					}
				}
				else
				{
					if(((GetPlayerY-GetEnemyInfo(0,ENEMY_Y))^2+(GetPlayerX-GetEnemyInfo(0,ENEMY_X))^2)^0.5>=56 && ((GetPlayerY-GetEnemyInfo(0,ENEMY_Y))^2+(GetPlayerX-GetEnemyInfo(0,ENEMY_X))^2)^0.5<=CameraRD+SlowRD)
					{
						Obj_SetX(obj,GetEnemyInfo(0,ENEMY_X));
						Obj_SetY(obj,GetEnemyInfo(0,ENEMY_Y));
						SlowRD-=1;
					}
					if(((GetPlayerY-GetEnemyInfo(0,ENEMY_Y))^2+(GetPlayerX-GetEnemyInfo(0,ENEMY_X))^2)^0.5<56)
					{
						Obj_SetPosition(obj,GetPlayerX+56*cos(CameraAngle),GetPlayerY+56*sin(CameraAngle));
						SlowRD-=1;
					}
				}
			}
			else if(SlowRD>0)
			{
				SlowRD-=1;
			}
			//以下ファインダーモード
			if(FinderMode==true)
			{
				ascent(let i in 0..4)
				{//ファインダーモード時は見えないように
					ObjEffect_SetVertexColor(obj,i,0,255,255,255);
				}
				while(FinderMode==true){wait(1);}
				//これ以下は撮影後手元に戻るまでのコード
				ascent(let i in 0..4)
				{
					ObjEffect_SetVertexColor(obj,i,100,255,200,200);
				}
				let posX=Obj_GetX(obj);
				let posY=Obj_GetY(obj);
				loop(60)
				{
					ObjEffect_SetAngle(obj,0,0,CameraAngle+CameraDir+AngleAdjust);
					if(Charge==100)
					{
						ObjEffect_SetScale(obj, scax-0.2+0.1*cos(ScAngle),scay-0.2+0.1*cos(ScAngle));
					}
					else
					{
						ObjEffect_SetScale(obj, scax-0.3+0.1*cos(ScAngle),scay-0.3+0.1*cos(ScAngle));
					}
					ScAngle+=10;
					if((KeyStateShot=="PUSH" || KeyStateShot=="HOLD") && (KeyStateSlowMove=="KEY_PUSH" || KeyStateSlowMove=="HOLD") && Charge!=100)
					{
						if(ChargeAdjust>-48)
						{
							ChargeAdjust-=9.6;
						}
						SlowRD=0;
					}
					else if((KeyStateShot=="PUSH" || KeyStateShot=="HOLD") && (KeyStateSlowMove=="KEY_PUSH" || KeyStateSlowMove=="HOLD") && Charge==100)
					{
						SlowRD=0;
						ChargeAdjust=0;
					}
					else
					{
						ChargeAdjust=0;
					}
					if(KeyStateSlowMove=="PUSH" || KeyStateSlowMove=="HOLD")
					{
						if(SlowRD<40)
						{
						SlowRD+=1;
						}
					}
					else if(SlowRD>0)
					{
						SlowRD-=1;
					}
				wait(1);
				}

				loop(10)
				{
					if(Charge==100)
					{
						ObjEffect_SetScale(obj, scax-0.2+0.1*cos(ScAngle),scay-0.2+0.1*cos(ScAngle));
					}
					else
					{
						ObjEffect_SetScale(obj, scax-0.3+0.1*cos(ScAngle),scay-0.3+0.1*cos(ScAngle));
					}
					ScAngle+=10;

					if((KeyStateShot=="PUSH" || KeyStateShot=="HOLD") && (KeyStateSlowMove=="KEY_PUSH" || KeyStateSlowMove=="HOLD") && Charge!=100)
					{
						Obj_SetPosition(obj,Obj_GetX(obj)+(GetPlayerX+(CameraRD+ChargeAdjust)*cos(CameraAngle)-posX)/10,Obj_GetY(obj)+(GetPlayerY+(CameraRD+ChargeAdjust)*sin(CameraAngle)-posY)/10);
						ObjEffect_SetAngle(obj,0,0,CameraAngle+CameraDir+AngleAdjust);
						if(ChargeAdjust>-48)
						{
							ChargeAdjust-=9.6;
						}
						SlowRD=0;
					}
					else if((KeyStateShot=="PUSH" || KeyStateShot=="HOLD") && (KeyStateSlowMove=="KEY_PUSH" || KeyStateSlowMove=="HOLD")  && Charge==100)
					{
						Obj_SetPosition(obj,Obj_GetX(obj)+(GetPlayerX+55*cos(CameraAngle)-posX)/10,Obj_GetY(obj)+(GetPlayerY+55*sin(CameraAngle)-posY)/10);
						ObjEffect_SetAngle(obj,0,0,CameraAngle+CameraDir+AngleAdjust);
						SlowRD=0;
						ChargeAdjust=0;
					}
					else
					{
						Obj_SetPosition(obj,Obj_GetX(obj)+(GetPlayerX+(CameraRD+SlowRD)*cos(CameraAngle)-posX)/10,Obj_GetY(obj)+(GetPlayerY+(CameraRD+SlowRD)*sin(CameraAngle)-posY)/10);
						ObjEffect_SetAngle(obj,0,0,CameraAngle+CameraDir+AngleAdjust);
						ChargeAdjust=0;
					}
					if(KeyStateSlowMove=="PUSH" || KeyStateSlowMove=="HOLD")
					{
						if(SlowRD<40)
						{
						SlowRD+=1;
						}
					}
					else if(SlowRD>0)
					{
						SlowRD-=1;
					}

					wait(1);
				}
			}
			if(GetCommonDataDefault("BunSpell",false)==true)
			{//即撮影でボスが撮れるとき色変更。専用スペルかどうかでボスＩＤが変わるため場合わけ
				if(Charge>=100 && Collision_Line_Circle(Obj_GetX(obj)-(CameraWide/2-8)*cos(CameraAngle+CameraDir-90),Obj_GetY(obj)-(CameraWide/2-8)*sin(CameraAngle+CameraDir-90),Obj_GetX(obj)+(CameraWide/2-8)*cos(CameraAngle+CameraDir-90),Obj_GetY(obj)+(CameraWide/2-8)*sin(CameraAngle+CameraDir-90),(CameraLong-8*2),GetEnemyInfo(1,ENEMY_X),GetEnemyInfo(1,ENEMY_Y),0))
				{	
					ObjEffect_SetVertexUV(obj, 0,  300+RectLeft,  RectUp);
					ObjEffect_SetVertexUV(obj, 1,  300+RectRight, RectUp);
					ObjEffect_SetVertexUV(obj, 2, 300+RectRight,  RectDown);
					ObjEffect_SetVertexUV(obj, 3, 300+RectLeft, RectDown);
				}
				else
				{	
					ObjEffect_SetVertexUV(obj, 0,  RectLeft,  RectUp);
					ObjEffect_SetVertexUV(obj, 1,  RectRight, RectUp);
					ObjEffect_SetVertexUV(obj, 2, RectRight,  RectDown);
					ObjEffect_SetVertexUV(obj, 3, RectLeft, RectDown);
				}
			}
			else
			{
					ObjEffect_SetVertexUV(obj, 0,  RectLeft,  RectUp);
					ObjEffect_SetVertexUV(obj, 1,  RectRight, RectUp);
					ObjEffect_SetVertexUV(obj, 2, RectRight,  RectDown);
					ObjEffect_SetVertexUV(obj, 3, RectLeft, RectDown);
				ascent(let enemy in EnumEnemyBegin .. EnumEnemyEnd)
				{
					let enemyID = EnumEnemyGetID(enemy);
					if(Charge>=100 && Collision_Line_Circle(Obj_GetX(obj)-((CameraWide/2-8))*cos(CameraAngle+CameraDir-90),Obj_GetY(obj)-((CameraWide/2-8))*sin(CameraAngle+CameraDir-90),Obj_GetX(obj)+((CameraWide/2-8))*cos(CameraAngle+CameraDir-90),Obj_GetY(obj)+((CameraWide/2-8))*sin(CameraAngle+CameraDir-90),(CameraLong-8*2),GetEnemyInfo(enemyID,ENEMY_X),GetEnemyInfo(enemyID,ENEMY_Y),0))
					{//撮影内に敵がいる場合
					ObjEffect_SetVertexUV(obj, 0,  300+RectLeft,  RectUp);
					ObjEffect_SetVertexUV(obj, 1,  300+RectRight, RectUp);
					ObjEffect_SetVertexUV(obj, 2, 300+RectRight,  RectDown);
					ObjEffect_SetVertexUV(obj, 3, 300+RectLeft, RectDown);
					}
				}
			}
			wait(1);
		}
}

task ChargeDicrease//装填率を減少させる。タイムアウトまでの時間を表示させるために使用
{
	wait(8);
	loop(20)
	{
		if(KeyStateShot=="PULL" || FinderMode==false){break;}
		Charge-=5;
		wait(1);
	}
	if(GetPlayerScriptName=="AYA.txt")
	{
		Charge=0;
	}
	if(GetPlayerScriptName=="HATATE.txt")
	{
		Charge-=45;//何故か1Ｆ遅れているので＋5
		if(Charge>50){Charge=50;}
		if(Charge<0){Charge=0;}
	}
}

task FinderScale(Cobj,angle)//ファインダーモード時の４隅枠の動作、写真を取る時の殆ど黒のテクスチャもここ
{
		let scax=1.0*4/3;
		let scay=1.0;

		let dis=((CameraLong/2-25.2)^2+(CameraWide/2-16.8)^2)^0.5;

		let finderangle=atan(-CameraWide/CameraLong)+CameraDir-90;
		let obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj, imgCamera);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj, 4);

		ObjEffect_SetVertexXY(obj, 1, -24, -24);
		ObjEffect_SetVertexXY(obj, 0, 24,  -24);
		ObjEffect_SetVertexXY(obj, 3, 24, 24);
		ObjEffect_SetVertexXY(obj, 2,  -24,  24);

		ObjEffect_SetVertexUV(obj, 0,  0,  0);
		ObjEffect_SetVertexUV(obj, 1,  120, 0);
		ObjEffect_SetVertexUV(obj, 2, 120,  80);
		ObjEffect_SetVertexUV(obj, 3, 0, 80);

		ObjEffect_SetScale(obj, scax,scay);
		ObjEffect_SetAngle(obj,0,0,angle+CameraDir);
		ObjEffect_SetLayer(obj,6);
////////////////////////////////////////////////////////////////////////////
		let finderangle2=atan(CameraWide/CameraLong)+CameraDir-90;
		let obj2=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj2, imgCamera);
		ObjEffect_SetPrimitiveType(obj2, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj2, ADD); 
		ObjEffect_CreateVertex(obj2, 4);

		ObjEffect_SetVertexXY(obj2, 1, -24, -24);
		ObjEffect_SetVertexXY(obj2, 0, 24,  -24);
		ObjEffect_SetVertexXY(obj2, 3, 24, 24);
		ObjEffect_SetVertexXY(obj2, 2,  -24,  24);
	
		ObjEffect_SetVertexUV(obj2, 0,  0,  0);
		ObjEffect_SetVertexUV(obj2, 1,  120, 0);
		ObjEffect_SetVertexUV(obj2, 2, 120,  80);
		ObjEffect_SetVertexUV(obj2, 3, 0, 80);

		ObjEffect_SetScale(obj2, scax,scay);
		ObjEffect_SetAngle(obj2,0,0,angle+CameraDir);
		ObjEffect_SetLayer(obj2,6);

		ObjEffect_SetScale(obj2, scax,scay);
		ObjEffect_SetAngle(obj2,180,0,-angle-CameraDir);
		ObjEffect_SetLayer(obj2,6);
///////////////////////////////////////////////////////////////////////////////////////////
		let finderangle3=atan(-CameraWide/CameraLong)+180+CameraDir-90;
		let obj3=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj3, imgCamera);
		ObjEffect_SetPrimitiveType(obj3, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj3, ADD); 
		ObjEffect_CreateVertex(obj3, 4);

		ObjEffect_SetVertexXY(obj3, 1, -24, -24);
		ObjEffect_SetVertexXY(obj3, 0, 24,  -24);
		ObjEffect_SetVertexXY(obj3, 3, 24, 24);
		ObjEffect_SetVertexXY(obj3, 2,  -24,  24);
	
		ObjEffect_SetVertexUV(obj3, 0,  0,  0);
		ObjEffect_SetVertexUV(obj3, 1,  120, 0);
		ObjEffect_SetVertexUV(obj3, 2, 120,  80);
		ObjEffect_SetVertexUV(obj3, 3, 0, 80);

	

		ObjEffect_SetScale(obj3, scax,scay);
		ObjEffect_SetAngle(obj3,0,0,angle+CameraDir+180);
		ObjEffect_SetLayer(obj3,6);
///////////////////////////////////////////////////////////////////////////////////////////
		let finderangle4=atan(CameraWide/CameraLong)+180+CameraDir-90;
		let obj4=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj4, imgCamera);
		ObjEffect_SetPrimitiveType(obj4, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj4, ADD); 
		ObjEffect_CreateVertex(obj4, 4);

		ObjEffect_SetVertexXY(obj4, 1, -24, -24);
		ObjEffect_SetVertexXY(obj4, 0, 24,  -24);
		ObjEffect_SetVertexXY(obj4, 3, 24, 24);
		ObjEffect_SetVertexXY(obj4, 2,  -24,  24);
	
		ObjEffect_SetVertexUV(obj4, 0,  0,  0);
		ObjEffect_SetVertexUV(obj4, 1,  120, 0);
		ObjEffect_SetVertexUV(obj4, 2, 120,  80);
		ObjEffect_SetVertexUV(obj4, 3, 0, 80);

		ObjEffect_SetScale(obj4, scax,scay);
		ObjEffect_SetAngle(obj4,0,180,-angle-CameraDir);
		ObjEffect_SetLayer(obj4,6);
///////////////////////////////////////////////////////////////////////////////////////////
		let BGscax=4.5;
		let BGscay=3.5;
		let finderangle5=atan(CameraWide/CameraLong)+180+CameraDir-90;
		let obj5=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj5, CameraBack);
		ObjEffect_SetPrimitiveType(obj5, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj5, ADD); 
	//	ObjEffect_SetRenderState(obj5, MULTIPLY); 
		ObjEffect_CreateVertex(obj5, 4);

		ObjEffect_SetVertexXY(obj5, 0, -1280, -1280);
		ObjEffect_SetVertexXY(obj5, 1, 1280,  -1280);
		ObjEffect_SetVertexXY(obj5, 2, 1280, 1280);
		ObjEffect_SetVertexXY(obj5, 3,  -1280,  1280);
		
		ObjEffect_SetVertexUV(obj5, 0,  0,  0);
		ObjEffect_SetVertexUV(obj5, 1,  256, 0);
		ObjEffect_SetVertexUV(obj5, 2, 256,  256);
		ObjEffect_SetVertexUV(obj5, 3, 0, 256);


		ObjEffect_SetScale(obj5, BGscax,BGscay);
		ObjEffect_SetAngle(obj5,0,0,angle+CameraDir);
		ObjEffect_SetLayer(obj5,6);
		Obj_SetPosition(obj5,Obj_GetX(Cobj),Obj_GetY(Cobj));
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj5,i,100,255,255,255);
				ObjEffect_SetVertexColor(obj,i,150,255,255,255);
				ObjEffect_SetVertexColor(obj2,i,150,255,255,255);
				ObjEffect_SetVertexColor(obj3,i,150,255,255,255);
				ObjEffect_SetVertexColor(obj4,i,150,255,255,255);
			}
////////////////////////////////////////////////////////////////////////////////////////////////////
		let BGscax2=CameraLong/50;
		let BGscay2=CameraWide/50;
		let obj9=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj9,ShootBack);
		ObjEffect_SetPrimitiveType(obj9, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj9, SUBTRACT); 
		ObjEffect_CreateVertex(obj9, 4);

		ObjEffect_SetVertexXY(obj9, 0, -512, -512);
		ObjEffect_SetVertexXY(obj9, 1, 512,  -512);
		ObjEffect_SetVertexXY(obj9, 2, 512, 512);
		ObjEffect_SetVertexXY(obj9, 3,  -512, 512);
		
		ObjEffect_SetVertexUV(obj9, 0,  0,  0);
		ObjEffect_SetVertexUV(obj9, 1,  1024, 0);
		ObjEffect_SetVertexUV(obj9, 2, 1024, 1024);
		ObjEffect_SetVertexUV(obj9, 3, 0, 1024);

		ObjEffect_SetScale(obj9, BGscax2,BGscay2);
		ObjEffect_SetAngle(obj9,0,0,angle+CameraDir);
		ObjEffect_SetLayer(obj9,4);
		Obj_SetPosition(obj9,Obj_GetX(Cobj),Obj_GetY(Cobj));
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj9,i,150,255,255,255);
			}

///////////////////////////////////////////////////////////////////////////////////////
		let ringx=1.0;
		let ringy=1.0;
		let finderangle6=atan(192/256)+180+CameraDir-90;
		let obj6=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj6, imgCamera);
		ObjEffect_SetPrimitiveType(obj6, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj6, ADD); 
		ObjEffect_CreateVertex(obj6, 4);

		ObjEffect_SetVertexXY(obj6, 1, -100, -100);
		ObjEffect_SetVertexXY(obj6, 0, 100,  -100);
		ObjEffect_SetVertexXY(obj6, 3, 100, 100);
		ObjEffect_SetVertexXY(obj6, 2,  -100,  100);
		
		ObjEffect_SetVertexUV(obj6, 0,  0,  180);
		ObjEffect_SetVertexUV(obj6, 1,  300, 180);
		ObjEffect_SetVertexUV(obj6, 2, 300,  480);
		ObjEffect_SetVertexUV(obj6, 3, 0, 480);

		ObjEffect_SetScale(obj6, ringx,ringy);
		ObjEffect_SetAngle(obj6,0,180,-angle-CameraDir);
		ObjEffect_SetLayer(obj6,6);
		Obj_SetPosition(obj6,Obj_GetX(Cobj),Obj_GetY(Cobj));
///////////////////////////////////////////////////////////////////////////
	let size=1;
	let CameraRadius=CameraWide/2;
	let CameraRadius2=CameraWide/2;
		ObjEffect_SetLayer(obj,4);
		ObjEffect_SetLayer(obj2,4);
		ObjEffect_SetLayer(obj3,4);
		ObjEffect_SetLayer(obj4,4);
		ObjEffect_SetLayer(obj5,4);
		ObjEffect_SetLayer(obj6,4);
		ObjEffect_SetLayer(obj9,4);
////////////////////////////////////////////////////////////////////////////////////
		ascent(let i in 0..29)
		{
			if(FinderMode==true)
			{
				Obj_SetPosition(obj,Obj_GetX(Cobj)+dis*cos(finderangle+angle-270),Obj_GetY(Cobj)+dis*sin(finderangle+angle-270));
				Obj_SetPosition(obj2,Obj_GetX(Cobj)+dis*cos(finderangle2+angle-270),Obj_GetY(Cobj)+dis*sin(finderangle2+angle-270));
				Obj_SetPosition(obj3,Obj_GetX(Cobj)+dis*cos(finderangle3+angle-270),Obj_GetY(Cobj)+dis*sin(finderangle3+angle-270));
				Obj_SetPosition(obj4,Obj_GetX(Cobj)+dis*cos(finderangle4+angle-270),Obj_GetY(Cobj)+dis*sin(finderangle4+angle-270));
				Obj_SetPosition(obj5,Obj_GetX(Cobj),Obj_GetY(Cobj));
				Obj_SetPosition(obj6,Obj_GetX(Cobj),Obj_GetY(Cobj));
				Obj_SetPosition(obj9,Obj_GetX(Cobj),Obj_GetY(Cobj));
				ObjEffect_SetScale(obj5, BGscax,BGscay);
				ObjEffect_SetScale(obj9, BGscax2*size,BGscay2*size);
				Obj_SetPosition(obj6,Obj_GetX(Cobj),Obj_GetY(Cobj));
				ObjEffect_SetScale(obj6, ringx,ringy);
			}
			if(KeyStateShot=="PULL")
			{
				Obj_Delete(obj);
				Obj_Delete(obj2);
				Obj_Delete(obj3);
				Obj_Delete(obj4);
				Obj_Delete(obj6);
				SetCommonData("Shooting",true);//撮影する合図、これを元に他の表示が一時的に消えたりする
				wait(7);
				SetCommonData("Shooting",false);
				Obj_Delete(obj5);
				Obj_Delete(obj9);
				break;

			}
			if(i>=9)
			{
				BGscax-=(4.5*2/3)/20;
				BGscay-=(3.5*2/3)/20;
				ringx-=1/20;
				ringy-=1/20;
				CameraRadius2=CameraRadius-CameraShrinkage*(i-8);
				size=CameraRadius2/CameraRadius;
				dis=((CameraLong/2*size-25.2)^2+(CameraWide/2*size-16.8)^2)^0.5;
			}
			if(GetCommonDataDefault("BunSpell",false)==true)//専用スペルかどうかで場合わけ
			{//以下撮影範囲にいるかどうかで色が変わるコード
				if(Collision_Line_Circle(Obj_GetX(Cobj)-(CameraWide/2-8)*size*cos(angle+CameraDir-90),Obj_GetY(Cobj)-(CameraWide/2-8)*size*sin(angle+CameraDir-90),Obj_GetX(Cobj)+(CameraWide/2-8)*size*cos(angle+CameraDir-90),Obj_GetY(Cobj)+(CameraWide/2-8)*size*sin(angle+CameraDir-90),(CameraLong-8*2)*size,GetEnemyInfo(1,ENEMY_X),GetEnemyInfo(1,ENEMY_Y),0))
				{
					ObjEffect_SetVertexUV(obj, 0,  300,  0);
					ObjEffect_SetVertexUV(obj, 1,  420, 0);
					ObjEffect_SetVertexUV(obj, 2, 420,  80);
					ObjEffect_SetVertexUV(obj, 3, 300, 80);
					ObjEffect_SetVertexUV(obj2, 0,  300,  0);
					ObjEffect_SetVertexUV(obj2, 1,  420, 0);
					ObjEffect_SetVertexUV(obj2, 2, 420,  80);
					ObjEffect_SetVertexUV(obj2, 3, 300, 80);
					ObjEffect_SetVertexUV(obj3, 0,  300,  0);
					ObjEffect_SetVertexUV(obj3, 1,  420, 0);
					ObjEffect_SetVertexUV(obj3, 2, 420,  80);
					ObjEffect_SetVertexUV(obj3, 3, 300, 80);
					ObjEffect_SetVertexUV(obj4, 0,  300,  0);
					ObjEffect_SetVertexUV(obj4, 1,  420, 0);
					ObjEffect_SetVertexUV(obj4, 2, 420,  80);
					ObjEffect_SetVertexUV(obj4, 3, 300, 80);
					ObjEffect_SetVertexUV(obj6, 0,  300,  180);
					ObjEffect_SetVertexUV(obj6, 1,  600, 180);
					ObjEffect_SetVertexUV(obj6, 2, 600,  480);
					ObjEffect_SetVertexUV(obj6, 3, 300, 480);
				}
				else
				{
					ObjEffect_SetVertexUV(obj, 0,  0,  0);
					ObjEffect_SetVertexUV(obj, 1,  120, 0);
					ObjEffect_SetVertexUV(obj, 2, 120,  80);
					ObjEffect_SetVertexUV(obj, 3, 0, 80);
					ObjEffect_SetVertexUV(obj2, 0,  0,  0);
					ObjEffect_SetVertexUV(obj2, 1,  120, 0);
					ObjEffect_SetVertexUV(obj2, 2, 120,  80);
					ObjEffect_SetVertexUV(obj2, 3, 0, 80);
					ObjEffect_SetVertexUV(obj3, 0,  0,  0);
					ObjEffect_SetVertexUV(obj3, 1,  120, 0);
					ObjEffect_SetVertexUV(obj3, 2, 120,  80);
					ObjEffect_SetVertexUV(obj3, 3, 0, 80);
					ObjEffect_SetVertexUV(obj4, 0,  0,  0);
					ObjEffect_SetVertexUV(obj4, 1,  120, 0);
					ObjEffect_SetVertexUV(obj4, 2, 120,  80);
					ObjEffect_SetVertexUV(obj4, 3, 0, 80);
					ObjEffect_SetVertexUV(obj6, 0,  0,  180);
					ObjEffect_SetVertexUV(obj6, 1,  300, 180);
					ObjEffect_SetVertexUV(obj6, 2, 300,  480);
					ObjEffect_SetVertexUV(obj6, 3, 0, 480);
				}
			}
			else
			{
					ObjEffect_SetVertexUV(obj, 0,  0,  0);
					ObjEffect_SetVertexUV(obj, 1,  120, 0);
					ObjEffect_SetVertexUV(obj, 2, 120,  80);
					ObjEffect_SetVertexUV(obj, 3, 0, 80);
					ObjEffect_SetVertexUV(obj2, 0,  0,  0);
					ObjEffect_SetVertexUV(obj2, 1,  120, 0);
					ObjEffect_SetVertexUV(obj2, 2, 120,  80);
					ObjEffect_SetVertexUV(obj2, 3, 0, 80);
					ObjEffect_SetVertexUV(obj3, 0,  0,  0);
					ObjEffect_SetVertexUV(obj3, 1,  120, 0);
					ObjEffect_SetVertexUV(obj3, 2, 120,  80);
					ObjEffect_SetVertexUV(obj3, 3, 0, 80);
					ObjEffect_SetVertexUV(obj4, 0,  0,  0);
					ObjEffect_SetVertexUV(obj4, 1,  120, 0);
					ObjEffect_SetVertexUV(obj4, 2, 120,  80);
					ObjEffect_SetVertexUV(obj4, 3, 0, 80);
					ObjEffect_SetVertexUV(obj6, 0,  0,  180);
					ObjEffect_SetVertexUV(obj6, 1,  300, 180);
					ObjEffect_SetVertexUV(obj6, 2, 300,  480);
					ObjEffect_SetVertexUV(obj6, 3, 0, 480);
				ascent(let enemy in EnumEnemyBegin .. EnumEnemyEnd)
				{
					let enemyID = EnumEnemyGetID(enemy);
					if(Collision_Line_Circle(Obj_GetX(Cobj)-((CameraWide/2-8)*size)*cos(angle+CameraDir-90),Obj_GetY(Cobj)-((CameraWide/2-8)*size)*sin(angle+CameraDir-90),Obj_GetX(Cobj)+((CameraWide/2-8)*size)*cos(angle+CameraDir-90),Obj_GetY(Cobj)+((CameraWide/2-8)*size)*sin(angle+CameraDir-90),(CameraLong-8*2)*size,GetEnemyInfo(enemyID,ENEMY_X),GetEnemyInfo(enemyID,ENEMY_Y),0))
					{//撮影内に敵がいる場合
					ObjEffect_SetVertexUV(obj, 0,  300,  0);
					ObjEffect_SetVertexUV(obj, 1,  420, 0);
					ObjEffect_SetVertexUV(obj, 2, 420,  80);
					ObjEffect_SetVertexUV(obj, 3, 300, 80);
					ObjEffect_SetVertexUV(obj2, 0,  300,  0);
					ObjEffect_SetVertexUV(obj2, 1,  420, 0);
					ObjEffect_SetVertexUV(obj2, 2, 420,  80);
					ObjEffect_SetVertexUV(obj2, 3, 300, 80);
					ObjEffect_SetVertexUV(obj3, 0,  300,  0);
					ObjEffect_SetVertexUV(obj3, 1,  420, 0);
					ObjEffect_SetVertexUV(obj3, 2, 420,  80);
					ObjEffect_SetVertexUV(obj3, 3, 300, 80);
					ObjEffect_SetVertexUV(obj4, 0,  300,  0);
					ObjEffect_SetVertexUV(obj4, 1,  420, 0);
					ObjEffect_SetVertexUV(obj4, 2, 420,  80);
					ObjEffect_SetVertexUV(obj4, 3, 300, 80);
					ObjEffect_SetVertexUV(obj6, 0,  300,  180);
					ObjEffect_SetVertexUV(obj6, 1,  600, 180);
					ObjEffect_SetVertexUV(obj6, 2, 600,  480);
					ObjEffect_SetVertexUV(obj6, 3, 300, 480);
					}
				}
			}
			wait(1);	
		}

		let ad=0;
		loop(30)
		{
				ObjEffect_SetAngle(obj,0,0,angle+CameraDir+ad);
				ObjEffect_SetAngle(obj2,180,0,-angle-CameraDir+ad);
				ObjEffect_SetAngle(obj3,0,0,angle+CameraDir+180+ad);
				ObjEffect_SetAngle(obj4,0,180,-angle-CameraDir+ad);
				ad+=12;
			wait(1);
		}

		Obj_Delete(obj);
		Obj_Delete(obj2);
		Obj_Delete(obj3);
		Obj_Delete(obj4);
		Obj_Delete(obj5);
		Obj_Delete(obj6);
		Obj_Delete(obj9);
		if(FinderTimeOut){
		PlaySE(SE[0]);
		wait(10);
		DeleteSE(SE[0]);
}
}

task TFinderMode(obj)//ファインダーモードでのタスク
{
FinderScale(obj,CameraAngle);//撮影範囲を示すカメラ枠を表示
Slow(1);//ファインダーモード時は1/2倍速
FinderMode=true;
SpeedChange=true;
FinderTimeOut=true;

PlaySE(SE[6]);

ascent(let i in 0..29)
{
		if(KeyStateShot=="PULL")
		{
			FinderTimeOut=false;
			Shoot(obj,i,CameraAngle);//撮影タスク、iによって撮影範囲が変わる
			SpeedChange=false;
			wait(1);
			FinderMode=false;
			break;
		}
		//以下はキー入力でカメラが動くようにするコード＆画面外にする補正用コード（ascent中）
		if((KeyStateUp=="PUSH" || KeyStateUp=="HOLD") && KeyStateLeft=="FREE" && KeyStateRight=="FREE")
		{
			Obj_SetPosition(obj,Obj_GetX(obj),Obj_GetY(obj)-FinderSpeed);
		}
		else if((KeyStateDown=="PUSH" || KeyStateDown=="HOLD") && KeyStateLeft=="FREE" && KeyStateRight=="FREE")
		{
			Obj_SetPosition(obj,Obj_GetX(obj),Obj_GetY(obj)+FinderSpeed);
		}
		else if(KeyStateLeft=="PUSH" || KeyStateLeft=="HOLD")
		{
			if(KeyStateUp=="PUSH" || KeyStateUp=="HOLD")
			{
				Obj_SetPosition(obj,Obj_GetX(obj)-FinderSpeed*(2^0.5)/2,Obj_GetY(obj)-FinderSpeed*(2^0.5)/2);
			}
			else if(KeyStateDown=="PUSH" || KeyStateDown=="HOLD")
			{
				Obj_SetPosition(obj,Obj_GetX(obj)-FinderSpeed*(2^0.5)/2,Obj_GetY(obj)+FinderSpeed*(2^0.5)/2);
			}
			else
			{
				Obj_SetPosition(obj,Obj_GetX(obj)-FinderSpeed,Obj_GetY(obj));
			}
		}
		else if(KeyStateRight=="PUSH" || KeyStateRight=="HOLD")
		{
			if(KeyStateUp=="PUSH" || KeyStateUp=="HOLD")
			{
				Obj_SetPosition(obj,Obj_GetX(obj)+FinderSpeed*(2^0.5)/2,Obj_GetY(obj)-FinderSpeed*(2^0.5)/2);
			}
			else if(KeyStateDown=="PUSH" || KeyStateDown=="HOLD")
			{
				Obj_SetPosition(obj,Obj_GetX(obj)+FinderSpeed*(2^0.5)/2,Obj_GetY(obj)+FinderSpeed*(2^0.5)/2);
			}
			else if(CameraAngle%360!=0)
			{
				Obj_SetPosition(obj,Obj_GetX(obj)+FinderSpeed,Obj_GetY(obj));
			}
		}
			if(Obj_GetX(obj)<=GetClipMinX)
			{
				Obj_SetX(obj,GetClipMinX);
			}
			if(Obj_GetX(obj)>=GetClipMaxX)
			{
				Obj_SetX(obj,GetClipMaxX);
			}
			if(Obj_GetY(obj)<=GetClipMinY)
			{
				Obj_SetY(obj,GetClipMinY);
			}
			if(Obj_GetY(obj)>=GetClipMaxY)
			{
				Obj_SetY(obj,GetClipMaxY);
			}
wait(1);
}

DeleteSE(SE[6]);

if(FinderTimeOut==true)
{
	ShootTimeOut;//撮影しなかった（時間切れ）で呼びだす
	SpeedChange=false;
	wait(1);
	FinderMode=false;
}
Slow(0);
wait(40);

FinderTimeOut=false;
}


task Shoot(Cobj,time,CAngle)//弾を消したりするタスク、弾の数の判定もしている（精度悪い）
{
	deleteShotTotal=0;
	deleteShotTotal2=0;

	let size=1;
	let finderangle=atan(CameraWide/CameraLong)+180+CameraDir-90;

	let dis2=((CameraWide/2)^2+(CameraLong/2)^2)^0.5;
	let CameraRadius=CameraWide/2;
	let CameraRadius2=CameraWide/2;

	let SuccessChargeLimit;
	let FailChargeLimit;
	if(CameraWide==192)
	{
		SuccessChargeLimit=35;
		FailChargeLimit=55;
	}
	if(CameraWide==144)
	{
		SuccessChargeLimit=60;
		FailChargeLimit=75;
	}

	if(time>=9)
	{
		CameraRadius2=CameraRadius-CameraShrinkage*(time-8);
		size=CameraRadius2/CameraRadius;
		dis2=((CameraWide/2*size)^2+(CameraLong/2*size)^2)^0.5;
	}

	let GradBasePoint=0;

	SaveSnapShot("snapshot\"~snapFile[photoNo%20]~".bmp",0,0,448,480);

	NiceBonusNum=GetCommonDataDefault("NiceShot",0);

	SetCommonData("CD_photoNo",photoNo);
	SetCommonData("CD_dis2",dis2);
	SetCommonData("CD_finderangle",finderangle);
	SetCommonData("CameraPositionX",Obj_GetX(Cobj));
	SetCommonData("CameraPositionY",Obj_GetY(Cobj));
	SetCommonData("CameraLong",CameraLong);
	SetCommonData("CameraWide",CameraWide);
	SetCommonData("CameraRadius",CameraWide/2);
	SetCommonData("CameraAngle",CAngle);
	SetCommonData("CameraDir",CameraDir);
	SetCommonData("CameraSize",size);

	ascent(let enemy in EnumEnemyBegin .. EnumEnemyEnd)
	{
		let enemyID = EnumEnemyGetID(enemy);
		if(Collision_Line_Circle(Obj_GetX(Cobj)-((CameraWide/2-8)*size)*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)-((CameraWide/2-8)*size)*sin(CAngle+CameraDir-90),Obj_GetX(Cobj)+((CameraWide/2-8)*size)*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)+((CameraWide/2-8)*size)*sin(CAngle+CameraDir-90),(CameraLong-8*2)*size,GetEnemyInfo(enemyID,ENEMY_X),GetEnemyInfo(enemyID,ENEMY_Y),0))
		{//撮影内の敵全ての敵座標にダメージを与える透明弾を出す。特定のＩＤの敵に当たった時成功かどうかの変数が変わる
			if(GetEnemyInfo(enemyID,ENEMY_X)>GetClipMinX && GetEnemyInfo(enemyID,ENEMY_X)<GetClipMaxX && GetEnemyInfo(enemyID,ENEMY_Y)>GetClipMinY && GetEnemyInfo(enemyID,ENEMY_Y)<GetClipMaxY)
			{
				dummyshot(enemyID,GetEnemyInfo(enemyID,ENEMY_X),GetEnemyInfo(enemyID,ENEMY_Y));
			}
		}
	}

	wait(1);//スナップショットを取る時間&dummyshotのヒット確認
	SetCommonData("PlayerPhotoTimeStop",true);



	if(GetCommonDataDefault("GradScoreSystem",true))
	{//汎用スコアシステムを使用する場合。リスクボーナス,クリアショットを計算
		let RiskPoint=80*GetEnemyShotCountEx(GetPlayerX,GetPlayerY,50,ALL);
		if(RiskPoint>=2000){RiskPoint=2000;}
		SetCommonData("RiskPoint",RiskPoint);
		if(GetCommonDataDefault("BunSpell",false)==true)
		{
		SetCommonData("ClearShot",GetEnemyShotCountEx(GetEnemyInfo(1,ENEMY_X),GetEnemyInfo(1,ENEMY_Y),50,ALL));
		}
		else
		{
		SetCommonData("ClearShot",GetEnemyShotCountEx(GetEnemyInfo(0,ENEMY_X),GetEnemyInfo(0,ENEMY_Y),50,ALL));
		}
	}
///////////////////////////////////////////////////////////////////////////////////
task deleteBulletsProcess(Cobj,rad,angle,size)
{
	deleteBullets(Obj_GetX(Cobj)+(CameraLong/2-CameraWide/2)*size*cos(angle),Obj_GetY(Cobj)+(CameraLong/2-CameraWide/2)*size*sin(angle),rad*size,angle,size,1,0);
	wait(1);
	deleteBullets(Obj_GetX(Cobj)-(CameraLong/2-CameraWide/2)*size*cos(angle),Obj_GetY(Cobj)-(CameraLong/2-CameraWide/2)*size*sin(angle),rad*size,angle,size,2,0);
}


task deleteBullets(let dx,let dy,let rad,let angle,let size,let DeleteOrder,let num){
		if(DeleteOrder==1)
		{
		deleteShotTotal += GetEnemyShotCountEx(dx,dy,rad,ALL);
		ascent(i in 0..8){
			ascent(j in 0..12){
				let deleteShotNum = GetEnemyShotCountEx(dx,dy,rad,DefaultBullet[i*12+j]);
				deleteShotKind[j] = deleteShotKind[j] + deleteShotNum;
				deleteShotColor[i] = deleteShotColor[i] + deleteShotNum;
			}
		}
		DeleteEnemyShotImmediatelyInCircle(SHOT,dx,dy,rad);
		}
		if(DeleteOrder==2)
		{
		deleteShotTotal2 += GetEnemyShotCountEx(dx,dy,rad,ALL);
		ascent(i in 0..8){
			ascent(j in 0..12){
				let deleteShotNum2 = GetEnemyShotCountEx(dx,dy,rad,DefaultBullet[i*12+j]);
				deleteShotKind2[j] = deleteShotKind2[j] + deleteShotNum2;
				deleteShotColor2[i] = deleteShotColor2[i] + deleteShotNum2;
			}
		}
		DeleteEnemyShotImmediatelyInCircle(SHOT,dx,dy,rad);
		}
		wait(2);
		if(num < 2){
			rad = rad/2;
			ascent(i in 0..4){
				deleteBullets(dx +rad*cos(angle+45+i*90)*2^0.5,dy + rad*sin(angle+45+i*90)*2^0.5, rad,angle+i*90,size,DeleteOrder,num+1);
			}
		}
	}
////////////////////////////////////////////////////////////////////////////////////////
	if(BossCapture==true && GetCommonDataDefault("Playermissed",false)==false)
	{//dummyshotが当たった時。成功時のタスクと撮影した枚数を1増やす
		SetCommonData("SnapShootingToStage",true);
		Photo(photoNo,Cobj,CAngle,finderangle,dis2,size);
		photoNo++;
	//	BossCapture=false;
	}
	else
	{
		SetCommonData("SnapShootingToStageFalse",true);
		FalsePhoto(Cobj,CAngle,finderangle,dis2,size);
	}
	deleteBulletsProcess(Cobj,CameraWide/2,CAngle+CameraDir,size);
	SetCommonData("AllPhoto",GetCommonDataDefault("AllPhoto",0)+1);//撮影枚数+1、ステージ側で読むこむ
	PlaySE(SE[4]);

	TimeSlowEffect;//撮影した時のスロータスク
	Slow(0);

	wait(6);//弾消しタスクが終わるまで待つ時間

	if(GetCommonDataDefault("GradScoreSystem",true))
	{//汎用スコアシステムを使用する場合。弾点数計算、色計算、ベースポイント加算を行う
		//弾の種類別弾数から、それぞれの倍率に応じてGradBasePointに加算する
		let number = 0;
		ascent(i in 0..12){
			GradBasePoint += (deleteShotKind[i]+deleteShotKind2[i]) * shotPoint[i];
			number += deleteShotKind[i]+deleteShotKind2[i];
			deleteShotKind[i] = 0;
			deleteShotKind2[i] = 0;
		}
		let other = deleteShotTotal+deleteShotTotal2- number;
		GradBasePoint += other * shotPoint[12];
		//弾の色別弾数から共通データに数値を送る
		ascent(let i in 0..8)
		{
			SetCommonData(Color[i],GetCommonDataDefault(Color[i],0)+deleteShotColor[i]+deleteShotColor2[i]);
			deleteShotColor[i]=0;
			deleteShotColor2[i]=0;
		}

		SetCommonData("BasePoint",GetCommonDataDefault("BasePoint",0)+GradBasePoint);//ベースポイントを送る
	}

	if(BossCapture==true)
	{//dummyshotが当たった時。成功時の
	if(GetCommonDataDefault("BunSpell",false)==false)
	{
		loop((deleteShotTotal+deleteShotTotal2)/2)
		{//撮影内ランダム、カメラ中心からの角度を決定し発生させる。
			let rx=rand(Obj_GetX(Cobj)-(CameraLong/2)*size,Obj_GetX(Cobj)+(CameraLong/2)*size);
			let ry=rand(Obj_GetY(Cobj)-(CameraWide/2)*size,Obj_GetY(Cobj)+(CameraWide/2)*size);
			let rdis=((rx-Obj_GetX(Cobj))^2+(ry-Obj_GetY(Cobj))^2)^0.5;
			let rangle=atan2(ry-Obj_GetY(Cobj),rx-Obj_GetX(Cobj));
			ItemCreate(Cobj,photoNo,true,SuccessChargeLimit,Obj_GetX(Cobj)+rdis*cos(rangle+CAngle+CameraDir),Obj_GetY(Cobj)+rdis*sin(rangle+CAngle+CameraDir));
		}
	}
		ShootingSuccess=true;
		BossCapture=false;
	}
	else
	{
	if(GetCommonDataDefault("BunSpell",false)==false)
	{
		loop((deleteShotTotal+deleteShotTotal2)/2)
		{//撮影内ランダム、カメラ中心からの角度を決定し発生させる。
			let rx=rand(Obj_GetX(Cobj)-(CameraLong/2)*size,Obj_GetX(Cobj)+(CameraLong/2)*size);
			let ry=rand(Obj_GetY(Cobj)-(CameraWide/2)*size,Obj_GetY(Cobj)+(CameraWide/2)*size);
			let rdis=((rx-Obj_GetX(Cobj))^2+(ry-Obj_GetY(Cobj))^2)^0.5;
			let rangle=atan2(ry-Obj_GetY(Cobj),rx-Obj_GetX(Cobj));
			ItemCreate(Cobj,photoNo,false,FailChargeLimit,Obj_GetX(Cobj)+rdis*cos(rangle+CAngle+CameraDir),Obj_GetY(Cobj)+rdis*sin(rangle+CAngle+CameraDir));
		}
	}
		ShootingSuccess=false;
	}
}

task Photo(No,Cobj,CAngle,finderangle,dis2,size)//成功時の写真を取ってから収めるまでの動作。
{
	let imgPhoto = "snapshot\"~snapFile[photoNo%20]~".bmp";
		LoadGraphic(imgPhoto);//撮った写真から読み込む

		let scax=1;
		let scay=1;
	//以下カメラの中心から画面端までの距離と角度を設定
		let OriAngle1=atan2(GetClipMinX-Obj_GetX(Cobj),GetClipMinY-Obj_GetY(Cobj));
		let OriDis1=((GetClipMinX-Obj_GetX(Cobj))^2+((GetClipMinY-Obj_GetY(Cobj))^2))^0.5;
		let OriAngle2=atan2(GetClipMaxX-Obj_GetX(Cobj),GetClipMinY-Obj_GetY(Cobj));
		let OriDis2=((GetClipMaxX-Obj_GetX(Cobj))^2+((GetClipMinY-Obj_GetY(Cobj))^2))^0.5;
		let OriAngle3=atan2(GetClipMaxX-Obj_GetX(Cobj),GetClipMaxY-Obj_GetY(Cobj));
		let OriDis3=((GetClipMaxX-Obj_GetX(Cobj))^2+((GetClipMaxY-Obj_GetY(Cobj))^2))^0.5;
		let OriAngle4=atan2(GetClipMinX-Obj_GetX(Cobj),GetClipMaxY-Obj_GetY(Cobj));
		let OriDis4=((GetClipMinX-Obj_GetX(Cobj))^2+((GetClipMaxY-Obj_GetY(Cobj))^2))^0.5;

		let DX=GetClipMaxX+40+65*((photoNo%10)%3);//一般スペルの時の写真Ｘ座標
		let DY=GetCenterY+50+65*trunc((photoNo%10)/3);//一般スペルの時の写真Ｘ座標
		let SnapSize=0.2;//そのまま。写真のサイズ
		if(GetCommonDataDefault("BunSpell",false)==true)
		{
			SnapSize=0.4;
			if((photoNo%10)<=4)
			{
				DX=GetClipMaxX+70;
				DY=GetCenterY-170+(photoNo%10)*85;
			}
			else
			{
				DX=GetClipMaxX+155;
				DY=GetCenterY-170+((photoNo%10)-5)*85;
			}
		}

//X,Yはカメラの４頂点の座標。PX,PYはカメラの中心から頂点までの成分の絶対値。
		let X=[Obj_GetX(Cobj)+dxdy(0,0,dis2,finderangle,CAngle,size),Obj_GetX(Cobj)+dxdy(CameraLong,0,dis2,finderangle,CAngle,size),Obj_GetX(Cobj)+dxdy(CameraLong,CameraWide,dis2,finderangle,CAngle,size), Obj_GetX(Cobj)+dxdy(0,CameraWide,dis2,finderangle,CAngle,size), ];
		let Y=[Obj_GetY(Cobj)+dxdy2(0,0,dis2,finderangle,CAngle,size),Obj_GetY(Cobj)+dxdy2(CameraLong,0,dis2,finderangle,CAngle,size),Obj_GetY(Cobj)+dxdy2(CameraLong,CameraWide,dis2,finderangle,CAngle,size), Obj_GetY(Cobj)+dxdy2(0,CameraWide,dis2,finderangle,CAngle,size)];
		let PX=CameraLong/2*size;
		let PY=CameraWide/2*size;

		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 SelfPhoto=false;
		if(Collision_Line_Circle(Obj_GetX(Cobj)-(PY-12)*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)-(PY-12)*sin(CAngle+CameraDir-90),Obj_GetX(Cobj)+(PY-12)*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)+(PY-12)*sin(CAngle+CameraDir-90),(PX-12)*2,GetPlayerX,GetPlayerY,0))
		{//写真内に自分かいるかどうか判定
			SelfPhoto=true;
		}

		let ShootPlayerPositionX=GetPlayerX;
		let ShootPlayerPositionY=GetPlayerY;

		if(GetCommonDataDefault("BunSpell",false)==true)
		{
		loop(7){yield;}
		}

		let obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj, imgPhoto);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
	//	ObjEffect_SetRenderState(obj, ADD); 

//写真の切り取り方を決定するタスク。
		let CDAngle=CameraDir;
		ShootRange(obj,CAngle,CDAngle,X,Y,PX,PY,OriAngle1,OriDis1,OriAngle2,OriDis2,OriAngle3,OriDis3,OriAngle4,OriDis4);

		ObjEffect_SetScale(obj, scax,scay);
		ObjEffect_SetAngle(obj,0,0,CAngle+CameraDir);
		ObjEffect_SetLayer(obj,8);
		Obj_SetPosition(obj,Obj_GetX(Cobj),Obj_GetY(Cobj));


		/*	ObjEffect_SetVertexColor(obj,0,255,255,255,255);
			ObjEffect_SetVertexColor(obj,1,255,255,255,255);
			ObjEffect_SetVertexColor(obj,2,255,255,255,255);
			ObjEffect_SetVertexColor(obj,3,255,255,255,255);
*/
		let posX=Obj_GetX(obj);//徐々に移動させるために必要
		let posY=Obj_GetY(obj);
		let loopnum=10;//写真が規定座標に行くまでの時間スローのため体感時間は長いけど

		let SnapAngle=0;//回転させるための値

		Successed;//Successed!!と表示する

///////////////////////////////////////////////////////////////////////////////////
		let BGscax2=1.00;
		let BGscay2=1.00;
	//	let finderangle9=atan(1.15/1.5)+180+CameraDir-90;
		let obj9=Obj_Create(OBJ_EFFECT);
				ObjEffect_SetTexture(obj9, CameraBack2);
		ObjEffect_SetPrimitiveType(obj9, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj9, ADD); 
	//	ObjEffect_SetRenderState(obj9, MULTIPLY); 
		ObjEffect_CreateVertex(obj9, 16);

		let VertexX=PX/2;
		let VertexY=PY/2;

		ObjEffect_SetVertexXY(obj9, 0, -VertexX*2, -VertexY*2);
		ObjEffect_SetVertexXY(obj9, 1, -VertexX,  -VertexY*2);
		ObjEffect_SetVertexXY(obj9, 2, 0, -VertexY*2);
		ObjEffect_SetVertexXY(obj9, 3,  VertexX,  -VertexY*2);
		ObjEffect_SetVertexXY(obj9, 4, VertexX*2, -VertexY*2);
		ObjEffect_SetVertexXY(obj9, 5, VertexX*2,  -VertexY);
		ObjEffect_SetVertexXY(obj9, 6, VertexX*2, 0);
		ObjEffect_SetVertexXY(obj9, 7,  VertexX*2,  VertexY);
		ObjEffect_SetVertexXY(obj9, 8, VertexX*2, VertexY*2);
		ObjEffect_SetVertexXY(obj9, 9, VertexX,  VertexY*2);
		ObjEffect_SetVertexXY(obj9, 10, 0, VertexY*2);
		ObjEffect_SetVertexXY(obj9, 11,  -VertexX,  VertexY*2);
		ObjEffect_SetVertexXY(obj9, 12, -VertexX*2, VertexY*2);
		ObjEffect_SetVertexXY(obj9, 13, -VertexX*2,  VertexY);
		ObjEffect_SetVertexXY(obj9, 14, -VertexX*2, 0);
		ObjEffect_SetVertexXY(obj9, 15,  -VertexX*2,  -VertexY);

		ObjEffect_SetVertexUV(obj9, 0,  0,  0);
		ObjEffect_SetVertexUV(obj9, 1,  100, 0);
		ObjEffect_SetVertexUV(obj9, 2, 200,  0);
		ObjEffect_SetVertexUV(obj9, 3, 300, 0);
		ObjEffect_SetVertexUV(obj9, 4, 401,  0);
		ObjEffect_SetVertexUV(obj9, 5, 401,  100);
		ObjEffect_SetVertexUV(obj9, 6, 401, 200);
		ObjEffect_SetVertexUV(obj9, 7,  401,  300);
		ObjEffect_SetVertexUV(obj9, 8,  401, 401);
		ObjEffect_SetVertexUV(obj9, 9, 300,  401);
		ObjEffect_SetVertexUV(obj9, 10, 200, 401);
		ObjEffect_SetVertexUV(obj9, 11,  100,  401);
		ObjEffect_SetVertexUV(obj9, 12,  0, 401);
		ObjEffect_SetVertexUV(obj9, 13, 0,  300);
		ObjEffect_SetVertexUV(obj9, 14, 0, 200);
		ObjEffect_SetVertexUV(obj9, 15, 0, 100);

		ObjEffect_SetScale(obj9, BGscax2,BGscay2);
		ObjEffect_SetAngle(obj9,0,0,CAngle+CameraDir);
		ObjEffect_SetLayer(obj9,8);
		Obj_SetPosition(obj9,Obj_GetX(Cobj),Obj_GetY(Cobj));
			ascent(let i in 0..16)
			{
				ObjEffect_SetVertexColor(obj9,i,150,255,255,255);
			}
	ascent(let j in 0..4)
	{
		ascent(let i in 0..5)
		{
			if((X[j]*(5-i)+X[(j+1)%4]*i)/5<GetClipMinX || (Y[j]*(5-i)+Y[(j+1)%4]*i)/5<GetClipMinY || (X[j]*(5-i)+X[(j+1)%4]*i)/5>GetClipMaxX || (Y[j]*(5-i)+Y[(j+1)%4]*i)/5>GetClipMaxY)
			{
				ObjEffect_SetVertexColor(obj9,j*4+i,0,50,50,50);
			}
		}
	}
//////////////////////////////////////////////////////////////////////////
	if(GetCommonDataDefault("BunSpell",false)==false)
	{
		loop(loopnum)
		{
			Obj_SetPosition(obj,Obj_GetX(obj)+(DX-posX)/loopnum,Obj_GetY(obj)+(DY-posY)/loopnum);
			scax-=(1-SnapSize)/loopnum;
			scay-=(1-SnapSize)/loopnum;
			ObjEffect_SetScale(obj, scax,scay);
			SnapAngle+=360/loopnum;
			ObjEffect_SetAngle(obj,0,0,CAngle+CameraDir+SnapAngle);

			Obj_SetPosition(obj9,Obj_GetX(obj9)+(DX-posX)/loopnum,Obj_GetY(obj9)+(DY-posY)/loopnum);
			BGscax2-=(1-SnapSize)/loopnum;
			BGscay2-=(1-SnapSize)/loopnum;
			ObjEffect_SetScale(obj9, BGscax2,BGscay2);
			ObjEffect_SetAngle(obj9,0,0,CAngle+CameraDir+SnapAngle);

			wait(1);
		}
	}
			Obj_SetPosition(obj,DX,DY);
			Obj_SetPosition(obj9,DX,DY);
			scax=SnapSize;
			scay=SnapSize;
			ObjEffect_SetScale(obj, scax,scay);
			ObjEffect_SetScale(obj9, scax,scay);
			BGscax2-=SnapSize/loopnum;
			BGscay2-=SnapSize/loopnum;
		PlaySE(SE[1]);

PhotoSelectAndEraze(obj,obj9,No,DX,DY, scax,scay,imgPhoto);

AddShootingScore("AYA",Cobj,CAngle,PX,PY,No,SelfPhoto,Distance1,ShootPlayerPositionX,ShootPlayerPositionY);//スコア計算文とはたてで違うのはセルフショット判定
if(GetCommonDataDefault("BunSpell",false)==true)
{
loop
{
	if(GetCommonDataDefault("DetailShooting",false)==true)
	{
		ascent(let i in 0..16)
		{
			ObjEffect_SetVertexColor(obj,i,0,255,255,255);
			ObjEffect_SetVertexColor(obj9,i,0,255,255,255);
		}
	}
	else
	{
		ShootRange(obj,CAngle,CDAngle,X,Y,PX,PY,OriAngle1,OriDis1,OriAngle2,OriDis2,OriAngle3,OriDis3,OriAngle4,OriDis4);
		ascent(let i in 0..4)
		{
			ObjEffect_SetVertexColor(obj,i,255,255,255,255);
		}
		ascent(let i in 0..16)
		{
			ObjEffect_SetVertexColor(obj9,i,150,255,255,255);
		}
		ascent(let j in 0..4)
		{
			ascent(let i in 0..5)
			{
				if((X[j]*(5-i)+X[(j+1)%4]*i)/5<GetClipMinX || (Y[j]*(5-i)+Y[(j+1)%4]*i)/5<GetClipMinY || (X[j]*(5-i)+X[(j+1)%4]*i)/5>GetClipMaxX || (Y[j]*(5-i)+Y[(j+1)%4]*i)/5>GetClipMaxY)
				{
					ObjEffect_SetVertexColor(obj9,j*4+i,0,50,50,50);
				}
			}
		}
	}
yield;
}
}
}


task PhotoSelectAndEraze(obj,obj9,No,DX,DY, scax,scay,imgPhoto)
{
		while(photoNo<No+11)
		{//１１枚以上になったら１枚目から順に破棄。専用スペルではまず使わないはず。
			if(GetCommonDataDefault("ShootingEnd",false)==true)
			{
				PhotoSelect(obj,obj9,No,DX,DY, scax,scay);
			}
			if(GetCommonDataDefault("PhotoEraze",false)==true)
			{
				Obj_Delete(obj);
				break;
			}
		yield;
		}
		Obj_Delete(obj);
		Obj_Delete(obj9);
		DeleteGraphic(imgPhoto);
}

task FalsePhoto(Cobj,CAngle,finderangle,dis2,size)//失敗時の写真を取ってから捨てるまでの動作。
{//成功時と殆ど変わらない。BasePointを初期化すること
	let imgPhoto = "snapshot\"~snapFile[photoNo%20]~".bmp";
		LoadGraphic(imgPhoto);
		let scax=1;
		let scay=1;

		let X=[Obj_GetX(Cobj)+dxdy(0,0,dis2,finderangle,CAngle,size),Obj_GetX(Cobj)+dxdy(CameraLong,0,dis2,finderangle,CAngle,size),Obj_GetX(Cobj)+dxdy(CameraLong,CameraWide,dis2,finderangle,CAngle,size), Obj_GetX(Cobj)+dxdy(0,CameraWide,dis2,finderangle,CAngle,size), ];
		let Y=[Obj_GetY(Cobj)+dxdy2(0,0,dis2,finderangle,CAngle,size),Obj_GetY(Cobj)+dxdy2(CameraLong,0,dis2,finderangle,CAngle,size),Obj_GetY(Cobj)+dxdy2(CameraLong,CameraWide,dis2,finderangle,CAngle,size), Obj_GetY(Cobj)+dxdy2(0,CameraWide,dis2,finderangle,CAngle,size)];
		let PX=CameraLong/2*size;
		let PY=CameraWide/2*size;
		let OriAngle1=atan2(GetClipMinX-Obj_GetX(Cobj),GetClipMinY-Obj_GetY(Cobj));
		let OriDis1=((GetClipMinX-Obj_GetX(Cobj))^2+((GetClipMinY-Obj_GetY(Cobj))^2))^0.5;
		let OriAngle2=atan2(GetClipMaxX-Obj_GetX(Cobj),GetClipMinY-Obj_GetY(Cobj));
		let OriDis2=((GetClipMaxX-Obj_GetX(Cobj))^2+((GetClipMinY-Obj_GetY(Cobj))^2))^0.5;
		let OriAngle3=atan2(GetClipMaxX-Obj_GetX(Cobj),GetClipMaxY-Obj_GetY(Cobj));
		let OriDis3=((GetClipMaxX-Obj_GetX(Cobj))^2+((GetClipMaxY-Obj_GetY(Cobj))^2))^0.5;
		let OriAngle4=atan2(GetClipMinX-Obj_GetX(Cobj),GetClipMaxY-Obj_GetY(Cobj));
		let OriDis4=((GetClipMinX-Obj_GetX(Cobj))^2+((GetClipMaxY-Obj_GetY(Cobj))^2))^0.5;

		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 SelfPhoto=false;
		if(Collision_Line_Circle(Obj_GetX(Cobj)-(PY-12)*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)-(PY-12)*sin(CAngle+CameraDir-90),Obj_GetX(Cobj)+(PY-12)*cos(CAngle+CameraDir-90),Obj_GetY(Cobj)+(PY-12)*sin(CAngle+CameraDir-90),(PX-12)*2,GetPlayerX,GetPlayerY,0))
		{//写真内に自分かいるかどうか判定
			SelfPhoto=true;
		}

		let ShootPlayerPositionX=GetPlayerX;
		let ShootPlayerPositionY=GetPlayerY;
		if(GetCommonDataDefault("BunSpell",false)==true)
		{
			wait(10);
		}
		else
		{
		let obj=Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj, imgPhoto);
		ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
	//	ObjEffect_SetRenderState(obj, ADD); 
		ObjEffect_CreateVertex(obj, 4);
		let CDAngle=CameraDir;
		ShootRange(obj,CAngle,CDAngle,X,Y,PX,PY,OriAngle1,OriDis1,OriAngle2,OriDis2,OriAngle3,OriDis3,OriAngle4,OriDis4);

		ObjEffect_SetScale(obj, scax,scay);
		ObjEffect_SetAngle(obj,0,0,CAngle+CameraDir);
		ObjEffect_SetLayer(obj,8);
		Obj_SetPosition(obj,Obj_GetX(Cobj),Obj_GetY(Cobj));

		let DX=Obj_GetX(Cobj);
		let DY=Obj_GetY(Cobj)+60;
		let posX=Obj_GetX(obj);
		let posY=Obj_GetY(obj);
		let loopnum=10;
		let SnapAngle=0;

		loop(loopnum)
		{
			Obj_SetPosition(obj,Obj_GetX(obj)+(DX-posX)/loopnum,Obj_GetY(obj)+(DY-posY)/loopnum);
			ObjEffect_SetScale(obj, scax,scay);
			scax-=4/5/loopnum;
			scay-=4/5/loopnum;
			SnapAngle+=360/loopnum;
			ObjEffect_SetAngle(obj,0,0,CAngle+CameraDir+SnapAngle);
			wait(1);
		}
		Obj_Delete(obj);
		}
		AddShootingScore("AYA",Cobj,CAngle,PX,PY,-5,SelfPhoto,Distance1,ShootPlayerPositionX,ShootPlayerPositionY);//スコア計算文とはたてで違うのはセルフショット判定
		PlaySE(SE[0]);
		Failed;
		wait(10);
		DeleteSE(SE[0]);
		SetCommonData("BasePoint",0);
		wait(30);
		DeleteGraphic(imgPhoto);
}

task ItemCreate(Cobj,No,Success,ChargeLimit,x,y)//玉消ししたときに発生する。装填率を上げたりする
{
		if(No>=11)
		{
			No=10;
		}
	//	let judg=rand_int(0,1);
		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_SetScale(obj,1.2,1.2);
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,155,255,255,255);
			}	

		ObjEffect_SetLayer(obj,3);
		Obj_SetPosition(obj,x,y);
		let StandardSpeed=rand(2,6);
		let speed=StandardSpeed;
		let angle=rand(0,360);

		let lightangle=rand(0,360);
		let Scale=2;
		loop(15)
		{
			lightangle+=12;
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,55+50*cos(lightangle),255,255,255);
			}
			Obj_SetPosition(obj,Obj_GetX(obj)+speed*cos(angle),Obj_GetY(obj)+speed*sin(angle));
			speed-=StandardSpeed/15;
			Scale-=0.02;
			ObjEffect_SetScale(obj,Scale,Scale);
			wait(1);
		}
		let aspeed=0;

		let amp;
		if(Success)
		{
			if(GetCommonDataDefault("BunSpell",false)==true)
			{
				amp=1+(No-1)*1/9;
			}
			else
			{
				amp=1.5;
				if(GetCommonDataDefault("BunSpell",false)==false && IsBossExisting==false)
				{
					amp=4.5;
				}
			}
		}
		else
		{
			amp=10/3;
			if(GetCommonDataDefault("BunSpell",false)==false && IsBossExisting==false)
			{
				amp=10;
			}
		}
		while(!Obj_BeDeleted(obj))
		{
			Scale-=0.01;
			ObjEffect_SetScale(obj,Scale,Scale);
			if(speed<10)
			{
			speed+=0.25;
			}
			lightangle+=12;
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,55+25*cos(lightangle),255,255,255);
			}
			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(Charge<ChargeLimit)
					{
						Charge+=0.50/(10/3)*amp;
					}
					else 
					{
						Charge+=0;
					}
					if(rand_int(0,1)==0)
					{
						if(GetCommonDataDefault("LIGHTMODE",false)==true || PlayerLightMode==true)
						{
						}
						else
						{
							EffectItemCreate;
						}
					}
					PlaySE("seScore.wav");
					Obj_Delete(obj);
			}
		wait(1);
		}
		
}

let ShootingSuccess=false;

task CheckChargeItem
{
let ItemCheck=0;//共通データの配列の長さをチェックする変数
let XY=[];//共通データの書き換えにワンクッション置くための変数
let ItemPerFrame=600;//１フレームあたりの最大アイテム生成数（処理落ち対策）
let amp;
let ChargeLimit;
loop
{
	ItemCheck=length(GetCommonDataDefault("CHARGE",[]));//毎フレーム共通データの長さチェック
	if(ItemCheck>0)
	{//配列に中身がある（アイテム発生フラグ立っている）場合の処理
		loop(ItemPerFrame)
		{
			XY=GetCommonDataDefault("CHARGE",[]);//共通データ内容を変数に渡す

			if(ShootingSuccess)
			{
				amp=1+(photoNo-1)*1/9;
			}
			else
			{
				amp=10/3;
			}
			if(ShootingSuccess==true)
			{
				if(CameraWide==192)
				{
					ChargeLimit=35;
				}
				if(CameraWide==144)
				{
					ChargeLimit=60;
				}
			}
			else
			{
				if(CameraWide==192)
				{
					ChargeLimit=55;
				}
				if(CameraWide==144)
				{
					ChargeLimit=75;
				}
			}
					if(Charge<ChargeLimit)
					{
						Charge+=0.50/(10/3)*amp;
					}
					else 
					{
						Charge+=0;
					}
					if(rand_int(0,1)==0)
					{
						if(GetCommonDataDefault("LIGHTMODE",false)==true || PlayerLightMode==true)
						{
						}
						else
						{
							EffectItemCreate;
						}
					}
			loop(1)
			{
				XY=erase(XY, 0);
			}//生成したのでその要素を配列から削除
			if(length(XY)==0)
			{//削除後の配列が空になった場合
				SetCommonData("CHARGE",[]);//共通データを空にして
				break;//アイテム生成ループ脱出
		
			}
			else
			{
				SetCommonData("CHARGE",XY);
			}//配列が空でない場合共通データに変更後の配列を渡す
		}
	}
yield;
}
}

task AddShootingScore(Chara,Cobj,CAngle,PX,PY,No,SelfPhoto,Distance1,ShootPlayerPositionX,ShootPlayerPositionY)//写真のスコア計算及び加算
{
	let DrawX=GetCenterX;
	if(ShootPlayerPositionX<GetCenterX)
	{
		DrawX=GetCenterX;
	}
	else
	{
		DrawX=GetCenterX-160;
	}
		let DrawY=GetCenterY-125;//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)-ShootPlayerPositionX)^2+(GetEnemyInfo(1,ENEMY_Y)-ShootPlayerPositionY)^2)^0.5;

		if(!GetCommonDataDefault("BunSpell",false))
		{//専用スペルでないときはIDが０
			Dis=((GetEnemyInfo(0,ENEMY_X)-ShootPlayerPositionX)^2+(GetEnemyInfo(0,ENEMY_Y)-ShootPlayerPositionY)^2)^0.5;
		}

		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>=3 && 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)-ShootPlayerPositionY,GetEnemyInfo(1,ENEMY_X)-ShootPlayerPositionX)+360)%360;//角度により相対位置を判断する
		if(!GetCommonDataDefault("BunSpell",false))
		{//専用スペルでないときはIDが０
			PosAngle=(atan2(GetEnemyInfo(0,ENEMY_Y)-ShootPlayerPositionY,GetEnemyInfo(0,ENEMY_X)-ShootPlayerPositionX)+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(450*(60-Dis)/30+550);
				DrawShootBonus("MacroBonus",DrawX,DrawY,No);
				ShootBonumNumDraw(450*(60-Dis)/30+550,DrawX+100,DrawY,true,false,No);
				DrawY+=DrawYPlus;
			}
		}

		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;
		}

	}
	else
	{
		if(BasePoint==0 && SelfPhoto)
		{//ソロショット判定
			BasePoint+=100;
			DrawShootBonus("SoloShot",DrawX,DrawY,No);
			ShootBonumNumDraw(100,DrawX+100,DrawY,true,false,No);
			DrawY+=DrawYPlus;
		}
	}

		if(GetCommonDataDefault("OyajiBonus",0)==1)
		{//OyajiBonuisの判定。スペル側でOn,Offを設定
			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)
		{//CatBonuisの判定。スペル側でOn,Offを設定
			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 Distance2=95;//BossShotが１．２倍（最小）になるまでの距離
		let Adjust=0;
		if(Distance1<=8)
		{
			Adjust=1.0;
		}
		else if(Distance1>Distance2)
		{
			Adjust=0;
		}
		else
		{
			Adjust=(Distance2-Distance1)/(Distance2-8*PY/96);
		}
		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(SelfPhoto)
		{//写真内に自分かいるかどうか判定
			BasePoint=BasePoint*1.5;
			DrawShootBonus("TwoShot",DrawX,DrawY,No);
			ShootBonumNumDraw(150,DrawX+100,DrawY,false,true,No);
			DrawY+=DrawYPlus;
		}

		if(NiceBonusNum>0)
		{//スペル側で値を設定している
			BasePoint=BasePoint*NiceBonusNum;
			DrawShootBonus("NiceShot",DrawX,DrawY,No);
			ShootBonumNumDraw(NiceBonusNum*100,DrawX+100,DrawY,false,true,No);
			DrawY+=DrawYPlus;
		}
		NiceBonusNum=0;
		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(SelfPhoto)
			{//写真内に自分かいるかどうか判定
				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(GetTimeOfPlayerInvincibility>0)
		{
			BasePoint=BasePoint*0.10;
			DrawShootBonus("InvincibleShot",DrawX,DrawY,No);
			ShootBonumNumDraw(10,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);
		
		if(No>=0)
		{//成功時は＋失敗時はーが代入されているので。それで加算の有無を判断
			AddScore(BasePoint);	
		}

		let DX=GetClipMaxX+40+65*((No%10)%3);
		let DY=GetCenterY+40+65*trunc((No%10)/3);
		if(GetCommonDataDefault("BunSpell",false)==true)
		{
			if((photoNo%10)<=5)
			{
				DX=GetClipMaxX+80;
				DY=GetCenterY-170+(No%10)*85+25;
			}
			else
			{
				DX=GetClipMaxX+165;
				DY=GetCenterY-170+((No%10)-5)*85+25;
			}
		}
		if(No>=0)
		{
		ShootBonumNumDraw(BasePoint,DX,DY,false,false,No);
		}
		if(GetCommonDataDefault("HiBasePoint",0)<BasePoint && No>=0)
		{
			SetCommonData("HiBasePoint",BasePoint);//一番高い得点を保存、最後にステージ側で記録する
			SetCommonData("BestShootNo",No);//何枚目がベストショットかを保存
		}
		wait(10);
		SetCommonData("BasePoint",0);
		SetCommonData("RiskPoint",0);
		ascent(let i in 0..8)//ColorShotの判定
		{
			SetCommonData(Color[i],0);//初期化
		}
}


function ShootRange(obj,CAngle,CDAngle,X,Y,PX,PY,OriAngle1,OriDis1,OriAngle2,OriDis2,OriAngle3,OriDis3,OriAngle4,OriDis4)
{//写真の切り取り方を指定する。１５００行あるとか酷い。簡略化できるの？
let Difined=false;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////頂点の一つがシーン外にある場合/////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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);
Difined=true;
		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(Difined==false)
{
		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, 4);

		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]);
		}
}