This commit is contained in:
Jeffrey Ventrella 2013-04-12 16:12:54 -07:00
commit 5cb0d84990
12 changed files with 99 additions and 85 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

@ -33,17 +33,17 @@
// int sampleAt;
void CounterStatHistory::recordSample(long int thisCount) {
void CounterStatHistory::recordSample(long thisCount) {
timeval now;
gettimeofday(&now,NULL);
double nowSeconds = (now.tv_usec/1000000.0)+(now.tv_sec);
this->recordSample(nowSeconds,thisCount);
}
void CounterStatHistory::recordSample(double thisTime, long int thisCount) {
void CounterStatHistory::recordSample(double thisTime, long thisCount) {
// how much did we change since last sample?
long int thisDelta = thisCount - this->lastCount;
long thisDelta = thisCount - this->lastCount;
double elapsed = thisTime - this->lastTime;
// record the latest values
@ -74,12 +74,12 @@ void CounterStatHistory::recordSample(double thisTime, long int thisCount) {
}
long int CounterStatHistory::getRunningAverage() {
long CounterStatHistory::getRunningAverage() {
// before we calculate our running average, always "reset" the current count, with the current time
// this will flush out old data, if we haven't been adding any new data.
this->recordSample(this->currentCount);
long int runningTotal = 0;
long runningTotal = 0;
double minTime = this->timeSamples[0];
double maxTime = this->timeSamples[0];
@ -90,6 +90,6 @@ long int CounterStatHistory::getRunningAverage() {
}
double elapsedTime = maxTime-minTime;
long int runningAverage = runningTotal/elapsedTime;
long runningAverage = runningTotal/elapsedTime;
return runningAverage;
}

View file

@ -22,58 +22,56 @@
#define COUNTETSTATS_TIME_FRAME (COUNTETSTATS_SAMPLES_TO_KEEP*COUNTETSTATS_TIME_BETWEEN_SAMPLES)
class CounterStatHistory {
public:
std::string name;
CounterStatHistory(std::string myName):
currentCount(0), currentDelta(0),currentTime(0.0),
lastCount(0),lastTime(0.0),
totalTime(0.0),
sampleAt(-1), sampleCount(0), name(myName) {};
CounterStatHistory():
currentCount(0), currentDelta(0),currentTime(0.0),
lastCount(0),lastTime(0.0),
totalTime(0.0),
sampleAt(-1), sampleCount(0) {};
CounterStatHistory(std::string myName, double initialTime, long initialCount) :
currentCount(initialCount), currentDelta(0), currentTime(initialTime),
lastCount(initialCount),lastTime(initialTime),
totalTime(initialTime),
sampleAt(-1), sampleCount(0), name(myName) {};
void recordSample(long thisCount);
void recordSample(double thisTime, long thisCount);
long getRunningAverage();
long getAverage() {
return currentCount/totalTime;
};
double getTotalTime() {
return totalTime;
};
long getCount() {
return currentCount;
};
private:
long int currentCount;
long int currentDelta;
long currentCount;
long currentDelta;
double currentTime;
long int lastCount;
long lastCount;
double lastTime;
double totalTime;
long int countSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
long int deltaSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
long countSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
long deltaSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
double timeSamples[COUNTETSTATS_SAMPLES_TO_KEEP];
int sampleAt;
int sampleCount;
public:
std::string name;
CounterStatHistory(std::string myName):
currentCount(0), currentDelta(0),currentTime(0.0),
lastCount(0),lastTime(0.0),
totalTime(0.0),
sampleAt(-1),sampleCount(0), name(myName) {};
CounterStatHistory():
currentCount(0), currentDelta(0),currentTime(0.0),
lastCount(0),lastTime(0.0),
totalTime(0.0),
sampleAt(-1),sampleCount(0) {};
CounterStatHistory(std::string myName, double initialTime, long int initialCount) :
currentCount(initialCount), currentDelta(0), currentTime(initialTime),
lastCount(initialCount),lastTime(initialTime),
totalTime(initialTime),
sampleAt(-1), sampleCount(0), name(myName) {};
void recordSample(long int thisCount);
void recordSample(double thisTime, long int thisCount);
long int getRunningAverage();
long int getAverage() {
return currentCount/totalTime;
};
double getTotalTime() {
return totalTime;
};
long int getCount() {
return currentCount;
};
};
#endif /* defined(__hifi__CounterStat__) */

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

@ -19,15 +19,10 @@ const int MAX_TREE_SLICE_BYTES = 26;
const int TREE_SCALE = 10;
class VoxelTree {
VoxelNode * nodeForOctalCode(VoxelNode *ancestorNode, unsigned char * needleCode, VoxelNode** parentOfFoundNode);
VoxelNode * createMissingNode(VoxelNode *lastParentNode, unsigned char *deepestCodeToCreate);
int readNodeData(VoxelNode *destinationNode, unsigned char * nodeData, int bufferSizeBytes);
public:
long int voxelsCreated;
long int voxelsColored;
long int voxelsBytesRead;
long voxelsCreated;
long voxelsColored;
long voxelsBytesRead;
CounterStatHistory voxelsCreatedStats;
CounterStatHistory voxelsColoredStats;
@ -56,6 +51,10 @@ public:
void loadVoxelsFile(const char* fileName, bool wantColorRandomizer);
void createSphere(float r,float xc, float yc, float zc, float s, bool solid, bool wantColorRandomizer);
private:
VoxelNode * nodeForOctalCode(VoxelNode *ancestorNode, unsigned char * needleCode, VoxelNode** parentOfFoundNode);
VoxelNode * createMissingNode(VoxelNode *lastParentNode, unsigned char *deepestCodeToCreate);
int readNodeData(VoxelNode *destinationNode, unsigned char * nodeData, int bufferSizeBytes);
};
int boundaryDistanceForRenderLevel(unsigned int renderLevel);

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})