Commits

Cliff Biffle committed 791de15

CmdOptB now toggles visibility of the background when subject isolation is enabled.

Comments (0)

Files changed (3)

English.lproj/MainMenu.xib

 		</object>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
+			<integer value="296"/>
 			<integer value="533"/>
-			<integer value="81"/>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 								</object>
+								<object class="NSMenuItem" id="292308043">
+									<reference key="NSMenu" ref="466310130"/>
+									<string key="NSTitle">Draw Background</string>
+									<string key="NSKeyEquiv">b</string>
+									<int key="NSKeyEquivModMask">1572864</int>
+									<int key="NSMnemonicLoc">2147483647</int>
+									<reference key="NSOnImage" ref="35465992"/>
+									<reference key="NSMixedImage" ref="502551668"/>
+								</object>
 								<object class="NSMenuItem" id="851891320">
 									<reference key="NSMenu" ref="466310130"/>
 									<bool key="NSIsDisabled">YES</bool>
 					</object>
 					<int key="connectionID">557</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">toggleBackgroundVisibility:</string>
+						<reference key="source" ref="1014"/>
+						<reference key="destination" ref="292308043"/>
+					</object>
+					<int key="connectionID">559</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
 							<reference ref="406940919"/>
 							<reference ref="433488773"/>
 							<reference ref="881222223"/>
+							<reference ref="292308043"/>
 						</object>
 						<reference key="parent" ref="586577488"/>
 					</object>
 						<reference key="object" ref="1064970212"/>
 						<reference key="parent" ref="720053764"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">558</int>
+						<reference key="object" ref="292308043"/>
+						<reference key="parent" ref="466310130"/>
+					</object>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
 					<string>552.IBPluginDependency</string>
 					<string>554.IBPluginDependency</string>
 					<string>556.IBPluginDependency</string>
+					<string>558.IBPluginDependency</string>
 					<string>56.IBPluginDependency</string>
 					<string>56.ImportedFromIB2</string>
 					<string>57.IBEditorWindowLastContentRect</string>
 					<string>{74, 862}</string>
 					<string>{{6, 978}, {478, 20}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>{{591, 583}, {253, 253}}</string>
+					<string>{{591, 563}, {253, 273}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>{{475, 832}, {234, 43}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<integer value="1"/>
 					<string>{{286, 129}, {275, 183}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">557</int>
+			<int key="maxID">559</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
 							<string>selectMeshedTriRenderer:</string>
 							<string>selectPointCloudRenderer:</string>
 							<string>toggleBackgroundBuffer:</string>
+							<string>toggleBackgroundVisibility:</string>
 							<string>toggleDepthFieldUpdates:</string>
 							<string>toggleLighting:</string>
 							<string>toggleRecording:</string>
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="actionInfosByName">
 							<string>selectMeshedTriRenderer:</string>
 							<string>selectPointCloudRenderer:</string>
 							<string>toggleBackgroundBuffer:</string>
+							<string>toggleBackgroundVisibility:</string>
 							<string>toggleDepthFieldUpdates:</string>
 							<string>toggleLighting:</string>
 							<string>toggleRecording:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							<object class="IBActionInfo">
+								<string key="name">toggleBackgroundVisibility:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
 								<string key="name">toggleDepthFieldUpdates:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 @property(assign) BOOL frozen;
 @property(assign, nonatomic) BOOL lightsOn;
 @property(nonatomic) BOOL separateForeground;
+@property(nonatomic) BOOL drawBackground;
 @property(nonatomic) BOOL recording;
 
 - (void) depthFieldUpdated: (KFKinect *)kinect;
 - (IBAction) toggleDepthFieldUpdates: sender;
 - (IBAction) toggleLighting: sender;
 - (IBAction) toggleBackgroundBuffer: sender;
+- (IBAction) toggleBackgroundVisibility: sender;
 - (IBAction) toggleRecording: sender;
 @end
 @synthesize frozen;
 @synthesize lightsOn;
 @synthesize separateForeground;
+@synthesize drawBackground;
 @synthesize recording;
 
 #pragma mark --- NSView Overrides ---
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   
   vec3f_t color = { 1,1,1 };
-  (self.renderAction)(backgroundDepthField, &color);
+  if (!separateForeground || drawBackground) (self.renderAction)(backgroundDepthField, &color);
   if (separateForeground) {
     color = (vec3f_t){ 1, 0, 0 };
     (self.renderAction)(foregroundDepthField, &color);
   @synchronized (self) {
     if (recording) {
       const uint8_t *rawBytes = [rawDepthField bytes];
-      fwrite(rawBytes, sizeof(GLfloat), 640*480, depthOutput);
+      fwrite(rawBytes, sizeof(uint16_t), 640*480, depthOutput);
     }
   }
       
                        andFoldUsing: ^(int x, int y, GLfloat _, GLfloat z){
                          GLfloat bg = backgroundData[y * 640 + x];
                          GLfloat deltaZ = fabsf(z - bg);
-                         return deltaZ > 0.5F? z : 0.F;
+                         return deltaZ > 0.8F? z : 0.F;
                        }];
     } else {
       [self computeLinearDepthField: backgroundDepthField 
   [sender setState: self.separateForeground? NSOnState : NSOffState];
 }
 
+- (IBAction) toggleBackgroundVisibility: sender {
+  self.drawBackground = !self.drawBackground;
+  [sender setState: self.drawBackground? NSOnState : NSOffState];
+}
+
 - (IBAction) toggleRecording: sender {
   if (recording) {
     @synchronized(self) {