Skip to content

Commit

Permalink
Merge branch 'api-refactor'
Browse files Browse the repository at this point in the history
# Conflicts:
#	hydra_app/main.cpp
#	hydra_app/main_app.sln
#	hydra_drv/GPUOCLLayer.h
#	hydra_drv/IESRender.cpp
#	shaderpack/shaderpack.vcxproj
#	vsgl3/clHelper.cpp
#	vsgl3/vsgl3.vcxproj
  • Loading branch information
FROL256 committed Aug 7, 2019
2 parents 2847313 + d1f96d8 commit e42f753
Show file tree
Hide file tree
Showing 35 changed files with 146 additions and 257 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ project(HydraAPP_Ex)

set(CMAKE_CXX_STANDARD 14)

set(HYDRA_API_ROOT_DIR ${CMAKE_SOURCE_DIR}/../HydraAPI)
set(HYDRA_API_SRC_DIR ${HYDRA_API_ROOT_DIR}/hydra_api)
set(HYDRA_API_LIB_DIR ${HYDRA_API_ROOT_DIR}/bin)
set(HYDRA_API_UTILS_SRC_DIR ${HYDRA_API_ROOT_DIR}/utils)

add_subdirectory (shaderpack)
add_subdirectory (vsgl3)
add_subdirectory (hydra_drv)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Linux:
3. Clone HydraCore repo in the same folder (to form "myfolder/HydraCore").
4. Set **"inDevelopment = false"** inside "input.cpp".
5. Use the following command to build and install HydraCore (for example from "myfolder/HydraCore/build")
**cmake -DCMAKE_INSTALL_PREFIX=/home/YourUserName .. && make all install -j 4**
**cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/YourUserName .. && make all install -j 4**

# Command line by examples

Expand Down
14 changes: 8 additions & 6 deletions hydra_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ set(SOURCE_FILES
main_app_window.cpp
main.cpp
main.h
${CMAKE_SOURCE_DIR}/../HydraAPI/main/Timer.h
${CMAKE_SOURCE_DIR}/../HydraAPI/main/Timer.cpp
)


set(EXTERNAL_SRC
${HYDRA_API_UTILS_SRC_DIR}/Timer.h
${HYDRA_API_UTILS_SRC_DIR}/Timer.cpp)

set(ADDITIONAL_INCLUDE_DIRS
../LIBRARY/include)

include_directories(${HYDRA_API_ROOT_DIR})

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
MESSAGE(WARNING "DEBUG IS ON")
add_definitions(-DDEBUG -D_DEBUG)
Expand All @@ -31,12 +36,9 @@ find_package(Threads REQUIRED)
find_package(OpenMP REQUIRED)


# include_directories(${ADDITIONAL_INCLUDE_DIRS})
# target_include_directories(main PUBLIC ${OPENGL_INCLUDE_DIR})

link_directories(${CMAKE_SOURCE_DIR}/../HydraAPI/bin/ ${CMAKE_SOURCE_DIR}/LIBRARY/lib_x64_linux/)

add_executable(hydra ${SOURCE_FILES})
add_executable(hydra ${SOURCE_FILES} ${EXTERNAL_SRC})

#MESSAGE(WARNING "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR} )
#SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer -fsanitize=leak -fsanitize=undefined -fsanitize=bounds-strict")
Expand Down
4 changes: 2 additions & 2 deletions hydra_app/Camera.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// © Copyright 2017 Vladimir Frolov, Ray Tracing Systems
// Copyright 2017 Vladimir Frolov, Ray Tracing Systems
//

#pragma once
#include "../../HydraAPI/hydra_api/LiteMath.h"
#include "hydra_api/LiteMath.h"
using namespace HydraLiteMath;

struct Camera
Expand Down
13 changes: 5 additions & 8 deletions hydra_app/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,16 @@ Input::Input()

//noWindow = false; ///< run 'console_main', else run 'window_main'
inLibraryPath = "tests/test_42"; ///< cornell box with teapot
//inLibraryPath = "/home/frol/temp3/shadow_bug/01_0";
//inLibraryPath = "/home/frol/PROG/HydraRepos/HydraAPI-tests/tests_f/test_162";
//inLibraryPath = "tests/test_42_with_mirror";
//inLibraryPath = "tests/test_223_small"; ///< cornell box with sphere
//inLibraryPath = "tests/test_224_sphere";
//inLibraryPath = "tests/test_224_sphere_microfacet";
//inLibraryPath = "tests/test_pool";
//inLibraryPath = "/home/frol/temp/suncg1_scenelib/statex_00003.xml";
//inLibraryPath = "/home/frol/PROG/HydraAPI/main/tests_f/test_204";
//inLibraryPath = "/home/frol/PROG/HydraAPI/main/tests_a/test_406";
//inLibraryPath = "C:/[Hydra]/pluginFiles/scenelib";
//inLibraryPath = "E:/PROG/CLSP/database/statex_00002.xml";
//inLibraryPath = "E:/PROG/HydraAPI/main/tests/test_78";

