mgatelabs / scn-vr Goto Github PK
View Code? Open in Web Editor NEWThis is a iOS 8.x library for rendering VR content with SceneKit.
License: GNU General Public License v3.0
This is a iOS 8.x library for rendering VR content with SceneKit.
License: GNU General Public License v3.0
Hi,
I been trying to use this as a 360 video VR player, but it only seems to render the sphere on the left side of the cam. This is what I am doing
`
_player = [[AVPlayer alloc] initWithURL:videoPath];
_videoSpriteKitNode = [SKVideoNode videoNodeWithFileNamed:@"vr.mp4"];
_videoNode = [[SCNNode alloc] init];
[_videoNode setGeometry:[SCNSphere sphereWithRadius:300.f]];
_spriteKitScene = [[SKScene alloc] initWithSize:CGSizeMake(2500, 2500)];
[_spriteKitScene setScaleMode:SKSceneScaleModeAspectFit];
[_videoSpriteKitNode setPosition:CGPointMake(_spriteKitScene.size.width/2, _spriteKitScene.size.height/2)];
[_videoSpriteKitNode setSize:_spriteKitScene.size];
[_spriteKitScene addChild:_videoSpriteKitNode];
[_videoNode.geometry.firstMaterial.diffuse setContents:_spriteKitScene];
[_videoNode.geometry.firstMaterial setDoubleSided:true];
[_videoNode setPosition:SCNVector3Make(0, 0, 0)];
[world addChildNode:_videoNode];`
Am I missing somthing? or anyhow how to make this work?
Thanks!
Just paste following scene building code into -(SCNScene *) generateScene. And you need to put a 360 degree video into project to run.
SCNScene* scene = [SCNScene scene];
SCNNode* world = [SCNNode node];
[scene.rootNode addChildNode:world];
NSString* path = [[NSBundle mainBundle] pathForResource:@"video_palace" ofType:@"mp4"];
NSURL* url = [NSURL fileURLWithPath:path];
AVPlayerItem* playerItem = [[AVPlayerItem alloc] initWithURL:url];
AVPlayer* player = [AVPlayer playerWithPlayerItem:playerItem];
SKVideoNode* playerNode = [[SKVideoNode alloc] initWithAVPlayer:player];
playerNode.position = CGPointMake(2500 * 0.5, 2500 * 0.5);
playerNode.size = CGSizeMake(2500, 2500);
SKScene* spriteScene = [[SKScene alloc] initWithSize:playerNode.size];
spriteScene.scaleMode = SKSceneScaleModeAspectFit;
[spriteScene addChild:playerNode];
SCNNode* videoNode = [SCNNode new];
videoNode.geometry = [SCNSphere sphereWithRadius:30];
videoNode.geometry.firstMaterial.diffuse.contents = spriteScene;
videoNode.geometry.firstMaterial.doubleSided = TRUE;
SCNMatrix4 matrix = SCNMatrix4MakeRotation(M_PI, 0.0, 0.0, 1.0);
matrix = SCNMatrix4Translate(matrix, 1.0, 1.0, 0.0);
videoNode.pivot = SCNMatrix4MakeRotation(M_PI_2, 0.0, -1.0, 0.0);
videoNode.geometry.firstMaterial.diffuse.contentsTransform = matrix;
videoNode.position = SCNVector3Make(0, 0, 0);
[player play];
[world addChildNode:videoNode];
return scene;
A day or so after the app has been installed, it will stop opening when attempting to launch.
It'll oftern get to the menu screen for a fraction of a second, before closing out back to icon view.
no matter whether I kill the app, hard reset the iphone, nothing fixes this once it starts.
The only remedy is to remove the app and reinstall.
however this comes at much frustration as I must then copy the videos back onto the device each time.
extra info:
I'm using iExplorer to copy videos onto the device (21GB in total)
I have also made custom thumbnails for the videos, replacing the existing PNG's (alpha'ed in the same way)
Running on iPhone 6 plus with 128GB
I am getting linking error when i build HelloWorld as
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_AspectDistortionWizardItem", referenced from:
objc-class-ref in libscn-vr.a(WizardManager.o)
scn-vr library build successfully, however on running HelloWorld gives error.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.