2017-07-28 125 views
0

我有360º照片(來自Samsung Gear 360 2017),我想在我的應用程序中展示它們。我嘗試了Github的幾個選項,但它們大都過時了。iOS show360º照片

最近的嘗試是使用SCNSceneKit。

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *filePath = [NSString stringWithFormat:@"%@/%@.jpg", [paths objectAtIndex:0], delegate.strSelPhotoID]; 


UIImage *image = [UIImage imageWithContentsOfFile:filePath]; 

// Set the scene 
self.sceneView.scene = [[SCNScene alloc]init]; 
self.sceneView.showsStatistics = NO; 
self.sceneView.allowsCameraControl = YES; 

//Create node, containing a sphere, using the panoramic image as a texture 
SCNSphere *sphere = [SCNSphere sphereWithRadius:30.0]; 
sphere.firstMaterial.doubleSided = YES; 
sphere.firstMaterial.diffuse.contents = image; 

SCNNode *sphereNode = [SCNNode nodeWithGeometry:sphere]; 
sphereNode.position = SCNVector3Make(0,0,0); 
[self.sceneView.scene.rootNode addChildNode:sphereNode]; 


// Camera, ... 
_cameraNode = [[SCNNode alloc]init]; 
_cameraNode.camera = [[SCNCamera alloc]init]; 
_cameraNode.position = SCNVector3Make(0, 0, 0); 
[self.sceneView.scene.rootNode addChildNode:_cameraNode]; 

這部作品越來越少,顯示照片,但: - 圖像周圍平移是不是很好,畸變非常高, - 當接觸用兩個手指它關係到一個非常高的縮放級別

是否有360º的全景照片SDK,或者有什麼可以實現的最佳選擇?

回答

0

With Google VR SDK你可以輕鬆地做到這一點。它適用於360圖片和視頻。

Github上有樣本。​​

+0

感謝你們,之前就試過這個,GVRSDK的問題在於它需要bitcode enabled = NO。總之,設置爲NO,不允許構建應用程序。 –