inDevelopment = false; ///< recompile shaders each time; note that nvidia have their own shader cache!
//inLibraryPath = "/home/frol/PROG/CLSP_gitlab/database/temp";

inDevelopment = false; ///< recompile shaders each time; note that nvidia have their own shader cache!
inDeviceId = 0; ///< opencl device id
cpuFB = false; ///< store frame buffer on CPU. Automaticly enabled if
enableMLT = false; ///< if use MMLT, you MUST enable it early, when render process just started (here or via command line).
Expand Down
8 changes: 5 additions & 3 deletions hydra_app/main.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "main.h"

#include "../../HydraAPI/hydra_api/HydraRenderDriverAPI.h"
#include "hydra_api/HydraRenderDriverAPI.h"
#include "../hydra_drv/RenderDriverRTE.h"


#ifdef WIN32
#include <windows.h>
#else
#include <unistd.h>
#include <signal.h>
#include <csignal>
#endif

//#include <chrono>
Expand Down Expand Up @@ -113,7 +113,7 @@ extern int g_height;

int main(int argc, const char** argv)
{
//g_hydraapipostprocessloaddll = false; // don't load post process dll's by HydraAPI
// g_hydraapipostprocessloaddll = false; // don't load post process dll's by HydraAPI

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef WIN32
Expand Down Expand Up @@ -196,6 +196,8 @@ int main(int argc, const char** argv)
if (r1 == nullptr || r2 == nullptr)
std::cerr << "[main]: freopen failed!" << std::endl;
}




try
Expand Down
6 changes: 3 additions & 3 deletions hydra_app/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <iostream>
#include <sstream>

#include "../vsgl3/Timer.h"
#include "utils/Timer.h"

#if defined(_MSC_VER)
#include <GLFW/glfw3.h>
Expand All @@ -23,8 +23,8 @@

#include "input.h"

#include "../../HydraAPI/hydra_api/HydraAPI.h"
#include "../../HydraAPI/hydra_api/HydraXMLHelpers.h"
#include "hydra_api/HydraAPI.h"
#include "hydra_api/HydraXMLHelpers.h"

#include "Camera.h"

