Comments (8)
I want add some objects such as buttons or view.
from panorama.
got a solution-
it looks like GLKView Opaque property needs to be NO for this to happen. I'm going to push this small change up to master.
from panorama.
my hierarchy looks like this:
GLKViewController
-GLKView (PanoramaView)
--UIKIT Objects (UIButton, UIView)
add all your elements as subviews to PanoramaView and it should work fine
here's my ViewController.m code:
@interface ViewController (){
PanoramaView *panoramaView;
}
@EnD
@implementation ViewController
-
(void)viewDidLoad{
[super viewDidLoad];
panoramaView = [[PanoramaView alloc] init];
[panoramaView setImage:@"park_2048.jpg"];
[panoramaView setOrientToDevice:YES];
[panoramaView setTouchToPan:NO];
[panoramaView setPinchToZoom:YES];
[panoramaView setShowTouches:NO];
[self setView:panoramaView];UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setFrame:CGRectMake(10, 10, 100, 100)];
[button setBackgroundColor:[UIColor blackColor]];
[panoramaView addSubview:button];
[button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
}
-(void) buttonAction{
NSLog(@"hit");
}
-(void) glkView:(GLKView *)view drawInRect:(CGRect)rect{
[panoramaView draw];
}
from panorama.
Thank you for your answer。But I want to let button follow panoramaView rotation movement.
from panorama.
oh, i would build an object in openGL, putting it where this comment is:
//TODO: add any objects here to make them a part of the virtual reality
that way it distorts properly and feels like it's integrated.
if you just want a UIKit object tracking a point (it wouldn't rotate for example), then you want to convert a unit vector to a screen point. i have a function
-(GLKVector3) vectorFromScreenLocation:(CGPoint)screenTouch inAttitude:(GLKMatrix4)matrix;
and what you'd want is the inverse of that. which might be useful to have. i don't have time free time at the moment, but if you want to take care of it I'll merge it. Or I can look into it at a later time.
from panorama.
Hi,
Any news about this screenLocationFromVector method?
Thanks in advance.
from panorama.
Here is some code that returns the location on screen from a 3D point:
- (BOOL)computeScreenLocation:(CGPoint*)location fromVector:(GLKVector3)vector inAttitude:(GLKMatrix4)matrix
{
GLKVector4 screenVector;
GLKVector4 vector4;
if(location == NULL)
return NO;
matrix = GLKMatrix4Multiply(_projectionMatrix, matrix);
vector4 = GLKVector4Make(vector.x, vector.y, vector.z, 1);
screenVector = GLKMatrix4MultiplyVector4(matrix, vector4);
location->x = (screenVector.x/screenVector.w/2.0 + 0.5) * self.frame.size.width;
location->y = (0.5-screenVector.y/screenVector.w/2) * self.frame.size.height;
return (screenVector.z >= 0);
}
This method returns wether the point is before or behind the screen.
It does work in portrait but would need some additional code to take care of all orientations.
I will create a PR if I find some time.
from panorama.
it actually works fine with orientations, it alerted me to another issue- orientation handling is being over-complicated, fixing it now.
from panorama.
Related Issues (20)
- Just detect touch Swift 3 HOT 1
- How do i get same woking of lockPanToHorizon with landscape mode in device HOT 3
- Set Image directly instead of name/path HOT 1
- adapting image orientation with device orientation HOT 2
- How can I set the current viewing direction to the center of the image? HOT 2
- How to Use the Panorama View for UIView? HOT 1
- Camera Features Support HOT 3
- setImage and setImageWithName not working when I try to set it from directory or bundle directory HOT 2
- Large Image not loading. HOT 2
- Tiny planet effect by zooming out HOT 1
- EXC_BAD_ACCESS on iOS 11 HOT 4
- how to set image size for scale 16:9 HOT 1
- Unable to build pod in swift project HOT 2
- Library for Android
- iOS black screen HOT 1
- Control Zooming
- Its not working on iOS
- Migrate to Swift and Metal?
- How to use pitch and yaw to place hotspots ?
- Port to Swift/Metal is available: dhoerl/Panorama
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panorama.