4 Commits

Author SHA1 Message Date
Jasper
26d438e4d1 [EDIT] models now generate in a 3x3 grid with always 9 models 2021-06-18 09:58:08 +02:00
Jasper
24285b9714 [ADD] added an extra layer to the grid for the lamps and fans. Grid now generates correctly.
Good enough
2021-06-11 16:34:25 +02:00
Jasper
fb70d10c47 [EDIT] made a grid for the models to load in
Some items still clip through the wall
2021-06-11 15:58:28 +02:00
Jasper
bce2ccf889 [ADD] added base for loading scene 2021-06-11 11:43:46 +02:00
28 changed files with 736 additions and 478 deletions

View File

@@ -0,0 +1,340 @@
#include "house_generator.h"
#include <functional>
#include <iostream>
#include "../renderEngine/obj_loader.h"
#include "../renderEngine/Loader.h"
#include "../toolbox/toolbox.h"
#include "collision_entity.h"
namespace entities
{
HouseGenerator::HouseGenerator()
{
models::RawModel raw_model = render_engine::LoadObjModel("res/HouseNew.obj");
default_texture = { render_engine::loader::LoadTexture("res/Texture.png") };
default_texture.shine_damper = 10;
house_model = { raw_model, default_texture };
GenerateFurnitureModels();
}
const FurniturePiece* HouseGenerator::GetRandomFurniturePiece()
{
FurnitureType random_type = FurnitureType(toolbox::Random(0, furniture_models.size() - 1));
for(std::deque<FurnitureModel>::iterator it = furniture_models.begin(); it != furniture_models.end(); ++it)
{
if(it->furniture.type == random_type)
{
return &it->furniture;
}
}
return nullptr;
}
std::deque<std::shared_ptr<Entity>> HouseGenerator::GenerateHouse(const glm::vec3& position, float y_rotation)
{
std::deque<std::shared_ptr<Entity>> furniture;
// Add house
furniture.push_front(std::make_shared<Entity>(house_model, position, glm::vec3(0, y_rotation, 0), HOUSE_SIZE));
int house_size = house_model.raw_model.model_size.x * HOUSE_SIZE;
int offset_x = house_model.raw_model.model_size.z * (HOUSE_SIZE/2);
int offset_z = house_model.raw_model.model_size.x *( HOUSE_SIZE/2);
double multiplier_x = house_size/2;
double multiplier_z = house_size / 3;
for (int z = 1; z < 4; z++) {
for (int x = 1; x < 3; x++)
{
//if (toolbox::Random(0, 100) < 50) {
const FurniturePiece* furniture_piece = GetRandomFurniturePiece();
models::TexturedModel model = GetFurnitureModel(furniture_piece);
//if (//check of size van furniture nog past in huidige grid vlakje, of ie geen 2 size op t laatste vakje neerzet) {
glm::vec3 model_pos = glm::vec3(position.x + (x * multiplier_x) - (multiplier_x/2) - offset_x, position.y, position.z + (z * multiplier_z) - (multiplier_z / 2) + offset_z);
collision::Box model_box = { model_pos, model.raw_model.model_size };
model_box.SetRotation(-90);
furniture.push_back(std::make_shared<CollisionEntity>(model, model_pos, glm::vec3(0, -90, 0), HOUSE_SIZE, model_box));
//}
//}
}
}
return furniture;
/*
// Add furniture
models::TexturedModel couch = GetFurnitureModel(FurnitureType::COUCH);
glm::vec3 couch_pos = glm::vec3(position.x + 200, position.y, position.z + 10);
collision::Box couch_box = { couch_pos, couch.raw_model.model_size };
couch_box.SetRotation(-90);
furniture.push_back(std::make_shared<CollisionEntity>(couch, couch_pos, glm::vec3(0, -90, 0), HOUSE_SIZE * 2, couch_box));
models::TexturedModel table = GetFurnitureModel(FurnitureType::TABLE);
glm::vec3 table_pos = glm::vec3(position.x - 30, position.y, position.z);
collision::Box table_box = { table_pos, table.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(table, table_pos, glm::vec3(0, 0, 0), HOUSE_SIZE * 1.3, table_box));
models::TexturedModel chair = GetFurnitureModel(FurnitureType::CHAIR);
glm::vec3 chair_pos = glm::vec3(position.x - 50, position.y, position.z + 220);
collision::Box chair_box = { chair_pos, chair.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(chair, chair_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, chair_box));
models::TexturedModel plant = GetFurnitureModel(FurnitureType::PLANT);
glm::vec3 plant_pos = glm::vec3(position.x - 50, position.y, position.z + 220);
collision::Box plant_box = { plant_pos, plant.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(plant, plant_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, plant_box));
models::TexturedModel guitar = GetFurnitureModel(FurnitureType::GUITAR);
glm::vec3 guitar_pos = glm::vec3(position.x - 50, position.y, position.z + 220);
collision::Box guitar_box = { guitar_pos, guitar.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(guitar, guitar_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, guitar_box));
models::TexturedModel bookshelf = GetFurnitureModel(FurnitureType::BOOKSHELF);
glm::vec3 bookshelf_pos = glm::vec3(position.x - 50, position.y, position.z + 220);
collision::Box bookshelf_box = { bookshelf_pos, bookshelf.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(bookshelf, bookshelf_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, bookshelf_box));
models::TexturedModel lamp = GetFurnitureModel(FurnitureType::LAMP);
glm::vec3 lamp_pos = glm::vec3(position.x - 50, position.y, position.z + 220);
collision::Box lamp_box = { lamp_pos, lamp.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(lamp, lamp_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, lamp_box));
models::TexturedModel ceiling_object = GetFurnitureModel(FurnitureType::CEILING_OBJECTS);
glm::vec3 ceiling_object_pos = glm::vec3(position.x - 50, position.y, position.z + 220);
collision::Box ceiling_object_box = { ceiling_object_pos, ceiling_object.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(ceiling_object, ceiling_object_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, ceiling_object_box));
models::TexturedModel misc = GetFurnitureModel(FurnitureType::MISC);
glm::vec3 misc_pos = glm::vec3(position.x - 50, position.y, position.z + 220);
collision::Box misc_box = { misc_pos, misc.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(misc, misc_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, misc_box));
*/
}
models::TexturedModel HouseGenerator::GetFurnitureModel(const FurniturePiece* furniture)
{
std::deque<models::TexturedModel> *furniture_list = nullptr;
for (std::deque<FurnitureModel>::iterator it = furniture_models.begin(); it != furniture_models.end(); ++it)
{
if(it->furniture.type == furniture->type)
{
furniture_list = &it->texture;
}
}
if (furniture_list == nullptr)
{
std::cerr << "OH NEEEEEEEEEEEEEEE";
}
const int modelNumber = toolbox::Random(0, furniture_list->size() - 1);
return furniture_list->at(modelNumber);
//return {};
}
void HouseGenerator::GenerateFurnitureModels()
{
// Couches
std::deque<models::TexturedModel> couches;
models::RawModel couch_inside_model = render_engine::LoadObjModel("res/couchThree.obj");
models::TexturedModel couch_inside = { couch_inside_model, default_texture };
couches.push_back(couch_inside);
models::RawModel couch_inside_model2 = render_engine::LoadObjModel("res/Coach.obj");
models::TexturedModel couch_inside2 = { couch_inside_model2, default_texture };
couches.push_back(couch_inside2);
models::RawModel couch_inside_model3 = render_engine::LoadObjModel("res/lawnBenchOne.obj");
models::TexturedModel couch_inside3 = { couch_inside_model3, default_texture };
couches.push_back(couch_inside3);
FurnitureModel couch;
couch.furniture = {
FurnitureType::COUCH, 2 };
couch.texture = couches;
furniture_models.push_back(couch);
// Tables
std::deque<models::TexturedModel> tables;
models::RawModel table_model1 = render_engine::LoadObjModel("res/tableOne.obj");
models::TexturedModel table1 = { table_model1, default_texture };
tables.push_back(table1);
models::RawModel table_model2 = render_engine::LoadObjModel("res/tableTwo.obj");
models::TexturedModel table2 = { table_model2, default_texture };
tables.push_back(table2);
models::RawModel table_model3 = render_engine::LoadObjModel("res/bureauOne.obj");
models::TexturedModel table3 = { table_model3, default_texture };
tables.push_back(table3);
FurnitureModel table;
table.furniture = {
FurnitureType::TABLE, 2 };
table.texture = tables;
furniture_models.push_back(table);
// Chairs
std::deque<models::TexturedModel> chairs;
models::RawModel chair_model1 = render_engine::LoadObjModel("res/launchchair.obj");
models::TexturedModel chair1 = { chair_model1, default_texture };
chairs.push_back(chair1);
models::RawModel chair_model2 = render_engine::LoadObjModel("res/lawnChairOne.obj");
models::TexturedModel chair2 = { chair_model2, default_texture };
chairs.push_back(chair2);
models::RawModel chair_model3 = render_engine::LoadObjModel("res/ugly_chair.obj");
models::TexturedModel chair3 = { chair_model3, default_texture };
chairs.push_back(chair3);
FurnitureModel chair;
chair.furniture = {
FurnitureType::CHAIR, 1 };
chair.texture = chairs;
furniture_models.push_back(chair);
// Plants
std::deque<models::TexturedModel> plants;
models::RawModel plant_model1 = render_engine::LoadObjModel("res/plantOne.obj");
models::TexturedModel plant1 = { plant_model1, default_texture };
plants.push_back(plant1);
models::RawModel plant_model2 = render_engine::LoadObjModel("res/plantTwo.obj");
models::TexturedModel plant2 = { plant_model2, default_texture };
plants.push_back(plant2);
models::RawModel plant_model3 = render_engine::LoadObjModel("res/plantThree.obj");
models::TexturedModel plant3 = { plant_model3, default_texture };
plants.push_back(plant3);
FurnitureModel plant;
plant.furniture = {
FurnitureType::PLANT, 1 };
plant.texture = plants;
furniture_models.push_back(plant);
// Guitars
std::deque<models::TexturedModel> guitars;
models::RawModel guitar_model1 = render_engine::LoadObjModel("res/guitarOne.obj");
models::TexturedModel guitar1 = { guitar_model1, default_texture };
guitars.push_back(guitar1);
models::RawModel guitar_model2 = render_engine::LoadObjModel("res/guitarTwo.obj");
models::TexturedModel guitar2 = { guitar_model2, default_texture };
guitars.push_back(guitar2);
FurnitureModel guitar;
guitar.furniture = {
FurnitureType::GUITAR, 1 };
guitar.texture = guitars;
furniture_models.push_back(guitar);
// Bookshelves
std::deque<models::TexturedModel> bookshelves;
models::RawModel bookshelf_model1 = render_engine::LoadObjModel("res/bookShelfOne.obj");
models::TexturedModel bookshelf1 = { bookshelf_model1, default_texture };
bookshelves.push_back(bookshelf1);
models::RawModel bookshelf_model2 = render_engine::LoadObjModel("res/bookShelfTwo.obj");
models::TexturedModel bookshelf2 = { bookshelf_model2, default_texture };
bookshelves.push_back(bookshelf2);
models::RawModel bookshelf_model3 = render_engine::LoadObjModel("res/bookShelfThree.obj");
models::TexturedModel bookshelf3 = { bookshelf_model3, default_texture };
bookshelves.push_back(bookshelf3);
FurnitureModel bookshelf;
bookshelf.furniture = {
FurnitureType::BOOKSHELF, 1 };
bookshelf.texture = bookshelves;
furniture_models.push_back(bookshelf);
// Lamps
std::deque<models::TexturedModel>lamps;
models::RawModel lamp_model1 = render_engine::LoadObjModel("res/lampOne.obj");
models::TexturedModel lamp1 = { lamp_model1, default_texture };
lamps.push_back(lamp1);
models::RawModel lamp_model2 = render_engine::LoadObjModel("res/lampTwo.obj");
models::TexturedModel lamp2 = { lamp_model2, default_texture };
lamps.push_back(lamp2);
FurnitureModel lamp;
lamp.furniture = {
FurnitureType::LAMP, 1 };
lamp.texture = lamps;
furniture_models.push_back(lamp);
// Ceiling objects
std::deque<models::TexturedModel>ceiling_Objects;
models::RawModel ceiling_Obj_model1 = render_engine::LoadObjModel("res/ceilingFan.obj");
models::TexturedModel ceiling_Obj1 = { ceiling_Obj_model1, default_texture };
ceiling_Objects.push_back(ceiling_Obj1);
models::RawModel ceiling_Obj_model2 = render_engine::LoadObjModel("res/ceilingFanTwo.obj");
models::TexturedModel ceiling_Obj2 = { ceiling_Obj_model2, default_texture };
ceiling_Objects.push_back(ceiling_Obj2);
models::RawModel ceiling_Obj_model3 = render_engine::LoadObjModel("res/ceilingLampOne.obj");
models::TexturedModel ceiling_Obj3 = { ceiling_Obj_model3, default_texture };
ceiling_Objects.push_back(ceiling_Obj3);
models::RawModel ceiling_Obj_model4 = render_engine::LoadObjModel("res/ceilingLampTwo.obj");
models::TexturedModel ceiling_Obj4 = { ceiling_Obj_model4, default_texture };
ceiling_Objects.push_back(ceiling_Obj4);
FurnitureModel ceiling_object;
ceiling_object.furniture = {
FurnitureType::CEILING_OBJECTS, 1 };
ceiling_object.texture = ceiling_Objects;
furniture_models.push_back(ceiling_object);
// Miscs
std::deque<models::TexturedModel> miscs;
models::RawModel misc_model1 = render_engine::LoadObjModel("res/tv.obj");
models::TexturedModel misc1 = { misc_model1, default_texture };
miscs.push_back(misc1);
models::RawModel misc_model2 = render_engine::LoadObjModel("res/radio.obj");
models::TexturedModel misc2 = { misc_model2, default_texture };
miscs.push_back(misc2);
models::RawModel misc_model3 = render_engine::LoadObjModel("res/Flowerpot.obj");
models::TexturedModel misc3 = { misc_model3, default_texture };
miscs.push_back(misc3);
FurnitureModel misc;
misc.furniture = {
FurnitureType::MISC, 1 };
misc.texture = miscs;
furniture_models.push_back(misc);
}
}

