rsanchezsaez / CardboardSDK-iOS

iOS port of Google's CardboardSDK (mobile VR toolkit)
Other
334 stars 104 forks source link

Fix for simulator #8

Closed kafumanto closed 9 years ago

kafumanto commented 9 years ago

Hi,

the following patch fixes the pink screen shown on the simulator (as reported in issue #6):

diff -r 99ad9a206f6c ios/dependencies/CardboardSDK-iOS/src/CardboardSDK/Cardboard/Sensors/HeadTracker.mm
--- a/ios/dependencies/CardboardSDK-iOS/src/CardboardSDK/Cardboard/Sensors/HeadTracker.mm   Thu May 14 04:53:59 2015 +0200
+++ b/ios/dependencies/CardboardSDK-iOS/src/CardboardSDK/Cardboard/Sensors/HeadTracker.mm   Thu May 14 04:57:23 2015 +0200
@@ -176,11 +176,15 @@

 bool HeadTracker::isReady()
 {
+#if TARGET_IPHONE_SIMULATOR
+   return true;
+#else
     bool isTrackerReady = (_sampleCount > kInitialSamplesToSkip);
   #if HEAD_TRACKER_MODE == HEAD_TRACKER_MODE_EKF || HEAD_TRACKER_MODE == HEAD_TRACKER_MODE_CORE_MOTION_EKF
     isTrackerReady = isTrackerReady && _tracker->isReady();
   #endif
     return isTrackerReady;
+#endif
 }

 GLKMatrix4 HeadTracker::lastHeadView()

Maybe paths in the header of the patch must be updated to be able to apply it (are from a Mercurial project).

rsanchezsaez commented 9 years ago

Thanks for the patch. Could you possibly create a pull request through GitHub?

rsanchezsaez commented 9 years ago

I've finally added your patch in 55b70f3. Thanks again!

kafumanto commented 9 years ago

A pleasure! And sorry for the patch instead of the pull request ;)

rsanchezsaez commented 9 years ago

No problem!