Moved all the avatar bits to their own subdirectory.

This commit is contained in:
Andrzej Kapolka 2013-07-11 14:53:46 -07:00
parent c3242598f5
commit 61f6b8b974
19 changed files with 21 additions and 20 deletions

View file

@ -36,7 +36,7 @@ configure_file(InterfaceConfig.h.in ${PROJECT_BINARY_DIR}/includes/InterfaceConf
# grab the implementation and header files from src dirs # grab the implementation and header files from src dirs
file(GLOB INTERFACE_SRCS src/*.cpp src/*.h) file(GLOB INTERFACE_SRCS src/*.cpp src/*.h)
foreach(SUBDIR ui renderer) foreach(SUBDIR avatar ui renderer)
file(GLOB SUBDIR_SRCS src/${SUBDIR}/*.cpp src/${SUBDIR}/*.h) file(GLOB SUBDIR_SRCS src/${SUBDIR}/*.cpp src/${SUBDIR}/*.h)
set(INTERFACE_SRCS ${INTERFACE_SRCS} ${SUBDIR_SRCS}) set(INTERFACE_SRCS ${INTERFACE_SRCS} ${SUBDIR_SRCS})
endforeach(SUBDIR) endforeach(SUBDIR)
@ -75,7 +75,7 @@ add_subdirectory(external/fervor/)
include_directories(external/fervor/) include_directories(external/fervor/)
# run qt moc on qt-enabled headers # run qt moc on qt-enabled headers
qt4_wrap_cpp(INTERFACE_SRCS src/Application.h src/AvatarVoxelSystem.h src/Webcam.h src/ui/BandwidthDialog.h) qt4_wrap_cpp(INTERFACE_SRCS src/Application.h src/Webcam.h src/avatar/AvatarVoxelSystem.h src/ui/BandwidthDialog.h)
# create the executable, make it a bundle on OS X # create the executable, make it a bundle on OS X
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS}) add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS})

View file

@ -20,27 +20,27 @@
#include <QList> #include <QList>
#include <NodeList.h> #include <NodeList.h>
#include <PacketHeaders.h>
#include "BandwidthMeter.h" #include <ViewFrustum.h>
#include "ui/BandwidthDialog.h"
#ifndef _WIN32 #ifndef _WIN32
#include "Audio.h" #include "Audio.h"
#endif #endif
#include "BandwidthMeter.h"
#include "Camera.h" #include "Camera.h"
#include "Environment.h" #include "Environment.h"
#include "HandControl.h"
#include "SerialInterface.h" #include "SerialInterface.h"
#include "Stars.h" #include "Stars.h"
#include "ViewFrustum.h"
#include "VoxelSystem.h"
#include "PacketHeaders.h"
#include "Webcam.h"
#include "renderer/GeometryCache.h"
#include "ui/ChatEntry.h"
#include "ToolsPalette.h"
#include "Swatch.h" #include "Swatch.h"
#include "ToolsPalette.h"
#include "VoxelSystem.h"
#include "Webcam.h"
#include "avatar/HandControl.h"
#include "renderer/GeometryCache.h"
#include "ui/BandwidthDialog.h"
#include "ui/ChatEntry.h"
class QAction; class QAction;
class QActionGroup; class QActionGroup;

View file

@ -14,7 +14,7 @@
#include <StdDev.h> #include <StdDev.h>
#include "Oscilloscope.h" #include "Oscilloscope.h"
#include "Avatar.h" #include "avatar/Avatar.h"
static const int NUM_AUDIO_CHANNELS = 2; static const int NUM_AUDIO_CHANNELS = 2;

View file

@ -148,7 +148,8 @@ Webcam::~Webcam() {
delete _grabber; delete _grabber;
} }
void Webcam::setFrame(const Mat& frame, int format, const Mat& depth, const RotatedRect& faceRect, const JointVector& joints) { void Webcam::setFrame(const Mat& frame, int format, const Mat& depth, const Mat& depthPreview,
const RotatedRect& faceRect, const JointVector& joints) {
IplImage image = frame; IplImage image = frame;
glPixelStorei(GL_UNPACK_ROW_LENGTH, image.widthStep / 3); glPixelStorei(GL_UNPACK_ROW_LENGTH, image.widthStep / 3);
if (_frameTextureID == 0) { if (_frameTextureID == 0) {
@ -164,8 +165,8 @@ void Webcam::setFrame(const Mat& frame, int format, const Mat& depth, const Rota
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _frameWidth, _frameHeight, format, GL_UNSIGNED_BYTE, image.imageData); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _frameWidth, _frameHeight, format, GL_UNSIGNED_BYTE, image.imageData);
} }
if (!depth.empty()) { if (!depthPreview.empty()) {
IplImage depthImage = depth; IplImage depthImage = depthPreview;
glPixelStorei(GL_UNPACK_ROW_LENGTH, depthImage.widthStep); glPixelStorei(GL_UNPACK_ROW_LENGTH, depthImage.widthStep);
if (_depthTextureID == 0) { if (_depthTextureID == 0) {
glGenTextures(1, &_depthTextureID); glGenTextures(1, &_depthTextureID);
@ -381,7 +382,7 @@ void FrameGrabber::grabFrame() {
return; return;
} }
int format = GL_BGR; int format = GL_BGR;
Mat frame; Mat frame, depth;
JointVector joints; JointVector joints;
#ifdef HAVE_OPENNI #ifdef HAVE_OPENNI
@ -390,7 +391,7 @@ void FrameGrabber::grabFrame() {
frame = Mat(_imageMetaData.YRes(), _imageMetaData.XRes(), CV_8UC3, (void*)_imageGenerator.GetImageMap()); frame = Mat(_imageMetaData.YRes(), _imageMetaData.XRes(), CV_8UC3, (void*)_imageGenerator.GetImageMap());
format = GL_RGB; format = GL_RGB;
Mat depth = Mat(_depthMetaData.YRes(), _depthMetaData.XRes(), CV_16UC1, (void*)_depthGenerator.GetDepthMap()); depth = Mat(_depthMetaData.YRes(), _depthMetaData.XRes(), CV_16UC1, (void*)_depthGenerator.GetDepthMap());
const double EIGHT_BIT_MAX = 255; const double EIGHT_BIT_MAX = 255;
const double ELEVEN_BIT_MAX = 2047; const double ELEVEN_BIT_MAX = 2047;
depth.convertTo(_grayDepthFrame, CV_8UC1, EIGHT_BIT_MAX / ELEVEN_BIT_MAX); depth.convertTo(_grayDepthFrame, CV_8UC1, EIGHT_BIT_MAX / ELEVEN_BIT_MAX);
@ -476,7 +477,7 @@ void FrameGrabber::grabFrame() {
_searchWindow = faceRect.boundingRect(); _searchWindow = faceRect.boundingRect();
} }
QMetaObject::invokeMethod(Application::getInstance()->getWebcam(), "setFrame", QMetaObject::invokeMethod(Application::getInstance()->getWebcam(), "setFrame",
Q_ARG(cv::Mat, frame), Q_ARG(int, format), Q_ARG(cv::Mat, _grayDepthFrame), Q_ARG(cv::Mat, frame), Q_ARG(int, format), Q_ARG(cv::Mat, depth), Q_ARG(cv::Mat, _grayDepthFrame),
Q_ARG(cv::RotatedRect, faceRect), Q_ARG(JointVector, joints)); Q_ARG(cv::RotatedRect, faceRect), Q_ARG(JointVector, joints));
} }

View file

@ -54,7 +54,7 @@ public slots:
void setEnabled(bool enabled); void setEnabled(bool enabled);
void setFrame(const cv::Mat& video, int format, const cv::Mat& depth, void setFrame(const cv::Mat& video, int format, const cv::Mat& depth,
const cv::RotatedRect& faceRect, const JointVector& joints); const cv::Mat& depthPreview, const cv::RotatedRect& faceRect, const JointVector& joints);
private: private: