summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-08-19 15:22:13 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-08-19 17:41:55 +0200
commit0df60c46517648b18e65d860f5a9356ba751ca11 (patch)
treefbe895bed6aaac9f65ee095a48e1b12e10af5b3b /platform/macos
parentcb33c861b4cfa82d7afcb5b9ec85d7797679a7d8 (diff)
downloadqtlocation-mapboxgl-0df60c46517648b18e65d860f5a9356ba751ca11.tar.gz
[core] add ability show visualize the depth buffer to the GLFW and macOS app
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/app/Base.lproj/MainMenu.xib6
-rw-r--r--platform/macos/app/MapDocument.m14
-rw-r--r--platform/macos/src/MGLMapView.h5
-rw-r--r--platform/macos/src/MGLMapView.mm6
4 files changed, 30 insertions, 1 deletions
diff --git a/platform/macos/app/Base.lproj/MainMenu.xib b/platform/macos/app/Base.lproj/MainMenu.xib
index fae2a7db7d..716872a32a 100644
--- a/platform/macos/app/Base.lproj/MainMenu.xib
+++ b/platform/macos/app/Base.lproj/MainMenu.xib
@@ -474,6 +474,12 @@
<action selector="showStencilBuffer:" target="-1" id="WkN-t9-Mpv"/>
</connections>
</menuItem>
+ <menuItem title="Depth Buffer" keyEquivalent="d" id="CDq-70-oPa">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" option="YES" command="YES"/>
+ <connections>
+ <action selector="showDepthBuffer:" target="-1" id="h7r-eM-ZEu"/>
+ </connections>
+ </menuItem>
<menuItem isSeparatorItem="YES" id="dYw-bb-tr1"/>
<menuItem title="Show Tooltips on Dropped Pins" id="uir-Rx-zmw">
<modifierMask key="keyEquivalentModifierMask"/>
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m
index 9e65539990..3bb8f5872e 100644
--- a/platform/macos/app/MapDocument.m
+++ b/platform/macos/app/MapDocument.m
@@ -283,12 +283,19 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
- (IBAction)showColorBuffer:(id)sender {
self.mapView.debugMask &= ~MGLMapDebugStencilBufferMask;
+ self.mapView.debugMask &= ~MGLMapDebugDepthBufferMask;
}
- (IBAction)showStencilBuffer:(id)sender {
+ self.mapView.debugMask &= ~MGLMapDebugDepthBufferMask;
self.mapView.debugMask |= MGLMapDebugStencilBufferMask;
}
+- (IBAction)showDepthBuffer:(id)sender {
+ self.mapView.debugMask &= ~MGLMapDebugStencilBufferMask;
+ self.mapView.debugMask |= MGLMapDebugDepthBufferMask;
+}
+
- (IBAction)toggleShowsToolTipsOnDroppedPins:(id)sender {
_showsToolTipsOnDroppedPins = !_showsToolTipsOnDroppedPins;
}
@@ -642,7 +649,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
return YES;
}
if (menuItem.action == @selector(showColorBuffer:)) {
- BOOL enabled = self.mapView.debugMask & MGLMapDebugStencilBufferMask;
+ BOOL enabled = self.mapView.debugMask & (MGLMapDebugStencilBufferMask | MGLMapDebugDepthBufferMask);
menuItem.state = enabled ? NSOffState : NSOnState;
return YES;
}
@@ -651,6 +658,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
menuItem.state = enabled ? NSOnState : NSOffState;
return YES;
}
+ if (menuItem.action == @selector(showDepthBuffer:)) {
+ BOOL enabled = self.mapView.debugMask & MGLMapDebugDepthBufferMask;
+ menuItem.state = enabled ? NSOnState : NSOffState;
+ return YES;
+ }
if (menuItem.action == @selector(toggleShowsToolTipsOnDroppedPins:)) {
BOOL isShown = _showsToolTipsOnDroppedPins;
menuItem.title = isShown ? @"Hide Tooltips on Dropped Pins" : @"Show Tooltips on Dropped Pins";
diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h
index fb2572ec08..37c13802b1 100644
--- a/platform/macos/src/MGLMapView.h
+++ b/platform/macos/src/MGLMapView.h
@@ -32,6 +32,11 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
@note This option does nothing in Release builds of the SDK.
*/
MGLMapDebugStencilBufferMask = 1 << 6,
+
+ /** The depth buffer is shown instead of the color buffer.
+ @note This option does nothing in Release builds of the SDK.
+ */
+ MGLMapDebugDepthBufferMask = 1 << 7,
};
@class MGLAnnotationImage;
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index 74a5ed96d2..7b7ab0247b 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -2450,6 +2450,9 @@ public:
if (options & mbgl::MapDebugOptions::StencilClip) {
mask |= MGLMapDebugStencilBufferMask;
}
+ if (options & mbgl::MapDebugOptions::DepthBuffer) {
+ mask |= MGLMapDebugDepthBufferMask;
+ }
return mask;
}
@@ -2473,6 +2476,9 @@ public:
if (debugMask & MGLMapDebugStencilBufferMask) {
options |= mbgl::MapDebugOptions::StencilClip;
}
+ if (debugMask & MGLMapDebugDepthBufferMask) {
+ options |= mbgl::MapDebugOptions::DepthBuffer;
+ }
_mbglMap->setDebug(options);
}