Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build/*
EyeRendererOld/build/Desktop_Qt_6_7_0-Debug
out/*
CMakeLists.txt.user
48 changes: 35 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ set(CMAKE_CXX_EXTENSIONS ON)
set(OpenCV_STATIC ON)

find_package( OpenCV REQUIRED )

find_package( Eigen3 REQUIRED )
find_package( Iconv REQUIRED )

if (WIN32)
find_package(glm CONFIG REQUIRED)
endif()

add_subdirectory(libs)

include_directories( ${OpenCV_INCLUDE_DIRS} )
Expand Down Expand Up @@ -53,14 +56,18 @@ set(PROJ_LINK_LIBS)
set(PROJ_SRC)

# Add all files/folders under src folder automatically to the project
file(GLOB_RECURSE PROJ_SRC src/*.h src/*.cpp)
file(GLOB PROJ_SRC src/*.h src/*.cpp)
file(GLOB_RECURSE srcLinux src/linux/*.h src/linux/*.cpp)
file(GLOB_RECURSE srcWindows src/windows/*.h src/windows/*.cpp)

###
### Compiler settings
###
add_definitions(
-fPIC -fcommon
)
if(UNIX)
add_definitions(
-fPIC -fcommon
)
endif()

###
### GLFW
Expand All @@ -78,23 +85,38 @@ if(KITGL_SUPPORT_GLFW)
list(APPEND PROJ_LINK_LIBS glfw)
endif(KITGL_SUPPORT_GLFW)

list(APPEND PROJ_LINK_LIBS Xinerama)
if(UNIX)
list(APPEND PROJ_LINK_LIBS Xinerama)
endif()

add_executable(${PROJECT_NAME})

target_sources(${PROJECT_NAME} PRIVATE ${PROJ_SRC})
if (WIN32)
message(STATUS "Adding Windows sources")
target_sources(${PROJECT_NAME} PRIVATE ${srcWindows})
elseif(UNIX)
message(STATUS "Adding Linux sources")
target_sources(${PROJECT_NAME} PRIVATE ${srcLinux})
endif()

###
### Generating the project files
###
add_executable(${PROJECT_NAME} ${PROJ_SRC})

###
### Linking to the project
###
target_link_libraries(${PROJECT_NAME} PRIVATE
RenderLib
ImageProcessingToolsLib
${OpenCV_LIBS}
Iconv::Iconv
${PROJ_LINK_LIBS})

if (WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE glm::glm-header-only GdiPlus)

get_target_property(GLM_INCLUDE_DIR glm::glm-header-only INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "GLM include dir: ${GLM_INCLUDE_DIR}")
target_include_directories(${PROJECT_NAME} PRIVATE ${GLM_INCLUDE_DIR})
endif()


file(COPY "${CMAKE_SOURCE_DIR}/data" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

add_custom_target(Other SOURCES
Expand Down
2 changes: 1 addition & 1 deletion libs/BasicToolsLib
16 changes: 16 additions & 0 deletions src/AbstractScreenCapturer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef AbstractScreenCapturer_H
#define AbstractScreenCapturer_H

#include <unordered_map>

#include "ImageData.h"
#include "MonitorPosition.h"

class AbstractScreenCapturer
{
public:
virtual ~AbstractScreenCapturer() = default;
virtual std::unordered_map<MonitorPosition, ImageData> Capture() = 0;
};

#endif
5 changes: 5 additions & 0 deletions src/Eye3dModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#include "objects/GlRenderSphereArc.h"
#include "objects/GlRenderSpherePolar.h"

#ifndef M_PI
#define M_PI 3.141592
#endif


namespace
{
const float upperLidOpenAngle = 0.75f;
Expand Down
3 changes: 2 additions & 1 deletion src/EyeFaceAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ void EyeFaceAnalyzer::RunThreadedDetect()
{
while (keepRunning)
{
std::optional<Vector3> newFacePosition = Detect();
faceMutex.lock();
facePosition = Detect();
facePosition = newFacePosition;
faceMutex.unlock();
}
}
Expand Down
38 changes: 0 additions & 38 deletions src/LinuxScreenCapturer.h

This file was deleted.

12 changes: 12 additions & 0 deletions src/MonitorPosition.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "MonitorPosition.h"

MonitorPosition::MonitorPosition()
: xOrigin(0), yOrigin(0)
{
}

bool MonitorPosition::operator==(const MonitorPosition other) const
{
return xOrigin == other.xOrigin && yOrigin == other.yOrigin;
}

28 changes: 28 additions & 0 deletions src/MonitorPosition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef MonitorPosition_H
#define MonitorPosition_H

#include <functional>

struct MonitorPosition
{
MonitorPosition();

bool operator==(const MonitorPosition other) const;

int xOrigin;
int yOrigin;

};

namespace std {
template <>
struct hash<MonitorPosition> {
size_t operator()(const MonitorPosition& key) const {
size_t h1 = std::hash<int>()(key.xOrigin);
size_t h2 = std::hash<int>()(key.yOrigin);
return h1 ^ (h2 << 1);
}
};
}

#endif
11 changes: 0 additions & 11 deletions src/LinuxScreenCapturer.cpp → src/linux/LinuxScreenCapturer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,6 @@ namespace
}
}

MonitorPosition::MonitorPosition()
: xOrigin(0), yOrigin(0)
{
}

bool MonitorPosition::operator==(const MonitorPosition other) const
{
return xOrigin == other.xOrigin && yOrigin == other.yOrigin;
}


std::unordered_map<MonitorPosition, ImageData> LinuxScreenCapturer::Capture()
{
std::unordered_map<MonitorPosition, ImageData> screenshots;
Expand Down
19 changes: 19 additions & 0 deletions src/linux/LinuxScreenCapturer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef LINUXSCREENCAPTURER_H
#define LINUXSCREENCAPTURER_H

#include <unordered_map>

#include "../AbstractScreenCapturer.h"
#include "ImageData.h"
#include "../MonitorPosition.h"

class LinuxScreenCapturer : public AbstractScreenCapturer
{
public:
LinuxScreenCapturer() = default;
virtual ~LinuxScreenCapturer() = default;

std::unordered_map<MonitorPosition, ImageData> Capture() override;
};

#endif // LINUXSCREENCAPTURER_H
Loading
Loading