1. Cliff Biffle
  2. kinect-viewer

Commits

Cliff Biffle  committed 9fcc386

KVDepthView now centralizes renderer configuration in an explicit setRenderer: implementation.

  • Participants
  • Parent commits 2319d55
  • Branches default

Comments (0)

Files changed (1)

File KVDepthView.m

View file
  • Ignore whitespace
 @implementation KVDepthView
 #pragma mark --- Properties ---
 
+@synthesize lightsOn;
+
 @synthesize renderer;
+- (void) setRenderer: (NSObject <KVRenderer> *)newRenderer {
+  NSObject <KVRenderer> *currentRenderer = renderer;
+  renderer = [newRenderer retain];
+  [currentRenderer release];
+  
+  renderer.useLighting = lightsOn;
+  [self setNeedsDisplay: YES];
+}
+
 @synthesize frozen;
-@synthesize lightsOn;
 @synthesize recording;
 
 #pragma mark --- NSView Overrides ---
 
 - (IBAction) selectPointCloudRenderer: sender {
   self.renderer = [[KVPointCloudRenderer alloc] init];
-  renderer.useLighting = lightsOn;
-  [self setNeedsDisplay: YES];
 }
 
 - (IBAction) selectFilledQuadRenderer: sender {
   self.renderer = [[KVQuadRenderer alloc] init];
-  renderer.useLighting = lightsOn;
-  [self setNeedsDisplay: YES];
 }
 
 - (IBAction) selectFilledTriRenderer: sender {
   self.renderer = [[KVTriStripRenderer alloc] init];
-  renderer.useLighting = lightsOn;
-  [self setNeedsDisplay: YES];
 }
 
 - (IBAction) toggleDepthFieldUpdates: sender {