[Visualization] Remove OpenGL fallback
The OpenGL fallback was causing division by zero errors on Intel Macs running macOS High Sierra. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
5e5b2e4071
commit
6b381f3d08
|
@ -28,7 +28,6 @@ extern NSString *CogPlaybackDidStopNotficiation;
|
||||||
BOOL isListening;
|
BOOL isListening;
|
||||||
BOOL bandsReset;
|
BOOL bandsReset;
|
||||||
BOOL cameraControlEnabled;
|
BOOL cameraControlEnabled;
|
||||||
BOOL isOpenGL;
|
|
||||||
|
|
||||||
NSColor *backgroundColor;
|
NSColor *backgroundColor;
|
||||||
ddb_analyzer_t _analyzer;
|
ddb_analyzer_t _analyzer;
|
||||||
|
@ -47,20 +46,10 @@ extern NSString *CogPlaybackDidStopNotficiation;
|
||||||
|
|
||||||
- (id)initWithFrame:(NSRect)frame {
|
- (id)initWithFrame:(NSRect)frame {
|
||||||
NSDictionary *sceneOptions = @{
|
NSDictionary *sceneOptions = @{
|
||||||
SCNPreferredRenderingAPIKey: @(SCNRenderingAPIOpenGLCore32)
|
|
||||||
};
|
|
||||||
isOpenGL = YES;
|
|
||||||
|
|
||||||
if(@available(macOS 10.15, *)) {
|
|
||||||
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
|
|
||||||
if([device supportsFamily:MTLGPUFamilyMac2]) {
|
|
||||||
sceneOptions = @{
|
|
||||||
SCNPreferredRenderingAPIKey: @(SCNRenderingAPIMetal),
|
SCNPreferredRenderingAPIKey: @(SCNRenderingAPIMetal),
|
||||||
SCNPreferredDeviceKey: device
|
SCNPreferredDeviceKey: MTLCreateSystemDefaultDevice(),
|
||||||
|
SCNPreferLowPowerDeviceKey: @(NO)
|
||||||
};
|
};
|
||||||
isOpenGL = NO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self = [super initWithFrame:frame options:sceneOptions];
|
self = [super initWithFrame:frame options:sceneOptions];
|
||||||
if(self) {
|
if(self) {
|
||||||
|
@ -117,8 +106,6 @@ extern NSString *CogPlaybackDidStopNotficiation;
|
||||||
SCNMaterial *material = materials[0];
|
SCNMaterial *material = materials[0];
|
||||||
material.diffuse.contents = barColor;
|
material.diffuse.contents = barColor;
|
||||||
material.emission.contents = barColor;
|
material.emission.contents = barColor;
|
||||||
if(isOpenGL)
|
|
||||||
material.emission.intensity = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -128,8 +115,6 @@ extern NSString *CogPlaybackDidStopNotficiation;
|
||||||
SCNMaterial *material = materials[0];
|
SCNMaterial *material = materials[0];
|
||||||
material.diffuse.contents = dotColor;
|
material.diffuse.contents = dotColor;
|
||||||
material.emission.contents = dotColor;
|
material.emission.contents = dotColor;
|
||||||
if(isOpenGL)
|
|
||||||
material.emission.intensity = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +330,7 @@ extern NSString *CogPlaybackDidStopNotficiation;
|
||||||
SCNNode *dotNode = nodes[i + 1 + 11];
|
SCNNode *dotNode = nodes[i + 1 + 11];
|
||||||
SCNVector3 position = node.position;
|
SCNVector3 position = node.position;
|
||||||
position.y = maxValue * 0.5;
|
position.y = maxValue * 0.5;
|
||||||
node.scale = SCNVector3Make(1.0, maxValue + 1e-7, 1.0);
|
node.scale = SCNVector3Make(1.0, maxValue, 1.0);
|
||||||
node.position = position;
|
node.position = position;
|
||||||
|
|
||||||
position = dotNode.position;
|
position = dotNode.position;
|
||||||
|
|
Loading…
Reference in New Issue