View File

@@ -1,4 +1,4 @@
#include "background_remover.h" #include "BackgroundRemover.h"
/* /*
Author: Pierfrancesco Soffritti https://github.com/PierfrancescoSoffritti Author: Pierfrancesco Soffritti https://github.com/PierfrancescoSoffritti

View File

@@ -1,4 +1,4 @@
#include "finger_count.h" #include "FingerCount.h"
#include "opencv2/imgproc.hpp" #include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp" #include "opencv2/highgui.hpp"

View File

@@ -1,6 +1,6 @@
#include "hand_detect_region.h" #include "HandDetectRegion.h"
#define TIME_DURATION 1.0f
namespace computervision namespace computervision
{ {
@@ -20,15 +20,6 @@ namespace computervision
Mat input_frame = GenerateHandMaskSquare(camera_frame); Mat input_frame = GenerateHandMaskSquare(camera_frame);
frame_out = input_frame.clone(); frame_out = input_frame.clone();
if (!background_calibrated || !skin_calibrated)
if (time >= TIME_DURATION)
{
//std::cout << "timer finised, seconds left: " << seconds_left << std::endl;
seconds_left--;
time = 0;
}
// detect skin color // detect skin color
skin_detector.drawSkinColorSampler(camera_frame,start_x_pos,start_y_pos,region_width,region_height); skin_detector.drawSkinColorSampler(camera_frame,start_x_pos,start_y_pos,region_width,region_height);
@@ -41,29 +32,6 @@ namespace computervision
// draw the hand rectangle on the camera input, and draw text showing if the hand is open or closed. // draw the hand rectangle on the camera input, and draw text showing if the hand is open or closed.
DrawHandMask(&camera_frame); DrawHandMask(&camera_frame);
if (seconds_left <= 0)
{
if (!background_calibrated)
{
background_remover.calibrate(input_frame);
background_calibrated = true;
hand_calibrator.SetBackGroundCalibrated(background_calibrated);
seconds_left = 5;
time = 0;
}
else
{
if (!skin_calibrated)
{
if (is_main_skin_detection_region)
skin_timer_callback();
}
}
}
// uncomment these lines to show debug hand information
//imshow("output" + region_id, frame_out); //imshow("output" + region_id, frame_out);
//imshow("foreground" + region_id, foreground); //imshow("foreground" + region_id, foreground);
//imshow("handMask" + region_id, handMask); //imshow("handMask" + region_id, handMask);
@@ -79,17 +47,7 @@ namespace computervision
hand_calibrator.DrawBackgroundSkinCalibrated(camera_frame); hand_calibrator.DrawBackgroundSkinCalibrated(camera_frame);
std::string calibration_text = (!background_calibrated ? "calibrating background in " : (!skin_calibrated ? "calibrating skin in " : ""));
calibration_text += std::to_string(seconds_left);
if (!background_calibrated || !skin_calibrated)
{
cv::rectangle(camera_frame, cv::Rect(0, camera_frame.rows - 130, 600, 60), cv::Scalar(0, 0, 0), -1);
cv:putText(camera_frame, calibration_text, cv::Point(5, 400), cv::FONT_HERSHEY_COMPLEX, 1.0, cv::Scalar(255, 0, 255), 2);
}
if (background_calibrated && !skin_calibrated)
{
cv::putText(camera_frame, "put your hand in the left square", cv::Point(5, camera_frame.rows - 105), cv::FONT_HERSHEY_COMPLEX, 1.0, cv::Scalar(255, 0, 255), 2);
}
} }
@@ -134,8 +92,6 @@ namespace computervision
{ {
std::cout << "calibrating skin " << region_id << std::endl; std::cout << "calibrating skin " << region_id << std::endl;
hand_calibrator.SetSkinCalibration(true); hand_calibrator.SetSkinCalibration(true);
skin_calibrated = true;
time = 0;
return skin_detector.calibrateAndReturn(frame_out); return skin_detector.calibrateAndReturn(frame_out);
} }
@@ -144,13 +100,6 @@ namespace computervision
std::cout << "setting skin " << region_id << std::endl; std::cout << "setting skin " << region_id << std::endl;
skin_detector.setTresholds(tresholds); skin_detector.setTresholds(tresholds);
hand_calibrator.SetSkinCalibration(true); hand_calibrator.SetSkinCalibration(true);
skin_calibrated = true;
time = 0;
}
void HandDetectRegion::UpdateTime(float delta_time)
{
time += delta_time;
} }
} }

View File

@@ -2,13 +2,11 @@
#include <opencv2/core.hpp> #include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp> #include <opencv2/imgproc.hpp>
#include <GLFW/glfw3.h>
#include "async/StaticCameraInstance.h" #include "async/StaticCameraInstance.h"
#include "calibration/HandCalibrator.h" #include "calibration/HandCalibrator.h"
#include "background_remover.h" #include "BackgroundRemover.h"
#include "skin_detector.h" #include "SkinDetector.h"
#include "finger_count.h" #include "FingerCount.h"
namespace computervision namespace computervision
{ {
class HandDetectRegion class HandDetectRegion
@@ -38,12 +36,8 @@ namespace computervision
std::vector<int> CalculateSkinTresholds(); std::vector<int> CalculateSkinTresholds();
void setSkinTresholds(std::vector<int>& tresholds); void setSkinTresholds(std::vector<int>& tresholds);
void UpdateTime(float delta_time);
void SetMainSkinDetecRegion(bool val) { is_main_skin_detection_region = val; };
void SetSkinTimerCallback(std::function<void()> fun) { skin_timer_callback = fun; };
private: private:
int start_x_pos; int start_x_pos;
int start_y_pos; int start_y_pos;
int region_height; int region_height;
@@ -57,17 +51,6 @@ namespace computervision
std::string region_id; std::string region_id;
bool DrawHandMask(cv::Mat* input); bool DrawHandMask(cv::Mat* input);
float time = 0;
int seconds_left = 5; // calibration countdown
bool background_calibrated = false;
bool skin_calibrated = false;
bool is_main_skin_detection_region = false;
std::function<void()> skin_timer_callback;
}; };
} }

View File

@@ -1,7 +1,14 @@
#include "object_detection.h" #include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/video.hpp>
#define TIME_DURATION 1.0f #include "ObjectDetection.h"
#include "BackgroundRemover.h"
#include "SkinDetector.h"
#include "FingerCount.h"
#include "async/StaticCameraInstance.h"
#include "calibration/HandCalibrator.h"
namespace computervision namespace computervision
{ {
@@ -18,11 +25,6 @@ namespace computervision
handcalibration::HandCalibrator hand_calibrator; handcalibration::HandCalibrator hand_calibrator;
cv::VideoCapture cap = static_camera::getCap(); cv::VideoCapture cap = static_camera::getCap();
float time = 0;
int seconds_left = 5; // calibration countdown
bool background_calibrated = false;
bool skin_calibrated = false;
ObjectDetection::ObjectDetection() ObjectDetection::ObjectDetection()
{ {
@@ -40,20 +42,6 @@ namespace computervision
bool ObjectDetection::DetectHand(Mat camera_frame, bool& hand_present) bool ObjectDetection::DetectHand(Mat camera_frame, bool& hand_present)
{ {
//calculate deltatime
if (!background_calibrated || !skin_calibrated)
{
UpdateTime();
if (time >= TIME_DURATION)
{
std::cout << "timer finised, seconds left: " << seconds_left << std::endl;
seconds_left--;
time = 0;
}
}
Mat input_frame = GenerateHandMaskSquare(camera_frame); Mat input_frame = GenerateHandMaskSquare(camera_frame);
frame_out = input_frame.clone(); frame_out = input_frame.clone();
@@ -74,59 +62,38 @@ namespace computervision
// draw the hand rectangle on the camera input, and draw text showing if the hand is open or closed. // draw the hand rectangle on the camera input, and draw text showing if the hand is open or closed.
DrawHandMask(&camera_frame); DrawHandMask(&camera_frame);
if (seconds_left <= 0)
{
if (!background_calibrated)
{
background_remover.calibrate(input_frame);
background_calibrated = true;
hand_calibrator.SetBackGroundCalibrated(background_calibrated);
seconds_left = 5;
time = 0;
}
else
{
if (!skin_calibrated)
{
skin_detector.calibrate(input_frame);
skin_calibrated = true;
hand_calibrator.SetSkinCalibration(skin_calibrated);
time = 0;
}
}
}
hand_calibrator.SetAmountOfFingers(fingers_amount); hand_calibrator.SetAmountOfFingers(fingers_amount);
finger_count.DrawHandContours(camera_frame); finger_count.DrawHandContours(camera_frame);
hand_calibrator.DrawHandCalibrationText(camera_frame); hand_calibrator.DrawHandCalibrationText(camera_frame);
std::string calibration_text = (!background_calibrated ? "calibrating background in " : (!skin_calibrated ? "calibrating skin in " : ""));
calibration_text += std::to_string(seconds_left);
if (!background_calibrated || !skin_calibrated)
{
cv::rectangle(camera_frame, cv::Rect(0, camera_frame.rows - 120, 500, 50), cv::Scalar(0, 0, 0), -1);
cv::putText(camera_frame, calibration_text, cv::Point(5, camera_frame.rows-80), cv::FONT_HERSHEY_COMPLEX, 1.0, cv::Scalar(255, 0, 255), 2);
}
if (background_calibrated && !skin_calibrated)
{
cv::putText(camera_frame, "put your hand in the square", cv::Point(5, camera_frame.rows - 100), cv::FONT_HERSHEY_COMPLEX, 1.0, cv::Scalar(255, 0, 255), 2);
}
imshow("camera", camera_frame); imshow("camera", camera_frame);
// uncomment these lines to show debug hand information
/*imshow("output", frame_out); /*imshow("output", frame_out);
imshow("foreground", foreground); imshow("foreground", foreground);
imshow("handMask", handMask); imshow("handMask", handMask);
imshow("handDetection", fingerCountDebug);*/ imshow("handDetection", fingerCountDebug);*/
hand_present = hand_calibrator.CheckIfHandPresent(handMask, handcalibration::HandDetectionType::MENU); hand_present = hand_calibrator.CheckIfHandPresent(handMask,handcalibration::HandDetectionType::MENU);
hand_calibrator.SetHandPresent(hand_present); hand_calibrator.SetHandPresent(hand_present);
int key = waitKey(1);
if (key == 98) // b, calibrate the background
{
background_remover.calibrate(input_frame);
hand_calibrator.SetBackGroundCalibrated(true);
}
else if (key == 115) // s, calibrate the skin color
{
skin_detector.calibrate(input_frame);
hand_calibrator.SetSkinCalibration(true);
}
return fingers_amount > 0; return fingers_amount > 0;
} }
@@ -177,15 +144,5 @@ namespace computervision
imshow("Webcam image", img); imshow("Webcam image", img);
} }
void ObjectDetection::UpdateTime()
{
double current_time = glfwGetTime();
static double last_frame_time = current_time;
double delt_time = current_time - last_frame_time;
last_frame_time = current_time;
time += delt_time;
}
} }

View File

@@ -8,14 +8,6 @@
#include <opencv2/core.hpp> #include <opencv2/core.hpp>
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <opencv2/video.hpp>
#include <GLFW/glfw3.h>
#include "background_remover.h"
#include "skin_detector.h"
#include "finger_count.h"
#include "async/StaticCameraInstance.h"
#include "calibration/HandCalibrator.h"
namespace computervision namespace computervision
@@ -94,7 +86,6 @@ namespace computervision
private: private:
bool is_hand_open; bool is_hand_open;
bool is_hand_present; bool is_hand_present;
void UpdateTime();
}; };

View File

@@ -1,4 +1,4 @@
#include "skin_detector.h" #include "SkinDetector.h"
#include <iostream> #include <iostream>
/* /*

View File

@@ -20,23 +20,78 @@ namespace entities
GenerateFurnitureModels(); GenerateFurnitureModels();
} }
const FurniturePiece* HouseGenerator::GetRandomFurniturePiece()
{
FurnitureType random_type = FurnitureType::CEILING_OBJECTS;
while (random_type == FurnitureType::CEILING_OBJECTS ) {
random_type = FurnitureType(toolbox::Random(0, furniture_models.size() - 1));
}
for (std::deque<FurnitureModel>::iterator it = furniture_models.begin(); it != furniture_models.end(); ++it)
{
if (it->furniture.type == random_type)
{
return &it->furniture;
}
}
return nullptr;
}
const FurniturePiece* HouseGenerator::GetFurniturePiece(FurnitureType type)
{
for (std::deque<FurnitureModel>::iterator it = furniture_models.begin(); it != furniture_models.end(); ++it)
{
if (it->furniture.type == type)
{
return &it->furniture;
}
}
return nullptr;
}
std::deque<std::shared_ptr<Entity>> HouseGenerator::GenerateHouse(const glm::vec3& position, float y_rotation) std::deque<std::shared_ptr<Entity>> HouseGenerator::GenerateHouse(const glm::vec3& position, float y_rotation)
{ {
std::deque<std::shared_ptr<Entity>> furniture; std::deque<std::shared_ptr<Entity>> furniture;
// Add house // Add house
furniture.push_front(std::make_shared<Entity>(house_model, position, glm::vec3(0, y_rotation, 0), HOUSE_SIZE)); furniture.push_front(std::make_shared<Entity>(house_model, position, glm::vec3(0, y_rotation, 0), HOUSE_SIZE));
int house_size_x = house_model.raw_model.model_size.x * HOUSE_SIZE;
int house_size_y = house_model.raw_model.model_size.x * HOUSE_SIZE;
int house_size_z = house_model.raw_model.model_size.x * HOUSE_SIZE;
for(int i = 0; i<toolbox::Random(1,4);i++) int offset_x = house_model.raw_model.model_size.z * (HOUSE_SIZE / 2);
{ int offset_z = house_model.raw_model.model_size.x * (HOUSE_SIZE / 2);
FurnitureType type = FurnitureType(toolbox::Random(0, furniture_models.size() - 1)); double multiplier_x = house_size_x / 4;
models::TexturedModel model = GetFurnitureModel(type); double multiplier_z = house_size_z / 3;
glm::vec3 model_pos = glm::vec3(position.x, position.y, position.z);
collision::Box model_box = { model_pos, model.raw_model.model_size }; for (int z = 1; z < 4; z++) {
model_box.SetRotation(-90); for (int x = 1; x < 4; x++)
furniture.push_back(std::make_shared<CollisionEntity>(model, model_pos, glm::vec3(0, -90, 0), HOUSE_SIZE * 2, model_box)); {
//if (toolbox::Random(0, 100) < 90) {
const FurniturePiece* furniture_piece = GetRandomFurniturePiece();
if (furniture_piece->type != FurnitureType::CEILING_OBJECTS) {
models::TexturedModel model = GetFurnitureModel(furniture_piece);
//if (!(furniture_piece->size > 1 && x > 1)) {
glm::vec3 model_pos = glm::vec3(position.x + (x * multiplier_x) - (multiplier_x / 2) - offset_x, position.y, position.z + (z * multiplier_z) - (multiplier_z / 2) + offset_z);
collision::Box model_box = { model_pos, model.raw_model.model_size };
model_box.SetRotation(-90);
furniture.push_back(std::make_shared<CollisionEntity>(model, model_pos, glm::vec3(0, -90, 0), HOUSE_SIZE, model_box));
}
//}
//}
}
} }
models::TexturedModel model = GetFurnitureModel(GetFurniturePiece(FurnitureType::CEILING_OBJECTS));
glm::vec3 model_pos = glm::vec3(position.x, position.y + (house_size_y/5 *3), position.z);
collision::Box model_box = { model_pos, model.raw_model.model_size };
model_box.SetRotation(-90);
furniture.push_back(std::make_shared<CollisionEntity>(model, model_pos, glm::vec3(0, -90, 0), HOUSE_SIZE, model_box));
return furniture;
/* /*
// Add furniture // Add furniture
models::TexturedModel couch = GetFurnitureModel(FurnitureType::COUCH); models::TexturedModel couch = GetFurnitureModel(FurnitureType::COUCH);
@@ -64,7 +119,7 @@ namespace entities
glm::vec3 guitar_pos = glm::vec3(position.x - 50, position.y, position.z + 220); glm::vec3 guitar_pos = glm::vec3(position.x - 50, position.y, position.z + 220);
collision::Box guitar_box = { guitar_pos, guitar.raw_model.model_size }; collision::Box guitar_box = { guitar_pos, guitar.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(guitar, guitar_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, guitar_box)); furniture.push_back(std::make_shared<CollisionEntity>(guitar, guitar_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, guitar_box));
models::TexturedModel bookshelf = GetFurnitureModel(FurnitureType::BOOKSHELF); models::TexturedModel bookshelf = GetFurnitureModel(FurnitureType::BOOKSHELF);
glm::vec3 bookshelf_pos = glm::vec3(position.x - 50, position.y, position.z + 220); glm::vec3 bookshelf_pos = glm::vec3(position.x - 50, position.y, position.z + 220);
collision::Box bookshelf_box = { bookshelf_pos, bookshelf.raw_model.model_size }; collision::Box bookshelf_box = { bookshelf_pos, bookshelf.raw_model.model_size };
@@ -85,29 +140,38 @@ namespace entities
collision::Box misc_box = { misc_pos, misc.raw_model.model_size }; collision::Box misc_box = { misc_pos, misc.raw_model.model_size };
furniture.push_back(std::make_shared<CollisionEntity>(misc, misc_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, misc_box)); furniture.push_back(std::make_shared<CollisionEntity>(misc, misc_pos, glm::vec3(0, 0, 0), HOUSE_SIZE, misc_box));
*/ */
return furniture;
} }
models::TexturedModel HouseGenerator::GetFurnitureModel(FurnitureType furniture) models::TexturedModel HouseGenerator::GetFurnitureModel(const FurniturePiece* furniture)
{ {
const auto found = furniture_models.find(furniture); std::deque<models::TexturedModel>* furniture_list = nullptr;
if (found == furniture_models.end())
for (std::deque<FurnitureModel>::iterator it = furniture_models.begin(); it != furniture_models.end(); ++it)
{
if (it->furniture.type == furniture->type)
{
furniture_list = &it->texture;
}
}
if (furniture_list == nullptr)
{ {
std::cerr << "OH NEEEEEEEEEEEEEEE"; std::cerr << "OH NEEEEEEEEEEEEEEE";
} }
auto models = found->second;
const int modelNumber = toolbox::Random(0, models.size() - 1); const int modelNumber = toolbox::Random(0, furniture_list->size() - 1);
return models[modelNumber]; return furniture_list->at(modelNumber);
//return {};
} }
void HouseGenerator::GenerateFurnitureModels() void HouseGenerator::GenerateFurnitureModels()
{ {
// Couches // Couches
std::deque<models::TexturedModel> couches; std::deque<models::TexturedModel> couches;
models::RawModel couch_inside_model = render_engine::LoadObjModel("res/couchThree.obj"); models::RawModel couch_inside_model = render_engine::LoadObjModel("res/couchThree.obj");
models::TexturedModel couch_inside = { couch_inside_model, default_texture }; models::TexturedModel couch_inside = { couch_inside_model, default_texture };
couches.push_back(couch_inside); couches.push_back(couch_inside);
@@ -119,8 +183,13 @@ namespace entities
models::RawModel couch_inside_model3 = render_engine::LoadObjModel("res/lawnBenchOne.obj"); models::RawModel couch_inside_model3 = render_engine::LoadObjModel("res/lawnBenchOne.obj");
models::TexturedModel couch_inside3 = { couch_inside_model3, default_texture }; models::TexturedModel couch_inside3 = { couch_inside_model3, default_texture };
couches.push_back(couch_inside3); couches.push_back(couch_inside3);
furniture_models.insert(std::pair<FurnitureType, std::deque<models::TexturedModel>>(FurnitureType::COUCH, couches)); FurnitureModel couch;
couch.furniture = {
FurnitureType::COUCH, 2 };
couch.texture = couches;
furniture_models.push_back(couch);
// Tables // Tables
std::deque<models::TexturedModel> tables; std::deque<models::TexturedModel> tables;
@@ -136,8 +205,13 @@ namespace entities
models::RawModel table_model3 = render_engine::LoadObjModel("res/bureauOne.obj"); models::RawModel table_model3 = render_engine::LoadObjModel("res/bureauOne.obj");
models::TexturedModel table3 = { table_model3, default_texture }; models::TexturedModel table3 = { table_model3, default_texture };
tables.push_back(table3); tables.push_back(table3);
furniture_models.insert(std::pair<FurnitureType, std::deque<models::TexturedModel>>(FurnitureType::TABLE, tables)); FurnitureModel table;
table.furniture = {
FurnitureType::TABLE, 2 };
table.texture = tables;
furniture_models.push_back(table);
// Chairs // Chairs
std::deque<models::TexturedModel> chairs; std::deque<models::TexturedModel> chairs;
@@ -154,8 +228,12 @@ namespace entities
models::TexturedModel chair3 = { chair_model3, default_texture }; models::TexturedModel chair3 = { chair_model3, default_texture };
chairs.push_back(chair3); chairs.push_back(chair3);
furniture_models.insert(std::pair<FurnitureType, std::deque<models::TexturedModel>>(FurnitureType::CHAIR, chairs)); FurnitureModel chair;
chair.furniture = {
FurnitureType::CHAIR, 1 };
chair.texture = chairs;
furniture_models.push_back(chair);
// Plants // Plants
std::deque<models::TexturedModel> plants; std::deque<models::TexturedModel> plants;
@@ -171,8 +249,13 @@ namespace entities
models::RawModel plant_model3 = render_engine::LoadObjModel("res/plantThree.obj"); models::RawModel plant_model3 = render_engine::LoadObjModel("res/plantThree.obj");
models::TexturedModel plant3 = { plant_model3, default_texture }; models::TexturedModel plant3 = { plant_model3, default_texture };
plants.push_back(plant3); plants.push_back(plant3);
furniture_models.insert(std::pair<FurnitureType, std::deque<models::TexturedModel>>(FurnitureType::PLANT, plants)); FurnitureModel plant;
plant.furniture = {
FurnitureType::PLANT, 1 };
plant.texture = plants;
furniture_models.push_back(plant);
// Guitars // Guitars
std::deque<models::TexturedModel> guitars; std::deque<models::TexturedModel> guitars;
@@ -184,8 +267,13 @@ namespace entities
models::RawModel guitar_model2 = render_engine::LoadObjModel("res/guitarTwo.obj"); models::RawModel guitar_model2 = render_engine::LoadObjModel("res/guitarTwo.obj");
models::TexturedModel guitar2 = { guitar_model2, default_texture }; models::TexturedModel guitar2 = { guitar_model2, default_texture };
guitars.push_back(guitar2); guitars.push_back(guitar2);
furniture_models.insert(std::pair<FurnitureType, std::deque<models::TexturedModel>>(FurnitureType::GUITAR, guitars)); FurnitureModel guitar;
guitar.furniture = {
FurnitureType::GUITAR, 1 };
guitar.texture = guitars;
furniture_models.push_back(guitar);
// Bookshelves // Bookshelves
std::deque<models::TexturedModel> bookshelves; std::deque<models::TexturedModel> bookshelves;
@@ -202,7 +290,12 @@ namespace entities
models::TexturedModel bookshelf3 = { bookshelf_model3, default_texture }; models::TexturedModel bookshelf3 = { bookshelf_model3, default_texture };
bookshelves.push_back(bookshelf3); bookshelves.push_back(bookshelf3);
furniture_models.insert(std::pair<FurnitureType, std::deque<models::TexturedModel>>(FurnitureType::BOOKSHELF, bookshelves)); FurnitureModel bookshelf;
bookshelf.furniture = {
FurnitureType::BOOKSHELF, 1 };
bookshelf.texture = bookshelves;
furniture_models.push_back(bookshelf);
// Lamps // Lamps
std::deque<models::TexturedModel>lamps; std::deque<models::TexturedModel>lamps;
@@ -214,8 +307,13 @@ namespace entities
models::RawModel lamp_model2 = render_engine::LoadObjModel("res/lampTwo.obj"); models::RawModel lamp_model2 = render_engine::LoadObjModel("res/lampTwo.obj");
models::TexturedModel lamp2 = { lamp_model2, default_texture }; models::TexturedModel lamp2 = { lamp_model2, default_texture };
lamps.push_back(lamp2); lamps.push_back(lamp2);
furniture_models.insert(std::pair<FurnitureType, std::deque<models::TexturedModel>>(FurnitureType::LAMP, lamps)); FurnitureModel lamp;
lamp.furniture = {
FurnitureType::LAMP, 1 };
lamp.texture = lamps;
furniture_models.push_back(lamp);
// Ceiling objects // Ceiling objects
std::deque<models::TexturedModel>ceiling_Objects; std::deque<models::TexturedModel>ceiling_Objects;
@@ -235,8 +333,13 @@ namespace entities
models::RawModel ceiling_Obj_model4 = render_engine::LoadObjModel("res/ceilingLampTwo.obj"); models::RawModel ceiling_Obj_model4 = render_engine::LoadObjModel("res/ceilingLampTwo.obj");
models::TexturedModel ceiling_Obj4 = { ceiling_Obj_model4, default_texture }; models::TexturedModel ceiling_Obj4 = { ceiling_Obj_model4, default_texture };
ceiling_Objects.push_back(ceiling_Obj4); ceiling_Objects.push_back(ceiling_Obj4);
furniture_models.insert(std::pair<FurnitureType, std::deque<models::TexturedModel>>(FurnitureType::CEILING_OBJECTS, ceiling_Objects)); FurnitureModel ceiling_object;
ceiling_object.furniture = {
FurnitureType::CEILING_OBJECTS, 1 };
ceiling_object.texture = ceiling_Objects;
furniture_models.push_back(ceiling_object);
// Miscs // Miscs
std::deque<models::TexturedModel> miscs; std::deque<models::TexturedModel> miscs;
@@ -253,6 +356,11 @@ namespace entities
models::TexturedModel misc3 = { misc_model3, default_texture }; models::TexturedModel misc3 = { misc_model3, default_texture };
miscs.push_back(misc3); miscs.push_back(misc3);
furniture_models.insert(std::pair<FurnitureType, std::deque<models::TexturedModel>>(FurnitureType::MISC, miscs)); FurnitureModel misc;
misc.furniture = {
FurnitureType::MISC, 1 };
misc.texture = miscs;
furniture_models.push_back(misc);
} }
} }

