task ItemCreate(Cobj,No,Success,ChargeLimit,x,y)//玉消ししたときに発生する。装填率を上げたりする
{
	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 speed=0.2;
		let angle=atan2(y-Obj_GetY(Cobj),x-Obj_GetX(Cobj));

		let lightangle=rand(0,360);
		loop(10)
		{
			lightangle+=12;
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,205+50*cos(lightangle),255,255,255);
			}
			Obj_SetPosition(obj,Obj_GetX(obj)+speed*cos(angle),Obj_GetY(obj)+speed*sin(angle));
			wait(1);
		}
		let speed=8;

		let amp;
		if(Success)
		{
			amp=1+(No-1)*1/9;
		}
		else
		{
			amp=10/3;
		}
		while(!Obj_BeDeleted(obj))
		{
			lightangle+=6;
			ascent(let i in 0..4)
			{
				ObjEffect_SetVertexColor(obj,i,155+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/5)
					{
						Charge+=0.3*amp;
					}
					else if(Charge<ChargeLimit/4)
					{
						Charge+=0.25*amp;
					}
					else if(Charge<ChargeLimit/3)
					{
						Charge+=0.2*amp;
					}
					else if(Charge<ChargeLimit/2)
					{
						Charge+=0.15*amp;
					}
					else if(Charge<ChargeLimit/1)
					{
						Charge+=0.1*amp;
					}
					else 
					{
						Charge+=0;
					}
				if(judg)
				{
				EffectItemCreate;
				}
				if(GetCommonDataDefault("DefeatBoss",false)==false && GetCommonDataDefault("LoseBoss",false)==false)
				{
				PlaySE("seScore.wav");
				}
				Obj_Delete(obj);
			}
		wait(1);
		}
		
}

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(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*((photoNo%10)%3);
		let DY=GetCenterY+50+65*trunc((photoNo%10)/3);
		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;
		}
		ShootBonumNumDraw(BasePoint,DX,DY,false,false,No);
		if(GetCommonDataDefault("HiBasePoint",0)<BasePoint && No>=0)
		{
			SetCommonData("HiBasePoint",BasePoint);//一番高い得点を保存、最後にステージ側で記録する
			SetCommonData("BestShootNo",No);//何枚目がベストショットかを保存
		}
		SetCommonData("BasePoint",0);
		SetCommonData("RiskPoint",0);
}


function ShootRange(obj,CAngle,CDAngle,X,Y,PX,PY,OriAngle1,OriDis1,OriAngle2,OriDis2,OriAngle3,OriDis3,OriAngle4,OriDis4)
{//写真の切り取り方を指定する。１５００行あるとか酷い。簡略化できるの？
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]);
		}
}