PanoramaGL全景圖

-(void)selectPanorama:(NSInteger)index{ PLRotation ro = PLRotationMake(0.0, 0.0, 0.0); [self.plView.camera resetCurrentC:ro Pitch:ro.pitch yaw:ro.yaw]; NSObject *panorama = nil;

? ? //尺寸必須符合

? ? //Spherical2 panorama example (supports up 4096x2048 texture)

? ? if(index == 0)

? ? {

? ? ? ? panorama = [PLSpherical2Panorama panorama];

? ? ? ? [(PLSpherical2Panorama *)panorama setImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere2" ofType:@"jpg"]]];

? ? }

? ? //Spherical panorama example (supports up 2048x1024 texture)

? ? else if(index == 1)

? ? {

? ? ? ? panorama = [PLSphericalPanorama panorama];

? ? ? ? [(PLSphericalPanorama *)panorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere" ofType:@"jpg"]]]];

? ? }

? ? //尺寸不必須符合奔誓,比例符合2;1即可

? ? else if(index == 5)

? ? {

? ? ? ? //ifNoPowerOfTwoConvertUpDimension 如果圖片不滿足2的N次方萍程,YES向上取一個(gè)滿足的诉稍,NO向下取一個(gè)滿足的

? ? ? ? panorama = [PLSphericalRatioPanorama panorama];

? ? [(PLSphericalRatioPanorama *)panorama setImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere2" ofType:@"jpg"]] ifNoPowerOfTwoConvertUpDimension:NO];

? ? }

? ? //Cubic panorama example (supports up 2048x2048 texture per face)

? ? else if(index == 2)

? ? {

? ? ? ? PLCubicPanorama *cubicPanorama = [PLCubicPanorama panorama];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_f" ofType:@"jpg"]]] face:PLCubeFaceOrientationFront];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_b" ofType:@"jpg"]]] face:PLCubeFaceOrientationBack];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_l" ofType:@"jpg"]]] face:PLCubeFaceOrientationLeft];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_r" ofType:@"jpg"]]] face:PLCubeFaceOrientationRight];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_u" ofType:@"jpg"]]] face:PLCubeFaceOrientationUp];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_d" ofType:@"jpg"]]] face:PLCubeFaceOrientationDown];

? ? ? ? panorama = cubicPanorama;

? ? }

? ? //Car

? ? else if(index == 4)

? ? {

? ? ? ? PLCubicPanorama *cubicPanorama = [PLCubicPanorama panorama];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"front" ofType:@"jpg"]]] face:PLCubeFaceOrientationFront];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"back" ofType:@"jpg"]]] face:PLCubeFaceOrientationBack];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"left" ofType:@"jpg"]]] face:PLCubeFaceOrientationLeft];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"right" ofType:@"jpg"]]] face:PLCubeFaceOrientationRight];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"up" ofType:@"jpg"]]] face:PLCubeFaceOrientationUp];

? ? ? ? [cubicPanorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"down" ofType:@"jpg"]]] face:PLCubeFaceOrientationDown];

? ? ? ? panorama = cubicPanorama;

? ? }



? ? //Cylindrical panorama example (supports up 1024x1024 texture)

? ? else if(index == 3)

? ? {

? ? ? ? panorama = [PLCylindricalPanorama panorama];

? ? ? ? ((PLCylindricalPanorama *)panorama).isHeightCalculated = NO;

? ? ? ? [(PLCylindricalPanorama *)panorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere" ofType:@"jpg"]]]];

? ? }

? ? //Add a hotspot

? ? PLTexture *hotspotTexture = [PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"hotspot" ofType:@"png"]]];

? ? PLHotspot *hotspot = [PLHotspot hotspotWithId:(kIdMin + random() % ((kIdMax + 1) - kIdMin)) texture:hotspotTexture atv:0.0f ath:0.0f width:0.08f height:0.08f];

? ? [panorama addHotspot:hotspot];

? ? [self.plView setPanorama:panorama];

}

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末伤塌,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子跳座,更是在濱河造成了極大的恐慌端铛,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,826評(píng)論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件疲眷,死亡現(xiàn)場(chǎng)離奇詭異禾蚕,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)咪橙,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,968評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門(mén)夕膀,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人美侦,你說(shuō)我怎么就攤上這事产舞。” “怎么了菠剩?”我有些...
    開(kāi)封第一講書(shū)人閱讀 164,234評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵易猫,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我具壮,道長(zhǎng)准颓,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,562評(píng)論 1 293
  • 正文 為了忘掉前任棺妓,我火速辦了婚禮攘已,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘怜跑。我一直安慰自己样勃,他們只是感情好吠勘,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,611評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著峡眶,像睡著了一般剧防。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上辫樱,一...
    開(kāi)封第一講書(shū)人閱讀 51,482評(píng)論 1 302
  • 那天峭拘,我揣著相機(jī)與錄音,去河邊找鬼狮暑。 笑死鸡挠,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的心例。 我是一名探鬼主播宵凌,決...
    沈念sama閱讀 40,271評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼止后!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起溜腐,我...
    開(kāi)封第一講書(shū)人閱讀 39,166評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤译株,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后挺益,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體歉糜,經(jīng)...
    沈念sama閱讀 45,608評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,814評(píng)論 3 336
  • 正文 我和宋清朗相戀三年望众,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了匪补。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,926評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡烂翰,死狀恐怖夯缺,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情甘耿,我是刑警寧澤踊兜,帶...
    沈念sama閱讀 35,644評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站佳恬,受9級(jí)特大地震影響捏境,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜毁葱,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,249評(píng)論 3 329
  • 文/蒙蒙 一垫言、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧倾剿,春花似錦筷频、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,866評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)笑陈。三九已至,卻和暖如春葵袭,著一層夾襖步出監(jiān)牢的瞬間涵妥,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 32,991評(píng)論 1 269
  • 我被黑心中介騙來(lái)泰國(guó)打工坡锡, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留蓬网,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,063評(píng)論 3 370
  • 正文 我出身青樓鹉勒,卻偏偏與公主長(zhǎng)得像帆锋,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子禽额,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,871評(píng)論 2 354

推薦閱讀更多精彩內(nèi)容