View File

@@ -20,6 +20,24 @@ namespace entities
CEILING_OBJECTS, CEILING_OBJECTS,
MISC MISC
}; };
struct FurniturePiece
{
FurnitureType type;
int size;
};
struct FurnitureModel
{
FurniturePiece furniture;
std::deque<models::TexturedModel> texture;
bool operator<(FurnitureModel a)
{
return true;
}
};
class HouseGenerator class HouseGenerator
{ {
@@ -29,11 +47,11 @@ namespace entities
models::TexturedModel house_model; models::TexturedModel house_model;
models::ModelTexture default_texture; models::ModelTexture default_texture;
std::map<FurnitureType, std::deque<models::TexturedModel>> furniture_models; //std::map<FurniturePiece, std::deque<models::TexturedModel>> furniture_models;
std::deque<FurnitureModel> furniture_models;
public: public:
HouseGenerator(); HouseGenerator();
/* /*
* @brief: This function generates a house with furniture at the given position and rotation * @brief: This function generates a house with furniture at the given position and rotation
* *
@@ -50,6 +68,9 @@ namespace entities
float GetHouseDepth() const { return house_model.raw_model.model_size.x * HOUSE_SIZE; } float GetHouseDepth() const { return house_model.raw_model.model_size.x * HOUSE_SIZE; }
private: private:
const FurniturePiece* GetRandomFurniturePiece();
const FurniturePiece* GetFurniturePiece(FurnitureType type);
/* /*
* @brief: This function loads all the 3D furniture models * @brief: This function loads all the 3D furniture models
*/ */
@@ -62,6 +83,6 @@ namespace entities
* *
* @return: The model of the random furniture of the chosen furniture type * @return: The model of the random furniture of the chosen furniture type
*/ */
models::TexturedModel GetFurnitureModel(FurnitureType furniture); models::TexturedModel GetFurnitureModel(const FurniturePiece* furniture);
}; };
} }

View File

@@ -19,7 +19,7 @@ namespace gui
*/ */
struct GuiTexture struct GuiTexture
{ {
int texture; GLuint texture;
glm::vec2 position; glm::vec2 position;
glm::vec2 scale; glm::vec2 scale;

View File

@@ -28,7 +28,7 @@
#include "scenes/in_Game_Scene.h" #include "scenes/in_Game_Scene.h"
#include "scenes/startup_Scene.h" #include "scenes/startup_Scene.h"
#include "computervision/object_detection.h" #include "computervision/ObjectDetection.h"
//#include "computervision/OpenPoseImage.h" //#include "computervision/OpenPoseImage.h"
#include "computervision/OpenPoseVideo.h" #include "computervision/OpenPoseVideo.h"

View File

@@ -121,87 +121,5 @@ namespace render_engine
shader.Stop(); shader.Stop();
} }
void Render(std::vector<std::shared_ptr<gui::GuiTexture>>& guis, shaders::GuiShader& shader)
{
shader.Start();
// Enable the VAO and the positions VBO
glBindVertexArray(quad.vao_id);
glEnableVertexAttribArray(0);
// Enable alpha blending (for transparency in the texture)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Disable depth testing to textures with transparency can overlap
glDisable(GL_DEPTH_TEST);
// Render each gui to the screen
for (std::shared_ptr<gui::GuiTexture> gui : guis)
{
// Bind the texture of the gui to the shader
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, gui->texture);
glm::mat4 matrix = toolbox::CreateModelMatrix(gui->position, gui->scale);
shader.LoadModelMatrix(matrix);
glDrawArrays(GL_TRIANGLE_STRIP, 0, quad.vertex_count);
std::cout << "in render method, gui x value: " << gui.get()->scale.x << std::endl;
}
// Enable depth test again
glEnable(GL_DEPTH_TEST);
// Disable alpha blending
glDisable(GL_BLEND);
// Disable the VBO and VAO
glDisableVertexAttribArray(0);
glBindVertexArray(0);
shader.Stop();
}
void Render(std::shared_ptr<gui::GuiTexture>& gui, shaders::GuiShader& shader)
{
shader.Start();
// Enable the VAO and the positions VBO
glBindVertexArray(quad.vao_id);
glEnableVertexAttribArray(0);
// Enable alpha blending (for transparency in the texture)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Disable depth testing to textures with transparency can overlap
glDisable(GL_DEPTH_TEST);
// Render each gui to the screen
// Bind the texture of the gui to the shader
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, gui->texture);
glm::mat4 matrix = toolbox::CreateModelMatrix(gui->position, gui->scale);
shader.LoadModelMatrix(matrix);
glDrawArrays(GL_TRIANGLE_STRIP, 0, quad.vertex_count);
// Enable depth test again
glEnable(GL_DEPTH_TEST);
// Disable alpha blending
glDisable(GL_BLEND);
// Disable the VBO and VAO
glDisableVertexAttribArray(0);
glBindVertexArray(0);
shader.Stop();
}
} }
} }

View File

@@ -40,22 +40,5 @@ namespace render_engine
@param shade: The shader the GUI textures need to be rendered with @param shade: The shader the GUI textures need to be rendered with
*/ */
void Render(std::vector<gui::GuiTexture*>& guis, shaders::GuiShader& shader); void Render(std::vector<gui::GuiTexture*>& guis, shaders::GuiShader& shader);
/*
* @brief: renders guis elements from a shared pointer vector
*
* @param guis: List with GUI textures to render
* @param sahde: The shader to use
*/
void Render(std::vector<std::shared_ptr<gui::GuiTexture>>& guis, shaders::GuiShader& shader);
/*
* @brief renders 1 gui element.
*
* @param gui: the texture to render
* @param shader: the shader to use
*/
void Render(std::shared_ptr<gui::GuiTexture>& gui, shaders::GuiShader& shader);
} }
} }

View File

