1 | #include "VisibilityEnvironment.h"
|
---|
2 | #include "common.h"
|
---|
3 | #include "Environment.h"
|
---|
4 |
|
---|
5 |
|
---|
6 | namespace GtpVisibility {
|
---|
7 |
|
---|
8 | //-----------------------------------------------------------------------
|
---|
9 | VisibilityEnvironment::VisibilityEnvironment()
|
---|
10 | {
|
---|
11 | // load debug stream
|
---|
12 | GtpVisibilityPreprocessor::Debug.open("debug.log");
|
---|
13 |
|
---|
14 | // load environment
|
---|
15 | mEnvironment = new GtpVisibilityPreprocessor::Environment();
|
---|
16 | }
|
---|
17 | //-----------------------------------------------------------------------
|
---|
18 | VisibilityEnvironment::~VisibilityEnvironment()
|
---|
19 | {
|
---|
20 | DEL_PTR(mEnvironment);
|
---|
21 | }
|
---|
22 | //-----------------------------------------------------------------------
|
---|
23 | bool VisibilityEnvironment::LoadEnvironment(string filename)
|
---|
24 | {
|
---|
25 | //-- parse filename into c-style argument list
|
---|
26 | /*char argc = 2;
|
---|
27 | char *argv[2];
|
---|
28 | argv[0] = "";
|
---|
29 |
|
---|
30 | char fname[200];
|
---|
31 | sprintf(fname, "%s", filename.c_str());
|
---|
32 | argv[1] = fname;
|
---|
33 |
|
---|
34 | GtpVisibilityPreprocessor::Debug << "here4 loading environment from: " << argv[1] << endl;
|
---|
35 | */
|
---|
36 | //-- parse environment
|
---|
37 | return mEnvironment->ReadEnvFile(filename.c_str());
|
---|
38 | //return GtpVisibilityPreprocessor::environment->Parse(argc, argv, false);
|
---|
39 | }
|
---|
40 | //-----------------------------------------------------------------------
|
---|
41 | std::string VisibilityEnvironment::getSceneFileName()
|
---|
42 | {
|
---|
43 | char str[200];
|
---|
44 | mEnvironment->GetStringValue("Scene.filename", str);
|
---|
45 | return str;
|
---|
46 | }
|
---|
47 | //-----------------------------------------------------------------------
|
---|
48 | std::string VisibilityEnvironment::getViewCellsFileName()
|
---|
49 | {
|
---|
50 | char str[200];
|
---|
51 | mEnvironment->GetStringValue("ViewCells.filename", str);
|
---|
52 | return str;
|
---|
53 | }
|
---|
54 | //-----------------------------------------------------------------------
|
---|
55 | GtpVisibilityPreprocessor::Environment *VisibilityEnvironment::GetPreprocessorEnvironment()
|
---|
56 | {
|
---|
57 | return mEnvironment;
|
---|
58 | }
|
---|
59 | } // namespace GtpVisibility
|
---|