Merge remote-tracking branch 'origin'

This commit is contained in:
Philip Rosedale 2013-03-04 17:01:24 -08:00
commit 04bd98cf85
6 changed files with 89 additions and 10 deletions

View file

@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 2.8)
project(hifi) project(hifi)
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
set(CMAKE_OSX_SYSROOT macosx)
endif()
add_subdirectory(space) add_subdirectory(space)
add_subdirectory(domain) add_subdirectory(domain)
add_subdirectory(mixer) add_subdirectory(mixer)

View file

@ -12,8 +12,6 @@ if (APPLE)
# link in required OS X frameworks and include the right GL headers # link in required OS X frameworks and include the right GL headers
set(CMAKE_EXE_LINKER_FLAGS "-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework CoreServices -framework Carbon") set(CMAKE_EXE_LINKER_FLAGS "-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework CoreServices -framework Carbon")
set(GL_HEADERS "#include <GLUT/glut.h>\n#include <OpenGL/glext.h>") set(GL_HEADERS "#include <GLUT/glut.h>\n#include <OpenGL/glext.h>")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
set(CMAKE_OSX_SYSROOT macosx)
else (APPLE) else (APPLE)
# include the right GL headers for UNIX # include the right GL headers for UNIX
set(GL_HEADERS "#include <GL/gl.h>\n#include <GL/glut.h>\n#include <GL/glext.h>") set(GL_HEADERS "#include <GL/gl.h>\n#include <GL/glut.h>\n#include <GL/glext.h>")
@ -23,7 +21,7 @@ endif (APPLE)
configure_file(InterfaceConfig.h.in ${PROJECT_BINARY_DIR}/includes/InterfaceConfig.h) configure_file(InterfaceConfig.h.in ${PROJECT_BINARY_DIR}/includes/InterfaceConfig.h)
# grab the implementation and header files from src dir # grab the implementation and header files from src dir
file(GLOB INTERFACE_SRCS src/*.cpp src/*.h) file(GLOB INTERFACE_SRCS src/*.mm src/*.cpp src/*.h)
if (APPLE) if (APPLE)
# set how the icon shows up in the Info.plist file # set how the icon shows up in the Info.plist file

View file

@ -0,0 +1,8 @@
#ifndef __interface__InterfaceMacOSX
#define __interface__InterfaceMacOSX
class Oscilloscope;
void initMacOSXMenu(Oscilloscope *audioScope);
#endif

View file

@ -0,0 +1,68 @@
#include "Oscilloscope.h"
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import "InterfaceMacOSX.h"
@class InterfaceMainMenuTarget;
static InterfaceMainMenuTarget *sharedInterfaceMainMenuTarget = nil;
static Oscilloscope *sharedAudioScope;
@interface InterfaceMainMenuTarget : NSObject
@property (strong, nonatomic) NSMenuItem *scopeAudioMenuItem;
@property (strong, nonatomic) NSMenuItem *scopeNoneMenuItem;
@end
@implementation InterfaceMainMenuTarget
- (void)scopeAudioAction {
sharedAudioScope->setState(true);
[self.scopeAudioMenuItem setState:NSOnState];
[self.scopeNoneMenuItem setState:NSOffState];
}
- (void)scopeNoneAction {
sharedAudioScope->setState(false);
[self.scopeAudioMenuItem setState:NSOffState];
[self.scopeNoneMenuItem setState:NSOnState];
}
@end
void initMacOSXMenu(Oscilloscope *audioScope) {
@autoreleasepool {
if (NSApp) {
if (!sharedInterfaceMainMenuTarget) {
sharedInterfaceMainMenuTarget = [[InterfaceMainMenuTarget alloc] init];
}
sharedAudioScope = audioScope;
NSMenu *mainMenu = [NSApp mainMenu];
NSMenuItem *scopeMenuItem = [mainMenu insertItemWithTitle:@"Scope"
action:nil
keyEquivalent:@""
atIndex:3];
NSMenu *scopeMenu = [[[NSMenu alloc] init] initWithTitle:@"Scope"];
[scopeMenuItem setSubmenu:scopeMenu];
sharedInterfaceMainMenuTarget.scopeAudioMenuItem = [scopeMenu addItemWithTitle:@"Audio"
action:@selector(scopeAudioAction)
keyEquivalent:@""];
[sharedInterfaceMainMenuTarget.scopeAudioMenuItem setTarget:sharedInterfaceMainMenuTarget];
[sharedInterfaceMainMenuTarget.scopeAudioMenuItem setState:NSOnState];
sharedInterfaceMainMenuTarget.scopeNoneMenuItem = [scopeMenu addItemWithTitle:@"None"
action:@selector(scopeNoneAction)
keyEquivalent:@""];
[sharedInterfaceMainMenuTarget.scopeNoneMenuItem setTarget:sharedInterfaceMainMenuTarget];
}
}
}

View file

@ -44,6 +44,12 @@
#include "Oscilloscope.h" #include "Oscilloscope.h"
#include "UDPSocket.h" #include "UDPSocket.h"
#ifdef __APPLE__
#include "InterfaceMacOSX.h"
#endif
using namespace std; using namespace std;
int audio_on = 1; // Whether to turn on the audio support int audio_on = 1; // Whether to turn on the audio support
@ -961,7 +967,11 @@ int main(int argc, char** argv)
printf( "Init() complete.\n" ); printf( "Init() complete.\n" );
glutTimerFunc(1000, Timer, 0); glutTimerFunc(1000, Timer, 0);
#ifdef __APPLE__
initMacOSXMenu(&audioScope);
#endif
glutMainLoop(); glutMainLoop();
::terminate(); ::terminate();

View file

@ -96,7 +96,7 @@ void *sendBuffer(void *args)
int lowAgentIndex = std::min(i, j); int lowAgentIndex = std::min(i, j);
int highAgentIndex = std::max(i, j); int highAgentIndex = std::max(i, j);
if (distanceCoeffs[lowAgentIndex][highAgentIndex] != 0) { if (distanceCoeffs[lowAgentIndex][highAgentIndex] == 0) {
float distanceToAgent = sqrtf(powf(agentPosition[0] - otherAgentPosition[0], 2) + float distanceToAgent = sqrtf(powf(agentPosition[0] - otherAgentPosition[0], 2) +
powf(agentPosition[1] - otherAgentPosition[1], 2) + powf(agentPosition[1] - otherAgentPosition[1], 2) +
powf(agentPosition[2] - otherAgentPosition[2], 2)); powf(agentPosition[2] - otherAgentPosition[2], 2));