@@ -1,9 +1,32 @@
#include <iostream>
#include <memory>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include "in_Game_Scene.h" #include "in_Game_Scene.h"
#include "startup_Scene.h"
#include "../entities/main_character.h"
#include "../collision/collision_handler.h"
#include "../gui/gui_interactable.h"
#include "../models/model.h"
#include "../renderEngine/loader.h"
#include "../renderEngine/obj_loader.h"
#include "../renderEngine/renderer.h"
#include "../shaders/entity_shader.h"
#include "../toolbox/toolbox.h"
#include "../entities/house_generator.h"
#include <deque>
#include <functional>
#include <memory>
#include <queue>
#include <opencv2/core/base.hpp>
#include "../computervision/HandDetectRegion.h"
#include "../computervision/ObjectDetection.h"
#define MAX_MODEL_DEQUE_SIZE 6 // max amount of models to load at the same time #define MAX_MODEL_DEQUE_SIZE 6 // max amount of models to load at the same time
#define UPCOMING_MODEL_AMOUNT 4 // how much models should be loaded in front of us #define UPCOMING_MODEL_AMOUNT 4 // how much models should be loaded in front of us
namespace scene namespace scene
{ {
std::shared_ptr<entities::MainCharacter>main_character; std::shared_ptr<entities::MainCharacter>main_character;
@@ -16,13 +39,10 @@ namespace scene
shaders::EntityShader* shader; shaders::EntityShader* shader;
shaders::GuiShader* gui_shader; shaders::GuiShader* gui_shader;
std::vector<gui::GuiTexture*> guis; std::vector<gui::GuiTexture*> guis;
std::vector<std::shared_ptr<gui::GuiTexture>> score_textures;
int furniture_count_old; int furniture_count_old;
int score; int score;
float delta_time = 0;
std::vector<computervision::HandDetectRegion> regions; std::vector<computervision::HandDetectRegion> regions;
computervision::HandDetectRegion reg_left("left", 0, 0, 150, 150), reg_right("right", 0, 0, 150, 150), reg_up("up", 0, 0, 150, 150); computervision::HandDetectRegion reg_left("left", 0, 0, 150, 150), reg_right("right", 0, 0, 150, 150), reg_up("up", 0, 0, 150, 150);
@@ -40,23 +60,7 @@ namespace scene
gui_shader = new shaders::GuiShader(); gui_shader = new shaders::GuiShader();
gui_shader->Init(); gui_shader->Init();
score = 0; score = 0;
for (int i = 0; i <= 9; i++)
{
std::shared_ptr<gui::GuiTexture> score_pointer;
std::string texture_path = "res/";
texture_path += std::to_string(i);
texture_path += ".png";
score_pointer = std::make_unique<gui::GuiTexture>(render_engine::loader::LoadTexture(texture_path), glm::vec2(-0.9f, 0.8f), glm::vec2(0.07, 0.15));
score_textures.push_back(score_pointer);
}
} }
/** /**
* temporary!!!! * temporary!!!!
* just to make some bounding boxes * just to make some bounding boxes
@@ -79,31 +83,26 @@ namespace scene
delete house_generator; delete house_generator;
} }
void In_Game_Scene::SetupHandDetection() /**
* @brief loads a new chunk in front of the camera, and deletes the chunk behind the camera.
*
* @param model_pos the amount of models the camera has passed already. This is the rounded result of (z position of camera) / (size of model)
*
*/
void load_chunk(int model_pos)
{ {
static unsigned int furniture_count = 0;
// set up squares according to size of camera input // set up squares according to size of camera input
cv::Mat camera_frame; cv::Mat camera_frame;
static_camera::getCap().read(camera_frame); // get camera frame to know the width and heigth static_camera::getCap().read(camera_frame); // get camera frame to know the width and heigth
reg_left.SetMainSkinDetecRegion(true);
reg_right.SetMainSkinDetecRegion(false);
reg_right.SetMainSkinDetecRegion(false);
std::function<void()> callback = [this]() {OnSkinCalibrationCallback(); };
reg_left.SetSkinTimerCallback(callback);
reg_left.SetXPos(10); reg_left.SetXPos(10);
reg_left.SetYPos(camera_frame.rows / 2 - reg_left.GetHeight() / 2); reg_left.SetYPos(camera_frame.rows / 2 - reg_left.GetHeight() / 2);
reg_right.SetXPos(camera_frame.cols - 10 - reg_right.GetWidth()); reg_right.SetXPos(camera_frame.cols - 10 - reg_right.GetWidth());
reg_right.SetYPos(camera_frame.rows / 2 - reg_right.GetHeight() / 2); reg_right.SetYPos(camera_frame.rows / 2 - reg_right.GetHeight() / 2);
reg_up.SetXPos(camera_frame.cols / 2 - reg_up.GetWidth() / 2); reg_up.SetXPos(camera_frame.cols / 2 - reg_up.GetWidth() / 2);
reg_up.SetYPos(10); reg_up.SetYPos(10);
}
void In_Game_Scene::LoadChunk(int model_pos)
{
static unsigned int furniture_count = 0;
std::cout << "loading model chunk" << std::endl; std::cout << "loading model chunk" << std::endl;
if (house_models.size() >= MAX_MODEL_DEQUE_SIZE * furniture_count) if (house_models.size() >= MAX_MODEL_DEQUE_SIZE * furniture_count)
{ {
@@ -138,13 +137,10 @@ namespace scene
main_character = std::make_shared<entities::MainCharacter>(model_char, glm::vec3(0, -50, -100), glm::vec3(0, 90, 0), 5, char_box); main_character = std::make_shared<entities::MainCharacter>(model_char, glm::vec3(0, -50, -100), glm::vec3(0, 90, 0), 5, char_box);
collision_entities.push_back(main_character); collision_entities.push_back(main_character);
house_generator = new entities::HouseGenerator(); house_generator = new entities::HouseGenerator();
SetupHandDetection();
// load the first few house models // load the first few house models
for (int i = 0; i <= UPCOMING_MODEL_AMOUNT; i++) for (int i = 0; i <= UPCOMING_MODEL_AMOUNT; i++)
{ {
LoadChunk(i); load_chunk(i);
} }
lights.push_back(entities::Light(glm::vec3(0, 1000, 7000), glm::vec3(5, 5, 5))); // sun lights.push_back(entities::Light(glm::vec3(0, 1000, 7000), glm::vec3(5, 5, 5))); // sun
@@ -245,15 +241,13 @@ namespace scene
// Stop rendering the entities // Stop rendering the entities
shader->Stop(); shader->Stop();
DrawScore(score);
} }
//updates certain variables //updates certain variables
void scene::In_Game_Scene::update(GLFWwindow* window) void scene::In_Game_Scene::update(GLFWwindow* window)
{ {
UpdateDeltaTime();
//camera.Move(window); //camera.Move(window);
main_character->Move(window); main_character->Move(window);
//std::cout << "x get: " << movement.x << "\ny get: " << movement.y << "\nz get: " << movement.z << "\n"; //std::cout << "x get: " << movement.x << "\ny get: " << movement.y << "\nz get: " << movement.z << "\n";
@@ -266,19 +260,16 @@ namespace scene
// if we have passed a model, load a new one and delete the one behind us // if we have passed a model, load a new one and delete the one behind us
if (last_model_pos != model_pos) if (last_model_pos != model_pos)
{ {
LoadChunk(model_pos + UPCOMING_MODEL_AMOUNT); load_chunk(model_pos + UPCOMING_MODEL_AMOUNT);
score += furniture_count_old; score += furniture_count_old;
std::cout << "Score: " << score << std::endl; std::cout << "Score: " << score << std::endl;
std::cout << "Furniture_count_old in model (house excluded): " << furniture_count_old << std::endl; std::cout << "Funriture_count_old in model (house excluded): " << furniture_count_old << std::endl;
} }
// remember the position at which the new model was added // remember the position at which the new model was added
last_model_pos = model_pos; last_model_pos = model_pos;
collision::CheckCollisions(collision_entities); collision::CheckCollisions(collision_entities);
update_hand_detection(); update_hand_detection();
} }
//manages the key input in the game scene //manages the key input in the game scene
@@ -297,14 +288,24 @@ namespace scene
{ {
game_state = scene::Game_State::RUNNING; game_state = scene::Game_State::RUNNING;
} }
if (glfwGetKey(window, GLFW_KEY_B) == GLFW_PRESS)
{
reg_left.CalibrateBackground();
reg_right.CalibrateBackground();
reg_up.CalibrateBackground();
}
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
{
std::vector<int> tresholds = reg_left.CalculateSkinTresholds();
reg_right.setSkinTresholds(tresholds);
reg_up.setSkinTresholds(tresholds);
}
} }
void scene::In_Game_Scene::update_hand_detection() void scene::In_Game_Scene::update_hand_detection()
{ {
reg_left.UpdateTime(delta_time);
reg_right.UpdateTime(delta_time);
reg_up.UpdateTime(delta_time);
cv::Mat camera_frame; cv::Mat camera_frame;
static_camera::getCap().read(camera_frame); static_camera::getCap().read(camera_frame);
reg_left.DetectHand(camera_frame); reg_left.DetectHand(camera_frame);
@@ -314,41 +315,9 @@ namespace scene
cv::imshow("camera", camera_frame); cv::imshow("camera", camera_frame);
} }
void scene::In_Game_Scene::OnSkinCalibrationCallback()
{
std::cout << "on skin calibration callback" << std::endl;
std::vector<int> tresholds = reg_left.CalculateSkinTresholds();
reg_right.setSkinTresholds(tresholds);
reg_up.setSkinTresholds(tresholds);
}
//renders the models for the pause menu //renders the models for the pause menu
void In_Game_Scene::render_pause_menu() void In_Game_Scene::render_pause_menu()
{ {
render_engine::renderer::Render(pause_guis, *gui_shader); render_engine::renderer::Render(pause_guis, *gui_shader);
} }
void In_Game_Scene::DrawScore(int score)
{
std::vector<int> digits;
score_guis.clear();
toolbox::GetDigitsFromNumber(score, digits);
for (int i = digits.size() - 1; i >= 0; i--)
{
score_textures[digits[i]].get()->position.x = 0.15 * i - 0.9; // place the number at the top left. the numbers are just fine tuned to get the position just right
render_engine::renderer::Render(score_textures[digits[i]], *gui_shader);
}
}
void In_Game_Scene::UpdateDeltaTime()
{
double current_time = glfwGetTime();
static double last_frame_time = current_time;
delta_time = current_time - last_frame_time;
last_frame_time = current_time;
}
} }

