Merge and Cleanup

-Cleanup glmUtils(as in, get rid of it)
-Merge branch 'master' of https://github.com/worklist/hifi into view_frustum_work
This commit is contained in:
ZappoMan 2013-04-12 16:32:46 -07:00
commit 5504d87212
15 changed files with 65 additions and 103 deletions

View file

@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 2.8)
set(MACRO_DIR ../cmake/macros)
set(ROOT_DIR ../)
set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
set(TARGET_NAME audio-mixer)
@ -8,7 +10,7 @@ setup_hifi_project(${TARGET_NAME})
# link the shared hifi library
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME})
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
# link the threads library
find_package(Threads REQUIRED)

View file

@ -2,13 +2,16 @@ cmake_minimum_required(VERSION 2.8)
set(TARGET_NAME "avatar-mixer")
set(ROOT_DIR ../)
set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
# setup the project
include(../cmake/macros/SetupHifiProject.cmake)
include(${MACRO_DIR}/SetupHifiProject.cmake)
setup_hifi_project(${TARGET_NAME})
# link the shared hifi library
include(../cmake/macros/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME})
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
# link the threads library
find_package(Threads REQUIRED)

View file

@ -1,15 +1,15 @@
MACRO(LINK_HIFI_LIBRARY LIBRARY TARGET)
MACRO(LINK_HIFI_LIBRARY LIBRARY TARGET ROOT_DIR)
if (NOT TARGET ${LIBRARY})
add_subdirectory(../libraries/${LIBRARY} ../libraries/${LIBRARY})
add_subdirectory(${ROOT_DIR}/libraries/${LIBRARY} ${ROOT_DIR}/libraries/${LIBRARY})
endif (NOT TARGET ${LIBRARY})
string(TOUPPER ${LIBRARY} UPPERCASED_LIBRARY_NAME)
set(HIFI_LIBRARY_PROPERTY "HIFI_${UPPERCASED_LIBRARY_NAME}_LIBRARY")
get_directory_property(HIFI_LIBRARY
DIRECTORY ../libraries/${LIBRARY}
DIRECTORY ${ROOT_DIR}/libraries/${LIBRARY}
DEFINITION ${HIFI_LIBRARY_PROPERTY})
include_directories(../libraries/${LIBRARY}/src)
include_directories(${ROOT_DIR}/libraries/${LIBRARY}/src)
add_dependencies(${TARGET} ${LIBRARY})
target_link_libraries(${TARGET} ${LIBRARY})
@ -19,4 +19,4 @@ MACRO(LINK_HIFI_LIBRARY LIBRARY TARGET)
# link in required OS X framework
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreServices")
endif (APPLE)
ENDMACRO(LINK_HIFI_LIBRARY _library _target)
ENDMACRO(LINK_HIFI_LIBRARY _library _target _root_dir)

View file

@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 2.8)
set(MACRO_DIR ../cmake/macros)
set(ROOT_DIR ../)
set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
set(TARGET_NAME domain-server)
@ -8,4 +10,4 @@ setup_hifi_project(${TARGET_NAME})
# link the shared hifi library
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME})
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})

View file

