Commit d5d879d3 authored by Ruben Jesus Garcia Hernandez's avatar Ruben Jesus Garcia Hernandez
parents 1dfdb958 c1df5eb6
Thumbs.db Thumbs.db
\ No newline at end of file .DS_Store
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include <math.h>
#include "aux.h" #include "aux.h"
gvr::Mat4f TranslationMatrix (float x, float y, float z)
{
gvr::Mat4f mvs;
mvs.m[0][0]=1;mvs.m[0][1]=0;mvs.m[0][2]=0; mvs.m[0][3]=x;
mvs.m[1][0]=0;mvs.m[1][1]=1;mvs.m[1][2]=0;mvs.m[1][3]=y;
mvs.m[2][0]=0;mvs.m[2][1]=0;mvs.m[2][2]=1; mvs.m[2][3]=z;
mvs.m[3][0]=0;mvs.m[3][1]=0;mvs.m[3][2]=0; mvs.m[3][3]=1;
return mvs;
}
gvr::Mat4f TranslationMatrix (float v[3])
{
return TranslationMatrix (v[0], v[1], v[2]);
}
gvr::Mat4f ScalingMatrix (float x, float y, float z)
{
gvr::Mat4f mvs;
mvs.m[0][0]=x;mvs.m[0][1]=0;mvs.m[0][2]=0; mvs.m[0][3]=0;
mvs.m[1][0]=0;mvs.m[1][1]=y;mvs.m[1][2]=0;mvs.m[1][3]=0;
mvs.m[2][0]=0;mvs.m[2][1]=0;mvs.m[2][2]=z; mvs.m[2][3]=0;
mvs.m[3][0]=0;mvs.m[3][1]=0;mvs.m[3][2]=0; mvs.m[3][3]=1;
return mvs;
}
gvr::Mat4f ScalingMatrix (float v[3])
{
return ScalingMatrix(v[0], v[1], v[2]);
}
gvr::Mat4f ScalingMatrix (float s)
{
return ScalingMatrix(s,s,s);
}
float getCofactor(float m0, float m1, float m2, float getCofactor(float m0, float m1, float m2,
float m3, float m4, float m5, float m3, float m4, float m5,
float m6, float m7, float m8) float m6, float m7, float m8)
...@@ -13,7 +65,7 @@ float getCofactor(float m0, float m1, float m2, ...@@ -13,7 +65,7 @@ float getCofactor(float m0, float m1, float m2,
//adapted from //adapted from
//openvr-0.9.19\samples\shared\matrices.cpp //openvr-0.9.19\samples\shared\matrices.cpp
static gvr::Mat4f invert (const gvr::Mat4f& m) gvr::Mat4f invert (const gvr::Mat4f& m)
{ {
gvr::Mat4f r; gvr::Mat4f r;
// get cofactors of minor matrices // get cofactors of minor matrices
......
/*
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/
#include "vr/gvr/capi/include/gvr.h"
const float EPSILON = 0.00001f;
gvr::Mat4f TranslationMatrix (float x, float y, float z);
gvr::Mat4f TranslationMatrix (float v[3]);
gvr::Mat4f ScalingMatrix (float x, float y, float z);
gvr::Mat4f ScalingMatrix (float v[3]);
gvr::Mat4f ScalingMatrix (float s);
float getCofactor(float m0, float m1, float m2, float getCofactor(float m0, float m1, float m2,
float m3, float m4, float m5, float m3, float m4, float m5,
float m6, float m7, float m8); float m6, float m7, float m8);
static gvr::Mat4f invert (const gvr::Mat4f& m); gvr::Mat4f invert (const gvr::Mat4f& m);
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-40@3x-1.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-20.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-20@2x-1.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-29@2x-1.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-20@2x-2.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-40@2x-1.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-83_5@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"minimum-system-version" : "7.0",
"subtype" : "retina4",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>NOMAD VR</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIcons</key>
<dict/>
<key>CFBundleIcons~ipad</key>
<dict/>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<key>CFBundleVersion</key>
<string>2.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Used to scan QR codes</string>
<key>NSMainNibFile</key>
<string>launch</string>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>launch</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>magnetometer</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
...@@ -3,13 +3,7 @@ ...@@ -3,13 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>SchemeUserState</key> <key>SchemeUserState</key>
<dict> <dict/>
<key>TreasureHuntNDK.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key> <key>SuppressBuildableAutocreation</key>
<dict> <dict>
<key>12BEE99D1C8F53AB002F8361</key> <key>12BEE99D1C8F53AB002F8361</key>
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:NOMADVRSDK.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
target 'NOMADVRSDK' do target 'NOMADVR' do
pod 'GVRSDK' pod 'GVRSDK'
pod 'GVRAudioSDK' pod 'GVRAudioSDK'
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef <FileRef
location = "group:/Users/lrz/gvr-ios-sdk/Samples/TreasureHuntNDK/NOMADVRSDK.xcodeproj"> location = "group:/Users/lrz/gvr-ios-sdk/Samples/TreasureHuntNDK/NOMADVR.xcodeproj">
</FileRef> </FileRef>
<FileRef <FileRef
location = "group:Pods/Pods.xcodeproj"> location = "group:Pods/Pods.xcodeproj">
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "12BEE99D1C8F53AB002F8361" BlueprintIdentifier = "12BEE99D1C8F53AB002F8361"
BuildableName = "NOMADVRSDK.app" BuildableName = "NOMADVR.app"
BlueprintName = "NOMADVRSDK" BlueprintName = "NOMADVR"
ReferencedContainer = "container:NOMADVRSDK.xcodeproj"> ReferencedContainer = "container:NOMADVR.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
</BuildActionEntries> </BuildActionEntries>
...@@ -56,9 +56,9 @@ ...@@ -56,9 +56,9 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "12BEE99D1C8F53AB002F8361" BlueprintIdentifier = "12BEE99D1C8F53AB002F8361"
BuildableName = "NOMADVRSDK.app" BuildableName = "NOMADVR.app"
BlueprintName = "NOMADVRSDK" BlueprintName = "NOMADVR"
ReferencedContainer = "container:NOMADVRSDK.xcodeproj"> ReferencedContainer = "container:NOMADVR.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
<AdditionalOptions> <AdditionalOptions>
...@@ -70,16 +70,6 @@ ...@@ -70,16 +70,6 @@
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"> debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "12BEE99D1C8F53AB002F8361"
BuildableName = "NOMADVRSDK.app"
BlueprintName = "NOMADVRSDK"
ReferencedContainer = "container:NOMADVRSDK.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction> </ProfileAction>
<AnalyzeAction <AnalyzeAction
buildConfiguration = "Debug"> buildConfiguration = "Debug">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TreasureHuntNDK.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
/*# Copyright 2016-2018 The NOMAD Developers Group*/
/* /*
* Copyright 2016 Google Inc. All Rights Reserved. * Copyright 2016 Google Inc. All Rights Reserved.
* *
...@@ -19,18 +20,45 @@ ...@@ -19,18 +20,45 @@
#import "GVROverlayView.h" #import "GVROverlayView.h"
#import "treasure_hunt_renderer.h" #import "treasure_hunt_renderer.h"
#include "FileBrowser/FileBrowser.h"
#include "FileBrowser-Swift.h"
@interface TreasureHuntViewController ()<GLKViewControllerDelegate, GVROverlayViewDelegate> { @interface TreasureHuntViewController ()<GLKViewControllerDelegate, GVROverlayViewDelegate> {
gvr_context *_gvrContext; gvr_context *_gvrContext;
std::unique_ptr<TreasureHuntRenderer> _renderer; std::unique_ptr<TreasureHuntRenderer> _renderer;
NSMutableArray *mycommands;
} }
@end @end
NSString * filename;
@implementation TreasureHuntViewController @implementation TreasureHuntViewController
//https://stackoverflow.com/questions/3717141/how-to-detect-keyboard-events-on-hardware-keyboard-on-iphone-ios
- (BOOL)canBecomeFirstResponder
{
return YES;
}
- (NSArray *)keyCommands
{
return mycommands;
}
- (void)dealloc { - (void)dealloc {
gvr_destroy(&_gvrContext); gvr_destroy(&_gvrContext);
} }
- (UIViewController *)presentingViewControllerForSettingsDialog {
return self;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
...@@ -47,6 +75,7 @@ ...@@ -47,6 +75,7 @@
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapGLView:)]; [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapGLView:)];
[self.view addGestureRecognizer:tapGesture]; [self.view addGestureRecognizer:tapGesture];
// Create an OpenGL ES context and assign it to the view loaded from storyboard // Create an OpenGL ES context and assign it to the view loaded from storyboard
GLKView *glkView = (GLKView *)self.view;