View File

@@ -3,18 +3,6 @@
#include <ostream> #include <ostream>
#include <vector> #include <vector>
#include <memory> #include <memory>
#include <string>
#include <opencv2/core/base.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <deque>
#include <functional>
#include <queue>
#include <opencv2/core/base.hpp>
#include "startup_Scene.h"
#include "scene.h" #include "scene.h"
#include "../gui/gui_interactable.h" #include "../gui/gui_interactable.h"
#include "../models/model.h" #include "../models/model.h"
@@ -23,12 +11,6 @@
#include "../renderEngine/renderer.h" #include "../renderEngine/renderer.h"
#include "../shaders/entity_shader.h" #include "../shaders/entity_shader.h"
#include "../toolbox/toolbox.h" #include "../toolbox/toolbox.h"
#include "../entities/main_character.h"
#include "../collision/collision_handler.h"
#include "../entities/house_generator.h"
#include "../computervision/hand_detect_region.h"
#include "../computervision/object_detection.h"
namespace scene namespace scene
@@ -71,10 +53,6 @@ namespace scene
std::vector<gui::GuiTexture*> guis; std::vector<gui::GuiTexture*> guis;
//pause_guis is a list of components that will be rendered when the game is paused. //pause_guis is a list of components that will be rendered when the game is paused.
std::vector<gui::GuiTexture*> pause_guis; std::vector<gui::GuiTexture*> pause_guis;
// list of gui texture that holds the textures for the score
std::vector<std::shared_ptr<gui::GuiTexture>> score_guis;
void UpdateDeltaTime();
/** /**
* @brief renders the objects/gui models * @brief renders the objects/gui models
@@ -82,39 +60,7 @@ namespace scene
* @return void * @return void
*/ */
void render_pause_menu(); void render_pause_menu();
/**
* @brief updates the hand detection with the deltatime and checks the hand detection for each region. als updates the camera display
*
*/
void update_hand_detection(); void update_hand_detection();
/**
* @brief sets up the hand detection regions and sets the callbacks for the skin calibration.
*
*/
void SetupHandDetection();
/**
* @brief callback that gets called when the left skin detect region timout has been reached. sets the other regions with the skin data from the first region
*
*/
void OnSkinCalibrationCallback();
/**
* @brief draws the score on the screen with the digit resources.
*
* @param score the score to display.
*/
void DrawScore(int score);
/**
* @brief loads a new chunk in front of the camera, and deletes the chunk behind the camera.
*
* @param model_pos the amount of models the camera has passed already. This is the rounded result of (z position of camera) / (size of model)
*
*/
void LoadChunk(int model_pos);
public: public:
In_Game_Scene(); In_Game_Scene();
@@ -151,9 +97,6 @@ namespace scene
* @return void * @return void
*/ */
void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) override; void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) override;
}; };
} }

View File

@@ -0,0 +1,47 @@
#include "loading_Scene.h"
#include "../renderEngine/Renderer.h"
#include "../renderEngine/Loader.h"
#include "../gui/gui_element.h"
namespace scene
{
Loading_Scene::Loading_Scene()
{
gui_shader = new shaders::GuiShader();
gui_shader->Init();
}
Loading_Scene::~Loading_Scene()
{
delete gui_shader;
}
Scenes Loading_Scene::start(GLFWwindow* window)
{
render();
return Scenes::STARTUP;
}
void Loading_Scene::render()
{
/*render_engine::renderer::Prepare();
gui::GuiTexture loading_image = { render_engine::loader::LoadTexture("res/menu_item_start1.png"),
glm::vec2(0,0),glm::vec2(1,1) };
std::vector<gui::GuiTexture*> image_list;
image_list.push_back(&loading_image);
render_engine::renderer::Render(image_list, *gui_shader);*/
}
void Loading_Scene::update(GLFWwindow* window)
{
}
void Loading_Scene::onKey(GLFWwindow* window, int key, int scancode, int action, int mods)
{
}
}

View File

@@ -0,0 +1,63 @@
#pragma once
#pragma once
#include "scene.h"
#include "../gui/gui_element.h"
#include "../shaders/gui_shader.h"
namespace scene
{
extern GLFWwindow* window;
class Loading_Scene : public scene::Scene
{
private:
//return_value is an enum that is necessary for the scene switching. Whenever this changes, the scene will change to a different scene.
scene::Scenes return_value = scene::Scenes::LOADING;
shaders::GuiShader* gui_shader;
public:
/**
* @brief Constructor of the class Startup_Scene
*
*/
Loading_Scene();
~Loading_Scene();
/**
* @brief
*
* @param window
* @return
*/
Scenes start(GLFWwindow* window) override;
/**
* @brief
*
*/
void render() override;
/**
* @brief This method updates all the components on the window
*
* @param window Window it updates
*/
void update(GLFWwindow* window) override;
/**
* @brief Listener for key events
*
* @param window Window it listens to for key events
* @param key Key of event that is activated
* @param scancode Code of Key
* @param action
* @param mods
*/
void onKey(GLFWwindow* window, int key, int scancode, int action, int mods) override;
};
}

View File

@@ -11,6 +11,7 @@ namespace scene {
*/ */
enum class Scenes enum class Scenes
{ {
LOADING,
STARTUP, STARTUP,
INGAME, INGAME,
GAMEOVER, GAMEOVER,

View File

@@ -14,8 +14,8 @@
#include "../gui/gui_interactable.h" #include "../gui/gui_interactable.h"
#include "../toolbox/toolbox.h" #include "../toolbox/toolbox.h"
#include "../computervision/MenuTest.h" #include "../computervision/MenuTest.h"
#include "../computervision/object_detection.h" #include "../computervision/ObjectDetection.h"
#include "../computervision/hand_detect_region.h" #include "../computervision/HandDetectRegion.h"
@@ -211,6 +211,7 @@ namespace scene
{ {
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS) if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
{ {
return_value = scene::Scenes::INGAME; return_value = scene::Scenes::INGAME;
cv::destroyWindow("camera"); cv::destroyWindow("camera");
} }

View File

@@ -42,7 +42,5 @@ namespace toolbox
* @return: True if the timer has finished * @return: True if the timer has finished
*/ */
bool HasFinished() const { return has_finished; } bool HasFinished() const { return has_finished; }
void Reset() { current_time = 0; }
}; };
} }

View File

@@ -1,6 +1,6 @@
#include <ctime> #include <ctime>
#include "toolbox.h" #include "toolbox.h"
#include <iostream>
namespace toolbox namespace toolbox
{ {
glm::mat4 CreateModelMatrix(glm::vec2 translation, glm::vec2 scale) glm::mat4 CreateModelMatrix(glm::vec2 translation, glm::vec2 scale)
@@ -56,12 +56,4 @@ namespace toolbox
} }
return min + rand() % ((max + 1) - min); return min + rand() % ((max + 1) - min);
} }
void GetDigitsFromNumber(int number, std::vector<int>& result_vector)
{
if (number >= 10)
GetDigitsFromNumber(number / 10, result_vector);
result_vector.push_back(number % 10);
}
} }

View File

@@ -2,7 +2,6 @@
#include "../entities/camera.h" #include "../entities/camera.h"
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <vector>
namespace toolbox namespace toolbox
{ {
@@ -79,13 +78,4 @@ namespace toolbox
* @return: The random number * @return: The random number
*/ */
int Random(const int min, const int max); int Random(const int min, const int max);
/**
* @brief gets the separate digits from the number.
*
* @param number the number to get the digits from
* @param result_vector the vector to hold the individual digits.
*/
void GetDigitsFromNumber(int number, std::vector<int>& result_vector);
} }

View File