@ -1,16 +1,16 @@
cmake_minimum_required(VERSION 2.8)
project(injector)
set(ROOT_DIR ../)
set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
# grab the implemenation and header files
file(GLOB INJECTOR_SRCS src/*.cpp src/*.h)
set(TARGET_NAME injector)
# add the executable
add_executable(injector ${INJECTOR_SRCS})
include(${MACRO_DIR}/SetupHifiProject.cmake)
setup_hifi_project(${TARGET_NAME})
# link the shared hifi library
include(../cmake/macros/LinkHifiLibrary.cmake)
link_hifi_library(shared injector)
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
# link the threads library
find_package(Threads REQUIRED)

View file

@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 2.8)
set(ROOT_DIR ../)
set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
set(TARGET_NAME interface)
project(${TARGET_NAME})
@ -22,7 +25,6 @@ if (WIN32)
endif (WIN32)
# set up the external glm library
set(MACRO_DIR ../cmake/macros)
include(${MACRO_DIR}/IncludeGLM.cmake)
include_glm(${TARGET_NAME} ${MACRO_DIR})
@ -54,10 +56,10 @@ add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS})
# link in the hifi shared library
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME})
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
# link in the hifi voxels library
link_hifi_library(voxels ${TARGET_NAME})
link_hifi_library(voxels ${TARGET_NAME} ${ROOT_DIR})
# find required libraries
find_package(GLM REQUIRED)

View file

@ -17,7 +17,6 @@
#include "Head.h"
#include <AgentList.h>
#include <AgentTypes.h>
#include <glmUtils.h>
using namespace std;
@ -1036,7 +1035,7 @@ void Head::updateHandMovement() {
transformedHandMovement
= avatar.orientation.getRight() * -movedHandOffset.x
+ avatar.orientation.getUp() * -movedHandOffset.y
+ avatar.orientation.getFront() * -movedHandOffset.y * 0.4;
+ avatar.orientation.getFront() * -movedHandOffset.y * 0.4f;
//if holding hands, add a pull to the hand...
if ( usingSprings ) {
@ -1081,7 +1080,7 @@ void Head::updateHandMovement() {
glm::vec3 newElbowPosition = avatar.bone[ AVATAR_BONE_RIGHT_SHOULDER ].position;
newElbowPosition += armVector * (float)ONE_HALF;
glm::vec3 perpendicular = glm::cross( avatar.orientation.getFront(), armVector );
newElbowPosition += perpendicular * ( 1.0 - ( avatar.maxArmLength / distance ) ) * ONE_HALF;
newElbowPosition += perpendicular * (float)(( 1.0f - ( avatar.maxArmLength / distance ) ) * ONE_HALF); // XXXBHG - Jeffery, you should clean this up. You can't multiple glm::vec3's by doubles, only floats
avatar.bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].position = newElbowPosition;
//-----------------------------------------------------------------------------

View file

@ -1,6 +1,5 @@
#include "Orientation.h"
#include "Util.h"
#include "glmUtils.h"
Orientation::Orientation() {
@ -55,9 +54,9 @@ void Orientation::pitch( float angle ) {
void Orientation::roll( float angle ) {
double r = angle * PI_OVER_180;
double s = sin( r );
double c = cos( r );
float r = angle * PI_OVER_180;
float s = sin( r );
float c = cos( r );
glm::vec3 cosineUp = up * c;
glm::vec3 cosineRight = right * c;

View file

@ -75,7 +75,6 @@
#include <PerfStat.h>
#include <SharedUtil.h>
#include <PacketHeaders.h>
#include <glmUtils.h>
#include "ViewFrustum.h"
@ -547,9 +546,9 @@ void render_view_frustum() {
////////////////////////////////////////
// Drawing the head direction vectors
glm::vec3 headLookingAt = headPosition+(headDirection*0.2);
glm::vec3 headLookingAtUp = headPosition+(headUp*0.2);
glm::vec3 headLookingAtRight = headPosition+(headRight*0.2);
glm::vec3 headLookingAt = headPosition+(headDirection*0.2f);
glm::vec3 headLookingAtUp = headPosition+(headUp*0.2f);
glm::vec3 headLookingAtRight = headPosition+(headRight*0.2f);
// Looking At from head = white
glColor3f(1,1,1);
@ -568,9 +567,9 @@ void render_view_frustum() {
////////////////////////////////////////
// Drawing the camera direction vectors
glm::vec3 cameraLookingAt = cameraPosition+(cameraDirection*0.2);
glm::vec3 cameraLookingAtUp = cameraPosition+(cameraUp*0.2);
glm::vec3 cameraLookingAtRight = cameraPosition+(cameraRight*0.2);
glm::vec3 cameraLookingAt = cameraPosition+(cameraDirection*0.2f);
glm::vec3 cameraLookingAtUp = cameraPosition+(cameraUp*0.2f);
glm::vec3 cameraLookingAtRight = cameraPosition+(cameraRight*0.2f);
// Looking At from camera = white
glColor3f(1,1,1);

View file

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 2.8)
set(MACRO_DIR ../../cmake/macros)
set(ROOT_DIR ../../)
set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
# setup for find modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
@ -18,5 +19,8 @@ file(GLOB HIFI_VOXELS_SRCS src/*.h src/*.cpp)
# create a library and set the property so it can be referenced later
add_library(${TARGET_NAME} ${HIFI_VOXELS_SRCS})
include_directories(${TARGET_NAME} ../shared/src)
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
set(HIFI_VOXELS_LIBRARY ${TARGET_NAME})

View file

@ -9,7 +9,6 @@
//
#include "ViewFrustum.h"
#include "glmUtils.h"
ViewFrustum::ViewFrustum(glm::vec3 position, glm::vec3 direction, glm::vec3 up, glm::vec3 right, float screenWidth, float screenHeight) {
this->calculateViewFrustum(position, direction, up, right, screenWidth, screenHeight);
@ -47,16 +46,16 @@ void ViewFrustum::calculateViewFrustum(glm::vec3 position, glm::vec3 direction,
this->_farWidth = this->_farHeight * ratio;
this->_farCenter = this->_position+front*this->_farDist;
this->_farTopLeft = this->_farCenter + (this->_up*this->_farHeight*0.5) - (this->_right*this->_farWidth*0.5);
this->_farTopRight = this->_farCenter + (this->_up*this->_farHeight*0.5) + (this->_right*this->_farWidth*0.5);
this->_farBottomLeft = this->_farCenter - (this->_up*this->_farHeight*0.5) - (this->_right*this->_farWidth*0.5);
this->_farBottomRight = this->_farCenter - (this->_up*this->_farHeight*0.5) + (this->_right*this->_farWidth*0.5);
this->_farTopLeft = this->_farCenter + (this->_up*this->_farHeight*0.5f) - (this->_right*this->_farWidth*0.5f);
this->_farTopRight = this->_farCenter + (this->_up*this->_farHeight*0.5f) + (this->_right*this->_farWidth*0.5f);
this->_farBottomLeft = this->_farCenter - (this->_up*this->_farHeight*0.5f) - (this->_right*this->_farWidth*0.5f);
this->_farBottomRight = this->_farCenter - (this->_up*this->_farHeight*0.5f) + (this->_right*this->_farWidth*0.5f);
this->_nearCenter = this->_position+front*this->_nearDist;
this->_nearTopLeft = this->_nearCenter + (this->_up*this->_nearHeight*0.5) - (this->_right*this->_nearWidth*0.5);
this->_nearTopRight = this->_nearCenter + (this->_up*this->_nearHeight*0.5) + (this->_right*this->_nearWidth*0.5);
this->_nearBottomLeft = this->_nearCenter - (this->_up*this->_nearHeight*0.5) - (this->_right*this->_nearWidth*0.5);
this->_nearBottomRight = this->_nearCenter - (this->_up*this->_nearHeight*0.5) + (this->_right*this->_nearWidth*0.5);
this->_nearTopLeft = this->_nearCenter + (this->_up*this->_nearHeight*0.5f) - (this->_right*this->_nearWidth*0.5f);
this->_nearTopRight = this->_nearCenter + (this->_up*this->_nearHeight*0.5f) + (this->_right*this->_nearWidth*0.5f);
this->_nearBottomLeft = this->_nearCenter - (this->_up*this->_nearHeight*0.5f) - (this->_right*this->_nearWidth*0.5f);
this->_nearBottomRight = this->_nearCenter - (this->_up*this->_nearHeight*0.5f) + (this->_right*this->_nearWidth*0.5f);
}
void ViewFrustum::dump() {

View file

@ -1,33 +0,0 @@
//
// glmUtils.cpp
// hifi
//
// Created by Brad Hefta-Gaub on 4/12/13.
//
//
#include <glm/glm.hpp>
// XXXBHG - These handy operators should probably go somewhere else, I'm surprised they don't
// already exist somewhere in OpenGL. Maybe someone can point me to them if they do exist!
glm::vec3 operator* (float lhs, const glm::vec3& rhs)
{
glm::vec3 result = rhs;
result.x *= lhs;
result.y *= lhs;
result.z *= lhs;
return result;
}
// XXXBHG - These handy operators should probably go somewhere else, I'm surprised they don't
// already exist somewhere in OpenGL. Maybe someone can point me to them if they do exist!
glm::vec3 operator* (const glm::vec3& lhs, float rhs)
{
glm::vec3 result = lhs;
result.x *= rhs;
result.y *= rhs;
result.z *= rhs;
return result;
}

View file

@ -1,18 +0,0 @@
//
// glmUtils.h
// hifi
//
// Created by Brad Hefta-Gaub on 4/12/13.
//
//
#ifndef __hifi__glmUtils__
#define __hifi__glmUtils__
#include <glm/glm.hpp>
glm::vec3 operator* (float lhs, const glm::vec3& rhs);
glm::vec3 operator* (const glm::vec3& lhs, float rhs);
#endif // __hifi__glmUtils__

View file

@ -1,11 +1,13 @@
cmake_minimum_required(VERSION 2.8)
set(ROOT_DIR ../)
set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
set(TARGET_NAME space-server)
set(MACRO_DIR ../cmake/macros)
include(${MACRO_DIR}/SetupHifiProject.cmake)
setup_hifi_project(${TARGET_NAME})
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME})
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})

View file

@ -2,14 +2,16 @@ cmake_minimum_required(VERSION 2.8)
set(TARGET_NAME voxel-server)
set(MACRO_DIR ../cmake/macros)
set(ROOT_DIR ../)
set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
include(${MACRO_DIR}/SetupHifiProject.cmake)
setup_hifi_project(${TARGET_NAME})
# link in the shared library
include(${MACRO_DIR}/LinkHifiLibrary.cmake)
link_hifi_library(shared ${TARGET_NAME})
link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR})
# link in the hifi voxels library
link_hifi_library(voxels ${TARGET_NAME})
link_hifi_library(voxels ${TARGET_NAME} ${ROOT_DIR})