-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
54 lines (44 loc) · 2.02 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <tunan/scene/importers.h>
#include <tunan/utils/memory/CudaAllocator.h>
#include <tunan/utils/ResourceManager.h>
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
#if __has_include(<filesystem>)
#define GHC_USE_STD_FS
#include <filesystem>
namespace fs = std::filesystem;
#endif
#endif
#ifndef GHC_USE_STD_FS
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include <ext/ghc/filesystem.hpp>
namespace fs = ghc::filesystem;
#endif
#include <tunan/tracer/path.h>
int main() {
// TODO delete for testing
using namespace tunan;
using namespace tunan::importer;
using namespace tunan::utils;
using namespace tunan::tracer;
using namespace tunan::sampler;
Allocator *resource = new CudaAllocator();
ResourceManager allocator(resource);
// std::string sceneDirectory = fs::current_path().generic_string() + "/resource/scenes/cornel-box/";
// std::string sceneDirectory = fs::current_path().generic_string() + "/resource/scenes/cbox-bunny/";
// std::string sceneDirectory = fs::current_path().generic_string() + "/resource/scenes/dragon/";
// std::string sceneDirectory = fs::current_path().generic_string() + "/resource/scenes/cbox-bunny-material/";
std::string sceneDirectory = fs::current_path().generic_string() + "/resource/scenes/classroom/";
// std::string sceneDirectory = fs::current_path().generic_string() + "/resource/scenes/teapot-full/";
// std::string sceneDirectory = fs::current_path().generic_string() + "/resource/scenes/material-testball/";
// std::string sceneDirectory = fs::current_path().generic_string() + "/resource/scenes/dragon/";
// std::string sceneDirectory = "/resource/scenes/cornel-box/";
MitsubaSceneImporter importer = MitsubaSceneImporter();
SceneData parsedScene;
importer.importScene(sceneDirectory, parsedScene, &allocator);
PathTracer tracer(parsedScene, &allocator);
tracer.render();
// TODO think about resource deallocation
// delete resource;
return 0;
}