您的位置:首页 > 其它

iPhone开发之全景展示(panoramagl)

2013-10-12 22:56 507 查看
//相应地方添加成员变量
plView = [[PLView alloc] initWithFrame:self.view.frame];
plView.delegate=self;
[self.view addSubview:plView];
[self.view sendSubviewToBack:plView];//送到最里端


-(void)selectPanorama:(NSInteger)index
{
NSObject<PLIPanorama> *panorama = nil;
//Spherical2 panorama example (supports up 2048x1024 texture)
if(index == 0)
{
panorama = [PLSpherical2Panorama panorama];
[(PLSpherical2Panorama *)panorama setImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere2" ofType:@"jpg"]]];
}
//Spherical panorama example (supports up 1024x512 texture)
else if(index == 1)
{
panorama = [PLSphericalPanorama panorama];
[(PLSphericalPanorama *)panorama setTexture:[PLTexture textureWithImage:[PLImage imageWithPath:[[NSBundle mainBundle] pathForResource:@"pano_sphere" ofType:@"jpg"]]]];
}
//Cubic panorama example (supports up 1024x1024 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;
}
//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"]]]];
}
}


两个下载地址:http://code.google.com/p/panoramagl/

https://github.com/menssen/panoramagl#51-with-interface-builder

另有介绍使用的:http://www.codeproject.com/Articles/60635/Panorama-360-iPod-Touch-iPhone
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: