-
Notifications
You must be signed in to change notification settings - Fork 371
Expand file tree
/
Copy pathmain.cpp
More file actions
52 lines (45 loc) · 1.81 KB
/
main.cpp
File metadata and controls
52 lines (45 loc) · 1.81 KB
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
#include "stdafx.h"
#include "Visualizer.h"
#include "GlobalAppState.h"
int _tmain(int argc, _TCHAR* argv[])
{
Visualizer callback;
std::string fileNameDescGlobalApp = "zParametersScan.txt";
std::string scanDir = "";
if (argc == 3) { //overwrite scanDir with command line args
std::wstring argParam = std::wstring(argv[1]);
std::wstring argScanDir = std::wstring(argv[2]);
fileNameDescGlobalApp =std::string(argParam.begin(), argParam.end());
scanDir = std::string(argScanDir.begin(), argScanDir.end());
}
std::cout << VAR_NAME(fileNameDescGlobalApp) << " = " << fileNameDescGlobalApp << std::endl;
ParameterFile parameterFileGlobalApp(fileNameDescGlobalApp);
GlobalAppState::get().readMembers(parameterFileGlobalApp);
if (!scanDir.empty()) GlobalAppState::get().s_scanDir = scanDir;
GlobalAppState::get().print();
//get image size
unsigned int colorWidth = 0, colorHeight = 0;
scanDir = GlobalAppState::get().s_scanDir;
scanDir = util::replace(scanDir, '\\', '/');
if (scanDir.back() != '/') scanDir.push_back('/');
const std::string scanName = util::split(scanDir, "/").back();
const std::string metaFile = scanDir + scanName + ".txt";
if (util::fileExists(metaFile)) {
ParameterFile pf(metaFile);
if (!pf.readParameter<unsigned int>("colorWidth", colorWidth)) {
std::cerr << "ERROR: failed to read \"colorWidth\" param from " << metaFile << std::endl;
return -1;
};
if (!pf.readParameter<unsigned int>("colorHeight", colorHeight)) {
std::cerr << "ERROR: failed to read \"colorHeight\" param from " << metaFile << std::endl;
return -1;
};
}
else {
std::cout << "ERROR: meta-file (" << metaFile << ") does not exist! " << std::endl;
return -1;
}
ApplicationWin32 app(NULL, colorWidth, colorHeight, "Project Annotations", GraphicsDeviceTypeD3D11, callback);
app.messageLoop();
return 0;
}