@@ -23,15 +23,15 @@
<ClCompile Include="src\entities\main_character.cpp" /> <ClCompile Include="src\entities\main_character.cpp" />
<ClCompile Include="src\entities\house_generator.cpp" /> <ClCompile Include="src\entities\house_generator.cpp" />
<ClCompile Include="src\computervision\calibration\HandCalibrator.cpp" /> <ClCompile Include="src\computervision\calibration\HandCalibrator.cpp" />
<ClCompile Include="src\computervision\hand_detect_region.cpp" /> <ClCompile Include="src\computervision\HandDetectRegion.cpp" />
<ClCompile Include="src\scenes\in_Game_Scene.cpp" /> <ClCompile Include="src\scenes\in_Game_Scene.cpp" />
<ClCompile Include="src\computervision\MenuTest.cpp" /> <ClCompile Include="src\computervision\MenuTest.cpp" />
<ClCompile Include="src\computervision\async\async_arm_detection.cpp" /> <ClCompile Include="src\computervision\async\async_arm_detection.cpp" />
<ClCompile Include="src\computervision\object_detection.cpp" /> <ClCompile Include="src\computervision\ObjectDetection.cpp" />
<ClCompile Include="src\computervision\OpenPoseVideo.cpp" /> <ClCompile Include="src\computervision\OpenPoseVideo.cpp" />
<ClCompile Include="src\computervision\skin_detector.cpp" /> <ClCompile Include="src\computervision\SkinDetector.cpp" />
<ClCompile Include="src\computervision\finger_count.cpp" /> <ClCompile Include="src\computervision\FingerCount.cpp" />
<ClCompile Include="src\computervision\background_remover.cpp" /> <ClCompile Include="src\computervision\BackgroundRemover.cpp" />
<ClCompile Include="src\entities\camera.cpp" /> <ClCompile Include="src\entities\camera.cpp" />
<ClCompile Include="src\entities\collision_entity.cpp" /> <ClCompile Include="src\entities\collision_entity.cpp" />
<ClCompile Include="src\entities\entity.cpp" /> <ClCompile Include="src\entities\entity.cpp" />
@@ -40,6 +40,7 @@
<ClCompile Include="src\renderEngine\loader.cpp" /> <ClCompile Include="src\renderEngine\loader.cpp" />
<ClCompile Include="src\renderEngine\obj_loader.cpp" /> <ClCompile Include="src\renderEngine\obj_loader.cpp" />
<ClCompile Include="src\renderEngine\renderer.cpp" /> <ClCompile Include="src\renderEngine\renderer.cpp" />
<ClCompile Include="src\scenes\loading_Scene.cpp" />
<ClCompile Include="src\scenes\scene.cpp" /> <ClCompile Include="src\scenes\scene.cpp" />
<ClCompile Include="src\shaders\gui_shader.cpp" /> <ClCompile Include="src\shaders\gui_shader.cpp" />
<ClCompile Include="src\shaders\shader_program.cpp" /> <ClCompile Include="src\shaders\shader_program.cpp" />
@@ -54,17 +55,18 @@
<ClInclude Include="src\entities\house_generator.h" /> <ClInclude Include="src\entities\house_generator.h" />
<ClInclude Include="src\computervision\calibration\HandCalibrator.h" /> <ClInclude Include="src\computervision\calibration\HandCalibrator.h" />
<ClInclude Include="src\computervision\calibration\StaticSkinTreshold.h" /> <ClInclude Include="src\computervision\calibration\StaticSkinTreshold.h" />
<ClInclude Include="src\computervision\hand_detect_region.h" /> <ClInclude Include="src\computervision\HandDetectRegion.h" />
<ClInclude Include="src\scenes\in_Game_Scene.h" /> <ClInclude Include="src\scenes\in_Game_Scene.h" />
<ClInclude Include="src\scenes\loading_Scene.h" />
<ClInclude Include="src\scenes\scene.h" /> <ClInclude Include="src\scenes\scene.h" />
<ClInclude Include="src\computervision\async\async_arm_detection.h" /> <ClInclude Include="src\computervision\async\async_arm_detection.h" />
<ClInclude Include="src\computervision\async\StaticCameraInstance.h" /> <ClInclude Include="src\computervision\async\StaticCameraInstance.h" />
<ClInclude Include="src\computervision\finger_count.h" /> <ClInclude Include="src\computervision\FingerCount.h" />
<ClInclude Include="src\computervision\background_remover.h" /> <ClInclude Include="src\computervision\BackgroundRemover.h" />
<ClInclude Include="src\computervision\MenuTest.h" /> <ClInclude Include="src\computervision\MenuTest.h" />
<ClInclude Include="src\computervision\OpenPoseVideo.h" /> <ClInclude Include="src\computervision\OpenPoseVideo.h" />
<ClInclude Include="src\computervision\skin_detector.h" /> <ClInclude Include="src\computervision\SkinDetector.h" />
<ClInclude Include="src\computervision\object_detection.h" /> <ClInclude Include="src\computervision\ObjectDetection.h" />
<ClInclude Include="src\entities\camera.h" /> <ClInclude Include="src\entities\camera.h" />
<ClInclude Include="src\entities\collision_entity.h" /> <ClInclude Include="src\entities\collision_entity.h" />
<ClInclude Include="src\entities\entity.h" /> <ClInclude Include="src\entities\entity.h" />

View File

@@ -4,11 +4,11 @@
<ClCompile Include="src\collision\collision_handler.cpp" /> <ClCompile Include="src\collision\collision_handler.cpp" />
<ClCompile Include="src\scenes\in_Game_Scene.cpp" /> <ClCompile Include="src\scenes\in_Game_Scene.cpp" />
<ClCompile Include="src\computervision\async\async_arm_detection.cpp" /> <ClCompile Include="src\computervision\async\async_arm_detection.cpp" />
<ClCompile Include="src\computervision\object_detection.cpp" /> <ClCompile Include="src\computervision\ObjectDetection.cpp" />
<ClCompile Include="src\computervision\OpenPoseVideo.cpp" /> <ClCompile Include="src\computervision\OpenPoseVideo.cpp" />
<ClCompile Include="src\computervision\skin_detector.cpp" /> <ClCompile Include="src\computervision\SkinDetector.cpp" />
<ClCompile Include="src\computervision\finger_count.cpp" /> <ClCompile Include="src\computervision\FingerCount.cpp" />
<ClCompile Include="src\computervision\background_remover.cpp" /> <ClCompile Include="src\computervision\BackgroundRemover.cpp" />
<ClCompile Include="src\entities\camera.cpp" /> <ClCompile Include="src\entities\camera.cpp" />
<ClCompile Include="src\entities\collision_entity.cpp" /> <ClCompile Include="src\entities\collision_entity.cpp" />
<ClCompile Include="src\entities\entity.cpp" /> <ClCompile Include="src\entities\entity.cpp" />
@@ -23,11 +23,12 @@
<ClCompile Include="src\toolbox\toolbox.cpp" /> <ClCompile Include="src\toolbox\toolbox.cpp" />
<ClCompile Include="src\scenes\startup_Scene.cpp" /> <ClCompile Include="src\scenes\startup_Scene.cpp" />
<ClCompile Include="src\computervision\calibration\HandCalibrator.cpp" /> <ClCompile Include="src\computervision\calibration\HandCalibrator.cpp" />
<ClCompile Include="src\computervision\hand_detect_region.cpp" /> <ClCompile Include="src\computervision\HandDetectRegion.cpp" />
<ClCompile Include="src\entities\main_character.cpp" /> <ClCompile Include="src\entities\main_character.cpp" />
<ClCompile Include="src\entities\house_generator.cpp" /> <ClCompile Include="src\entities\house_generator.cpp" />
<ClCompile Include="src\computervision\MenuTest.cpp" /> <ClCompile Include="src\computervision\MenuTest.cpp" />
<ClCompile Include="src\scenes\scene.cpp" /> <ClCompile Include="src\scenes\scene.cpp" />
<ClCompile Include="src\scenes\loading_Scene.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\entities\Camera.cpp"> <ClCompile Include="src\entities\Camera.cpp">
@@ -118,7 +119,7 @@
<ClInclude Include="src\toolbox\toolbox.h" /> <ClInclude Include="src\toolbox\toolbox.h" />
<ClInclude Include="src\scenes\startup_Scene.h" /> <ClInclude Include="src\scenes\startup_Scene.h" />
<ClInclude Include="src\computervision\calibration\HandCalibrator.h" /> <ClInclude Include="src\computervision\calibration\HandCalibrator.h" />
<ClInclude Include="src\computervision\hand_detect_region.h" /> <ClInclude Include="src\computervision\HandDetectRegion.h" />
<ClInclude Include="src\computervision\calibration\StaticSkinTreshold.h" /> <ClInclude Include="src\computervision\calibration\StaticSkinTreshold.h" />
<ClInclude Include="src\collision\collision.h" /> <ClInclude Include="src\collision\collision.h" />
<ClInclude Include="src\collision\collision_handler.h" /> <ClInclude Include="src\collision\collision_handler.h" />
@@ -126,11 +127,11 @@
<ClInclude Include="src\entities\house_generator.h" /> <ClInclude Include="src\entities\house_generator.h" />
<ClInclude Include="src\scenes\in_Game_Scene.h" /> <ClInclude Include="src\scenes\in_Game_Scene.h" />
<ClInclude Include="src\scenes\scene.h" /> <ClInclude Include="src\scenes\scene.h" />
<ClInclude Include="src\computervision\finger_count.h" /> <ClInclude Include="src\computervision\FingerCount.h" />
<ClInclude Include="src\computervision\background_remover.h" /> <ClInclude Include="src\computervision\BackgroundRemover.h" />
<ClInclude Include="src\computervision\MenuTest.h" /> <ClInclude Include="src\computervision\MenuTest.h" />
<ClInclude Include="src\computervision\skin_detector.h" /> <ClInclude Include="src\computervision\SkinDetector.h" />
<ClInclude Include="src\computervision\object_detection.h" /> <ClInclude Include="src\computervision\ObjectDetection.h" />
<ClInclude Include="src\entities\camera.h" /> <ClInclude Include="src\entities\camera.h" />
<ClInclude Include="src\entities\collision_entity.h" /> <ClInclude Include="src\entities\collision_entity.h" />
<ClInclude Include="src\entities\entity.h" /> <ClInclude Include="src\entities\entity.h" />
@@ -148,6 +149,7 @@
<ClInclude Include="src\toolbox\Timer.h" /> <ClInclude Include="src\toolbox\Timer.h" />
<ClInclude Include="src\toolbox\toolbox.h" /> <ClInclude Include="src\toolbox\toolbox.h" />
<ClInclude Include="src\scenes\startup_Scene.h" /> <ClInclude Include="src\scenes\startup_Scene.h" />
<ClInclude Include="src\scenes\loading_Scene.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Xml Include="res\haarcascade_frontalface_alt.xml" /> <Xml Include="res\haarcascade_frontalface_alt.xml" />