Expand Down
36 changes: 18 additions & 18 deletions hydra_app/main_app.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vsgl3", "..\vsgl3\vsgl3.vcx
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaderpack", "..\shaderpack\shaderpack.vcxproj", "{E0914440-7CB6-4D4F-84FD-49BD580663A3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clew", "..\..\HydraAPI\utils\clew\clew.vcxproj", "{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "corto", "..\..\HydraAPI\utils\corto\corto.vcxproj", "{43666DCA-D7FF-411F-823F-D04CFC49669C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clew", "..\..\HydraAPI\utils\clew\clew.vcxproj", "{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ies_parser", "..\..\HydraAPI\utils\ies_parser\ies_parser.vcxproj", "{1D53B494-4B7E-464B-82A1-A2052240F6EF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mikktspace", "..\..\HydraAPI\utils\mikktspace\mikktspace.vcxproj", "{7844C04D-F5D4-4C90-B080-6744A10C3332}"
Expand Down Expand Up @@ -120,22 +120,6 @@ Global
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.RelWithDebInfo|x64.Build.0 = Release|x64
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.RelWithDebInfo|x86.Build.0 = Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.2020Release|x64.ActiveCfg = 2020Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.2020Release|x64.Build.0 = 2020Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.2020Release|x86.ActiveCfg = 2020Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.2020Release|x86.Build.0 = 2020Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Debug|x64.ActiveCfg = Debug|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Debug|x64.Build.0 = Debug|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Debug|x86.ActiveCfg = Debug|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Debug|x86.Build.0 = Debug|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Release|x64.ActiveCfg = Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Release|x64.Build.0 = Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Release|x86.ActiveCfg = Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Release|x86.Build.0 = Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.RelWithDebInfo|x64.Build.0 = Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.RelWithDebInfo|x86.Build.0 = Release|Win32
{43666DCA-D7FF-411F-823F-D04CFC49669C}.2020Release|x64.ActiveCfg = Release|x64
{43666DCA-D7FF-411F-823F-D04CFC49669C}.2020Release|x64.Build.0 = Release|x64
{43666DCA-D7FF-411F-823F-D04CFC49669C}.2020Release|x86.ActiveCfg = Release|Win32
Expand All @@ -152,6 +136,22 @@ Global
{43666DCA-D7FF-411F-823F-D04CFC49669C}.RelWithDebInfo|x64.Build.0 = Release|x64
{43666DCA-D7FF-411F-823F-D04CFC49669C}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{43666DCA-D7FF-411F-823F-D04CFC49669C}.RelWithDebInfo|x86.Build.0 = Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.2020Release|x64.ActiveCfg = 2020Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.2020Release|x64.Build.0 = 2020Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.2020Release|x86.ActiveCfg = 2020Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.2020Release|x86.Build.0 = 2020Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Debug|x64.ActiveCfg = Debug|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Debug|x64.Build.0 = Debug|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Debug|x86.ActiveCfg = Debug|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Debug|x86.Build.0 = Debug|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Release|x64.ActiveCfg = Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Release|x64.Build.0 = Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Release|x86.ActiveCfg = Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.Release|x86.Build.0 = Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.RelWithDebInfo|x64.Build.0 = Release|x64
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{5F13E40F-C0F1-4EF4-A775-AB8BC703DE88}.RelWithDebInfo|x86.Build.0 = Release|Win32
{1D53B494-4B7E-464B-82A1-A2052240F6EF}.2020Release|x64.ActiveCfg = 2020Release|x64
{1D53B494-4B7E-464B-82A1-A2052240F6EF}.2020Release|x64.Build.0 = 2020Release|x64
{1D53B494-4B7E-464B-82A1-A2052240F6EF}.2020Release|x86.ActiveCfg = 2020Release|Win32
Expand Down
2 changes: 1 addition & 1 deletion hydra_app/main_app_console.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "../hydra_drv/RenderDriverRTE.h"
#include "../../HydraAPI/hydra_api/HydraLegacyUtils.h"
#include "hydra_api/HydraLegacyUtils.h"

#include "main.h"

Expand Down
4 changes: 2 additions & 2 deletions hydra_app/main_app_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "../hydra_drv/RenderDriverRTE.h"
#include "../../HydraAPI/hydra_api/HydraLegacyUtils.h"
#include "hydra_api/HydraLegacyUtils.h"

#include "main.h"
#include "../../HydraAPI/hydra_api/HR_HDRImageTool.h"
#include "hydra_api/HR_HDRImageTool.h"

using pugi::xml_node;
using pugi::xml_attribute;
Expand Down
2 changes: 1 addition & 1 deletion hydra_app/main_app_window.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "main.h"
#include "Camera.h"

#include "../../HydraAPI/hydra_api/HydraRenderDriverAPI.h"
#include "hydra_api/HydraRenderDriverAPI.h"
IHRRenderDriver* CreateDriverRTE(const wchar_t* a_cfg, int w, int h, int a_devId, int a_flags);

#ifndef WIN32
Expand Down
6 changes: 4 additions & 2 deletions hydra_drv/AbstractMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ namespace RAYTR
{
public:


ILight()
ILight() : tmpSkyLightBackTexId(INVALID_TEXTURE), tmpSkyLightBackGamma(2.2f)
{
memset(m_plain.data, 0, sizeof(m_plain.data));
m_plain.data[PLIGHT_PROB_MULT] = 1.0f;
Expand Down Expand Up @@ -146,6 +145,9 @@ namespace RAYTR
inline int32_t GetType () const { return as_int(m_plain.data[PLIGHT_TYPE]); }
inline int32_t GetFlags() const { return as_int(m_plain.data[PLIGHT_FLAGS]); }

int32_t tmpSkyLightBackTexId;
float tmpSkyLightBackGamma;

protected:

void TransformIESMatrix(const float4x4& a_matrix, PlainLight& copy);
Expand Down
3 changes: 3 additions & 0 deletions hydra_drv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG -D_DEBUG)
endif()


include_directories(${HYDRA_API_ROOT_DIR})

find_package(OpenMP REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
Expand Down
4 changes: 2 additions & 2 deletions hydra_drv/GPUOCLLayer.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "GPUOCLLayer.h"
#include "crandom.h"

#include "../../HydraAPI/hydra_api/xxhash.h"
#include "../../HydraAPI/hydra_api/ssemath.h"
#include "hydra_api/xxhash.h"
#include "hydra_api/ssemath.h"

#include "cl_scan_gpu.h"

Expand Down
5 changes: 2 additions & 3 deletions hydra_drv/GPUOCLLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
#include "IHWLayer.h"

#ifdef WIN32
#include "../../HydraAPI/utils/clew/clew.h"
#include "clew/clew.h"
#else
#include <CL/cl.h>
#endif

#include "../vsgl3/clHelper.h"
#include "../vsgl3/Timer.h"

#include "utils/Timer.h"
#include "bitonic_sort_gpu.h"

/** \brief OpenCL HWLayer.
Expand Down
4 changes: 2 additions & 2 deletions hydra_drv/GPUOCLLayerAdvanced.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "GPUOCLLayer.h"
#include "crandom.h"

#include "../../HydraAPI/hydra_api/xxhash.h"
#include "../../HydraAPI/hydra_api/ssemath.h"
#include "hydra_api/xxhash.h"
#include "hydra_api/ssemath.h"

#include "cl_scan_gpu.h"

Expand Down
2 changes: 1 addition & 1 deletion hydra_drv/GPUOCLLayerMLT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "GPUOCLLayer.h"
#include "crandom.h"

#include "../../HydraAPI/hydra_api/xxhash.h"
#include "hydra_api/xxhash.h"
#include "cl_scan_gpu.h"

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion hydra_drv/GPUOCLLayerOther.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#undef min
#undef max

#include "../../HydraAPI/hydra_api/ssemath.h"
#include "hydra_api/ssemath.h"

void GPUOCLLayer::AddContributionToScreen(cl_mem& in_color, cl_mem in_indices, bool a_copyToLDRNow, int a_layerId, bool a_repackIndex)
{
Expand Down
2 changes: 1 addition & 1 deletion hydra_drv/IESRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static const float DEG_TO_RAD = M_PI / 180.0f;
namespace oldies
{
extern "C" {
#include "../../HydraAPI/utils/ies_parser/IESNA.H"
#include "utils/ies_parser/IESNA.H"
};
};

Expand Down
4 changes: 2 additions & 2 deletions hydra_drv/IHWLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "IBVHBuilderAPI.h"
#include "IMemoryStorage.h"

#include "../../HydraAPI/hydra_api/HydraAPI.h"
#include "../../HydraAPI/hydra_api/HydraInternal.h"
#include "hydra_api/HydraAPI.h"
#include "hydra_api/HydraInternal.h"

typedef void(*RTE_PROGRESSBAR_CALLBACK)(const wchar_t* message, float a_progress);

Expand Down
6 changes: 3 additions & 3 deletions hydra_drv/PlainLightConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#include "AbstractMaterial.h"
#include "IMemoryStorage.h"

#include "../../HydraAPI/hydra_api/pugixml.hpp"
#include "../../HydraAPI/hydra_api/HydraXMLHelpers.h"
#include "hydra_api/pugixml.hpp"
#include "hydra_api/HydraXMLHelpers.h"

#include "HDRImageLite.h"

using RAYTR::ILight;

static const bool ROTATE_IES_90_DEG = true;
static const float OLD_PHOTOMETRIC_SCALE = M_PI;
static const float OLD_PHOTOMETRIC_SCALE = 1.0f; // M_PI;

SWTexSampler DummySampler();

Expand Down
7 changes: 5 additions & 2 deletions hydra_drv/PlainMaterialConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//

#include "AbstractMaterial.h"
#include "../../HydraAPI/hydra_api/pugixml.hpp"
#include "../../HydraAPI/hydra_api/HydraXMLHelpers.h"
#include "hydra_api/pugixml.hpp"
#include "hydra_api/HydraXMLHelpers.h"

#include "RenderDriverRTE.h"

Expand Down Expand Up @@ -1407,6 +1407,9 @@ std::shared_ptr<IMaterial> CreateMaterialFromXmlNode(pugi::xml_node a_node, Rend
int enableRefl = back.attribute(L"reflection").as_int();
if (enableRefl == 1)
pResult->AddFlags(PLAIN_MATERIAL_CAMERA_MAPPED_REFL);

if(back.attribute(L"fix_black_triangles").as_int() == 1)
pResult->AddFlags(PLAIN_MATERIAL_CATCHER_FIX_BLACK_TRIANGLES);
}

if(length(colorE) > 1e-4f) // emissive shadow catcher
Expand Down
Loading

0 comments on commit e42f753

Please sign in to comment.