From d70da7f215804ad3622899e8e790e26b813f0f09 Mon Sep 17 00:00:00 2001 From: Kees van Prooijen Date: Tue, 19 Mar 2013 11:49:28 -0700 Subject: [PATCH] some more warning removal, temporarily excluding portaudio for windows --- interface/CMakeLists.txt | 42 ++++++++------ interface/src/Head.cpp | 100 ++++++++++++++++---------------- interface/src/SerialInterface.h | 2 +- shared/src/OctalCode.cpp | 2 +- 4 files changed, 75 insertions(+), 71 deletions(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 2d16d4858a..73d1387ca5 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -71,28 +71,32 @@ target_link_libraries(interface ${LODEPNG_LIBRARY} ) -# include PortAudio as external project -include(ExternalProject) -set(PORTAUDIO_PROJ_DIR external/portaudio) -ExternalProject_Add( - portaudio - PREFIX ${PORTAUDIO_PROJ_DIR} - BINARY_DIR ${PORTAUDIO_PROJ_DIR}/src/portaudio - URL ${PORTAUDIO_DIR}/pa_snapshot_020813.tgz - CONFIGURE_COMMAND /configure --prefix "${PROJECT_BINARY_DIR}/${PORTAUDIO_PROJ_DIR}" - BUILD_COMMAND make -) +if (WIN32) +else (WIN32) + # include PortAudio as external project + include(ExternalProject) + set(PORTAUDIO_PROJ_DIR external/portaudio) + ExternalProject_Add( + portaudio + PREFIX ${PORTAUDIO_PROJ_DIR} + BINARY_DIR ${PORTAUDIO_PROJ_DIR}/src/portaudio + URL ${PORTAUDIO_DIR}/pa_snapshot_020813.tgz + CONFIGURE_COMMAND /configure --prefix "${PROJECT_BINARY_DIR}/${PORTAUDIO_PROJ_DIR}" + BUILD_COMMAND make + ) -# make PortAudio a dependency of the interface executable -add_dependencies(interface portaudio) + # make PortAudio a dependency of the interface executable + add_dependencies(interface portaudio) -# include the PortAudio headers -ExternalProject_Get_Property(portaudio source_dir) -include_directories(${source_dir}/include) + # include the PortAudio headers + ExternalProject_Get_Property(portaudio source_dir) + include_directories(${source_dir}/include) -# link the PortAudio library -ExternalProject_Get_Property(portaudio binary_dir) -target_link_libraries(interface ${binary_dir}/lib/.libs/libportaudio.a) + # link the PortAudio library + ExternalProject_Get_Property(portaudio binary_dir) + target_link_libraries(interface ${binary_dir}/lib/.libs/libportaudio.a) + +endif (WIN32) # link required libraries on UNIX if (UNIX AND NOT APPLE) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 7b7445f7e2..0247783ad7 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -16,20 +16,20 @@ using namespace std; -float skinColor[] = {1.0, 0.84, 0.66}; -float browColor[] = {210.0/255.0, 105.0/255.0, 30.0/255.0}; +float skinColor[] = {1.0f, 0.84f, 0.66f}; +float browColor[] = {210.0f/255.0f, 105.0f/255.0f, 30.0f/255.0f}; float mouthColor[] = {1, 0, 0}; float BrowRollAngle[5] = {0, 15, 30, -30, -15}; float BrowPitchAngle[3] = {-70, -60, -50}; float eyeColor[3] = {1,1,1}; -float MouthWidthChoices[3] = {0.5, 0.77, 0.3}; +float MouthWidthChoices[3] = {0.5f, 0.77f, 0.3f}; -float browWidth = 0.8; -float browThickness = 0.16; +float browWidth = 0.8f; +float browThickness = 0.16f; -const float DECAY = 0.1; +const float DECAY = 0.1f; char iris_texture_file[] = "interface.app/Contents/Resources/images/green_eye.png"; @@ -42,20 +42,20 @@ GLUquadric *sphere = gluNewQuadric(); Head::Head() { position.x = position.y = position.z = 0; - PupilSize = 0.10; - interPupilDistance = 0.6; - interBrowDistance = 0.75; - NominalPupilSize = 0.10; - Yaw = 0.0; + PupilSize = 0.10f; + interPupilDistance = 0.6f; + interBrowDistance = 0.75f; + NominalPupilSize = 0.10f; + Yaw = 0.0f; EyebrowPitch[0] = EyebrowPitch[1] = -30; EyebrowRoll[0] = 20; EyebrowRoll[1] = -20; MouthPitch = 0; MouthYaw = 0; MouthWidth = 1.0; - MouthHeight = 0.2; + MouthHeight = 0.2f; EyeballPitch[0] = EyeballPitch[1] = 0; - EyeballScaleX = 1.2; EyeballScaleY = 1.5; EyeballScaleZ = 1.0; + EyeballScaleX = 1.2f; EyeballScaleY = 1.5f; EyeballScaleZ = 1.0f; EyeballYaw[0] = EyeballYaw[1] = 0; PitchTarget = YawTarget = 0; NoiseEnvelope = 1.0; @@ -150,13 +150,13 @@ void Head::UpdatePos(float frametime, SerialInterface * serialInterface, int hea const float PITCH_ACCEL_COUPLING = 0.5; const float ROLL_ACCEL_COUPLING = -1.0; - float measured_pitch_rate = serialInterface->getRelativeValue(PITCH_RATE); - YawRate = serialInterface->getRelativeValue(YAW_RATE); + float measured_pitch_rate = static_cast(serialInterface->getRelativeValue(PITCH_RATE)); + YawRate = static_cast(serialInterface->getRelativeValue(YAW_RATE)); float measured_lateral_accel = serialInterface->getRelativeValue(ACCEL_X) - ROLL_ACCEL_COUPLING*serialInterface->getRelativeValue(ROLL_RATE); float measured_fwd_accel = serialInterface->getRelativeValue(ACCEL_Z) - PITCH_ACCEL_COUPLING*serialInterface->getRelativeValue(PITCH_RATE); - float measured_roll_rate = serialInterface->getRelativeValue(ROLL_RATE); + float measured_roll_rate = static_cast(serialInterface->getRelativeValue(ROLL_RATE)); //std::cout << "Pitch Rate: " << serialInterface->getRelativeValue(PITCH_RATE) << // " fwd_accel: " << serialInterface->getRelativeValue(ACCEL_Z) << "\n"; @@ -165,9 +165,9 @@ void Head::UpdatePos(float frametime, SerialInterface * serialInterface, int hea //std::cout << "Pitch: " << Pitch << "\n"; // Update avatar head position based on measured gyro rates - const float HEAD_ROTATION_SCALE = 0.70; - const float HEAD_ROLL_SCALE = 0.40; - const float HEAD_LEAN_SCALE = 0.01; + const float HEAD_ROTATION_SCALE = 0.70f; + const float HEAD_ROLL_SCALE = 0.40f; + const float HEAD_LEAN_SCALE = 0.01f; const float MAX_PITCH = 45; const float MIN_PITCH = -45; const float MAX_YAW = 85; @@ -230,8 +230,8 @@ void Head::simulate(float deltaTime) eyeContact = 1; if (!eyeContact) { // If we just stopped making eye contact,move the eyes markedly away - EyeballPitch[0] = EyeballPitch[1] = EyeballPitch[0] + 5.0 + (randFloat() - 0.5)*10; - EyeballYaw[0] = EyeballYaw[1] = EyeballYaw[0] + 5.0 + (randFloat()- 0.5)*5; + EyeballPitch[0] = EyeballPitch[1] = EyeballPitch[0] + 5.0f + (randFloat() - 0.5f)*10.0f; + EyeballYaw[0] = EyeballYaw[1] = EyeballYaw[0] + 5.0f + (randFloat()- 0.5f)*5.0f; } else { // If now making eye contact, turn head to look right at viewer SetNewHeadTarget(0,0); @@ -256,15 +256,15 @@ void Head::simulate(float deltaTime) if (noise) { - Pitch += (randFloat() - 0.5)*0.2*NoiseEnvelope; - Yaw += (randFloat() - 0.5)*0.3*NoiseEnvelope; + Pitch += (randFloat() - 0.5f)*0.2f*NoiseEnvelope; + Yaw += (randFloat() - 0.5f)*0.3f*NoiseEnvelope; //PupilSize += (randFloat() - 0.5)*0.001*NoiseEnvelope; if (randFloat() < 0.005) MouthWidth = MouthWidthChoices[rand()%3]; if (!eyeContact) { - if (randFloat() < 0.01) EyeballPitch[0] = EyeballPitch[1] = (randFloat() - 0.5)*20; - if (randFloat() < 0.01) EyeballYaw[0] = EyeballYaw[1] = (randFloat()- 0.5)*10; + if (randFloat() < 0.01f) EyeballPitch[0] = EyeballPitch[1] = (randFloat() - 0.5f)*20.0f; + if (randFloat() < 0.01f) EyeballYaw[0] = EyeballYaw[1] = (randFloat()- 0.5f)*10.0f; } else { float eye_target_yaw_adjust = 0; float eye_target_pitch_adjust = 0; @@ -280,17 +280,17 @@ void Head::simulate(float deltaTime) if ((randFloat() < 0.005) && (fabs(PitchTarget - Pitch) < 1.0) && (fabs(YawTarget - Yaw) < 1.0)) { - SetNewHeadTarget((randFloat()-0.5)*20.0, (randFloat()-0.5)*45.0); + SetNewHeadTarget((randFloat()-0.5f)*20.0f, (randFloat()-0.5f)*45.0f); } if (0) { // Pick new target - PitchTarget = (randFloat() - 0.5)*45; - YawTarget = (randFloat() - 0.5)*22; + PitchTarget = (randFloat() - 0.5f)*45.0f; + YawTarget = (randFloat() - 0.5f)*22.0f; } - if (randFloat() < 0.01) + if (randFloat() < 0.01f) { EyebrowPitch[0] = EyebrowPitch[1] = BrowPitchAngle[rand()%3]; EyebrowRoll[0] = EyebrowRoll[1] = BrowRollAngle[rand()%5]; @@ -345,35 +345,35 @@ void Head::render(int faceToFace, int isMine, float * myLocation) for(side = 0; side < 2; side++) { glPushMatrix(); - glScalef(0.3, 0.65, .65); - glutSolidSphere(0.5, 30, 30); + glScalef(0.3f, 0.65f, .65f); + glutSolidSphere(0.5f, 30, 30); glPopMatrix(); - glTranslatef(-2.0, 0, 0); + glTranslatef(-2.0f, 0, 0); } glPopMatrix(); // Eyebrows - audioAttack = 0.9*audioAttack + 0.1*fabs(loudness - lastLoudness); + audioAttack = 0.9f*audioAttack + 0.1f*fabs(loudness - lastLoudness); lastLoudness = loudness; const float BROW_LIFT_THRESHOLD = 100; if (audioAttack > BROW_LIFT_THRESHOLD) - browAudioLift += sqrt(audioAttack)/1000.0; + browAudioLift += sqrt(audioAttack)/1000.0f; - browAudioLift *= .90; + browAudioLift *= .90f; glPushMatrix(); - glTranslatef(-interBrowDistance/2.0,0.4,0.45); + glTranslatef(-interBrowDistance/2.0f,0.4f,0.45f); for(side = 0; side < 2; side++) { glColor3fv(browColor); glPushMatrix(); - glTranslatef(0, 0.35 + browAudioLift, 0); - glRotatef(EyebrowPitch[side]/2.0, 1, 0, 0); - glRotatef(EyebrowRoll[side]/2.0, 0, 0, 1); + glTranslatef(0, 0.35f + browAudioLift, 0); + glRotatef(EyebrowPitch[side]/2.0f, 1, 0, 0); + glRotatef(EyebrowRoll[side]/2.0f, 0, 0, 1); glScalef(browWidth, browThickness, 1); - glutSolidCube(0.5); + glutSolidCube(0.5f); glPopMatrix(); glTranslatef(interBrowDistance, 0, 0); } @@ -383,23 +383,23 @@ void Head::render(int faceToFace, int isMine, float * myLocation) // Mouth glPushMatrix(); - glTranslatef(0,-0.35,0.75); + glTranslatef(0,-0.35f,0.75f); glColor3f(0,0,0); glRotatef(MouthPitch, 1, 0, 0); glRotatef(MouthYaw, 0, 0, 1); - glScalef(MouthWidth*(.7 + sqrt(averageLoudness)/60.0), MouthHeight*(1.0 + sqrt(averageLoudness)/30.0), 1); - glutSolidCube(0.5); + glScalef(MouthWidth*(.7f + sqrt(averageLoudness)/60.0f), MouthHeight*(1.0f + sqrt(averageLoudness)/30.0f), 1); + glutSolidCube(0.5f); glPopMatrix(); glTranslatef(0, 1.0, 0); - glTranslatef(-interPupilDistance/2.0,-0.68,0.7); + glTranslatef(-interPupilDistance/2.0f,-0.68f,0.7f); // Right Eye glRotatef(-10, 1, 0, 0); glColor3fv(eyeColor); glPushMatrix(); { - glTranslatef(interPupilDistance/10.0, 0, 0.05); + glTranslatef(interPupilDistance/10.0f, 0, 0.05f); glRotatef(20, 0, 0, 1); glScalef(EyeballScaleX, EyeballScaleY, EyeballScaleZ); glutSolidSphere(0.25, 30, 30); @@ -420,9 +420,9 @@ void Head::render(int faceToFace, int isMine, float * myLocation) { glRotatef(EyeballPitch[1], 1, 0, 0); glRotatef(EyeballYaw[1] + PupilConverge, 0, 1, 0); - glTranslatef(0,0,.35); + glTranslatef(0,0,.35f); glRotatef(-75,1,0,0); - glScalef(1.0, 0.4, 1.0); + glScalef(1.0f, 0.4f, 1.0f); glEnable(GL_TEXTURE_2D); gluSphere(sphere, PupilSize, 15, 15); @@ -435,7 +435,7 @@ void Head::render(int faceToFace, int isMine, float * myLocation) glTranslatef(interPupilDistance, 0, 0); glPushMatrix(); { - glTranslatef(-interPupilDistance/10.0, 0, .05); + glTranslatef(-interPupilDistance/10.0f, 0, .05f); glRotatef(-20, 0, 0, 1); glScalef(EyeballScaleX, EyeballScaleY, EyeballScaleZ); glutSolidSphere(0.25, 30, 30); @@ -446,9 +446,9 @@ void Head::render(int faceToFace, int isMine, float * myLocation) { glRotatef(EyeballPitch[0], 1, 0, 0); glRotatef(EyeballYaw[0] - PupilConverge, 0, 1, 0); - glTranslatef(0, 0, .35); + glTranslatef(0, 0, .35f); glRotatef(-75, 1, 0, 0); - glScalef(1.0, 0.4, 1.0); + glScalef(1.0f, 0.4f, 1.0f); glEnable(GL_TEXTURE_2D); gluSphere(sphere, PupilSize, 15, 15); diff --git a/interface/src/SerialInterface.h b/interface/src/SerialInterface.h index 323966bc9f..8849d7f5d9 100644 --- a/interface/src/SerialInterface.h +++ b/interface/src/SerialInterface.h @@ -40,7 +40,7 @@ public: int getLED() {return LED;}; int getNumSamples() {return samplesAveraged;}; int getValue(int num) {return lastMeasured[num];}; - int getRelativeValue(int num) {return lastMeasured[num] - trailingAverage[num];}; + int getRelativeValue(int num) {return static_cast(lastMeasured[num] - trailingAverage[num]);}; float getTrailingValue(int num) {return trailingAverage[num];}; void resetTrailingAverages(); void renderLevels(int width, int height); diff --git a/shared/src/OctalCode.cpp b/shared/src/OctalCode.cpp index 7a9c24e3d7..9a53e7cfb5 100644 --- a/shared/src/OctalCode.cpp +++ b/shared/src/OctalCode.cpp @@ -38,7 +38,7 @@ int bytesRequiredForCodeLength(unsigned char threeBitCodes) { if (threeBitCodes == 0) { return 1; } else { - return 1 + (int)ceilf((threeBitCodes * 3) / 8.0); + return 1 + (int)ceilf((threeBitCodes * 3) / 8.0f); } }