[372] | 1 | // ================================================================
|
---|
| 2 | // $Id: environ.cpp,v 1.1 2004/02/16 14:45:59 bittner Exp $
|
---|
| 3 | //
|
---|
| 4 | // environ.cpp
|
---|
| 5 | // Implementation of the environment operations, ie. reading
|
---|
| 6 | // environment file, reading command line parameters etc.
|
---|
| 7 | //
|
---|
| 8 |
|
---|
| 9 | //#define _DEBUG_PARAMS
|
---|
| 10 |
|
---|
| 11 | #include <math.h>
|
---|
| 12 | #include <stdlib.h>
|
---|
| 13 | #include <stdio.h>
|
---|
| 14 | #include <string.h>
|
---|
| 15 | #include <fstream>
|
---|
| 16 |
|
---|
| 17 | #include "gzstream.h"
|
---|
| 18 | #include "common.h"
|
---|
| 19 | #include "Environment.h"
|
---|
| 20 | #include "Vector3.h"
|
---|
| 21 |
|
---|
[863] | 22 | using namespace std;
|
---|
[372] | 23 |
|
---|
[863] | 24 | namespace GtpVisibilityPreprocessor {
|
---|
[860] | 25 |
|
---|
[863] | 26 |
|
---|
| 27 |
|
---|
[1004] | 28 | //Environment *environment = NULL;
|
---|
| 29 | Environment *Environment::sEnvironment = NULL;
|
---|
[372] | 30 |
|
---|
[1004] | 31 |
|
---|
| 32 | Environment *Environment::GetSingleton()
|
---|
| 33 | {
|
---|
| 34 | if (!sEnvironment)
|
---|
| 35 | {
|
---|
| 36 | sEnvironment = new Environment();
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | return sEnvironment;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | void Environment::DelSingleton()
|
---|
| 43 | {
|
---|
| 44 | DEL_PTR(sEnvironment);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 |
|
---|
[372] | 48 | Environment::~Environment()
|
---|
| 49 | {
|
---|
| 50 | int i, j;
|
---|
| 51 |
|
---|
| 52 | // delete the params structure
|
---|
| 53 | for (i = 0; i < numParams; i++) {
|
---|
| 54 | for (j = 0; j < paramRows; j++)
|
---|
| 55 | if (params[i][j] != NULL)
|
---|
| 56 | delete[] params[i][j];
|
---|
| 57 | if (params[i] != NULL)
|
---|
| 58 | delete[] params[i];
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | if (params != NULL)
|
---|
| 62 | delete[] params;
|
---|
| 63 |
|
---|
| 64 | // delete the options structure
|
---|
| 65 | if (options != NULL)
|
---|
| 66 | delete[] options;
|
---|
| 67 |
|
---|
| 68 | if (optionalParams != NULL)
|
---|
[938] | 69 | DEL_PTR(optionalParams);
|
---|
[372] | 70 | }
|
---|
| 71 |
|
---|
| 72 | bool
|
---|
| 73 | Environment::CheckForSwitch(const int argc,
|
---|
[492] | 74 | char **argv,
|
---|
| 75 | const char swtch) const
|
---|
[372] | 76 | {
|
---|
| 77 | for (int i = 1; i < argc; i++)
|
---|
| 78 | if ((argv[i][0] == '-') && (argv[i][1] == swtch))
|
---|
| 79 | return true;
|
---|
| 80 | return false;
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | bool
|
---|
| 84 | Environment::CheckType(const char *value,
|
---|
| 85 | const EOptType type) const
|
---|
| 86 | {
|
---|
| 87 | char *s, *t, *u;
|
---|
| 88 |
|
---|
| 89 | switch (type) {
|
---|
| 90 | case optInt: {
|
---|
| 91 | strtol(value, &t, 10);
|
---|
| 92 | if (value + strlen(value) != t)
|
---|
| 93 | return false;
|
---|
| 94 | else
|
---|
| 95 | return true;
|
---|
| 96 | }
|
---|
| 97 | case optFloat: {
|
---|
| 98 | strtod(value, &t);
|
---|
| 99 | if (value + strlen(value) != t)
|
---|
| 100 | return false;
|
---|
| 101 | else
|
---|
| 102 | return true;
|
---|
| 103 | }
|
---|
| 104 | case optBool: {
|
---|
| 105 | if (!strcasecmp(value, "true") ||
|
---|
| 106 | !strcasecmp(value, "false") ||
|
---|
| 107 | !strcasecmp(value, "YES") ||
|
---|
| 108 | !strcasecmp(value, "NO") ||
|
---|
| 109 | !strcmp(value, "+") ||
|
---|
| 110 | !strcmp(value, "-") ||
|
---|
| 111 | !strcasecmp(value, "ON") ||
|
---|
| 112 | !strcasecmp(value, "OFF"))
|
---|
| 113 | return true;
|
---|
| 114 | return false;
|
---|
| 115 | }
|
---|
| 116 | case optVector:{
|
---|
| 117 | strtod(value, &s);
|
---|
| 118 | if (*s == ' ' || *s == '\t') {
|
---|
| 119 | while (*s == ' ' || *s == '\t')
|
---|
| 120 | s++;
|
---|
| 121 | if (*s != ',')
|
---|
| 122 | s--;
|
---|
| 123 | }
|
---|
| 124 | if ((*s != ',' && *s != ' ' && *s != '\t') || value == s)
|
---|
| 125 | return false;
|
---|
| 126 | t = s;
|
---|
| 127 | strtod(s + 1, &u);
|
---|
| 128 | if (*u == ' ' || *u == '\t') {
|
---|
| 129 | while (*u == ' ' || *u == '\t')
|
---|
| 130 | u++;
|
---|
| 131 | if (*u != ',')
|
---|
| 132 | u--;
|
---|
| 133 | }
|
---|
| 134 | if ((*u != ',' && *s != ' ' && *s != '\t') || t == u)
|
---|
| 135 | return false;
|
---|
| 136 | t = u;
|
---|
| 137 | strtod(u + 1, &s);
|
---|
| 138 | if (t == s || value + strlen(value) != s)
|
---|
| 139 | return false;
|
---|
| 140 | return true;
|
---|
| 141 | }
|
---|
| 142 | case optString: {
|
---|
| 143 | return true;
|
---|
| 144 | }
|
---|
| 145 | default: {
|
---|
| 146 | Debug << "Internal error: Unknown type of option.\n" << flush;
|
---|
| 147 | exit(1);
|
---|
| 148 | }
|
---|
| 149 | }
|
---|
| 150 | return false;
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | void
|
---|
| 154 | Environment::ReadCmdlineParams(const int argc,
|
---|
[492] | 155 | char **argv,
|
---|
| 156 | const char *optParams)
|
---|
[372] | 157 | {
|
---|
| 158 | int i;
|
---|
| 159 |
|
---|
| 160 | // Make sure we are called for the first time
|
---|
| 161 | if (optionalParams != NULL)
|
---|
| 162 | return;
|
---|
| 163 |
|
---|
[472] | 164 | numParams = (int)strlen(optParams) + 1;
|
---|
[372] | 165 | optionalParams = new char[numParams];
|
---|
| 166 | strcpy(optionalParams, optParams);
|
---|
| 167 |
|
---|
| 168 | // First, count all non-optional parameters on the command line
|
---|
| 169 | for (i = 1; i < argc; i++)
|
---|
| 170 | if (argv[i][0] != '-')
|
---|
| 171 | paramRows++;
|
---|
| 172 |
|
---|
| 173 | // if there is no non-optional parameter add a default one...
|
---|
| 174 | if (paramRows == 0)
|
---|
| 175 | paramRows = 1;
|
---|
| 176 |
|
---|
| 177 | // allocate and initialize the table for parameters
|
---|
| 178 | params = new char **[numParams];
|
---|
| 179 | for (i = 0; i < numParams; i++) {
|
---|
| 180 | params[i] = new char *[paramRows];
|
---|
| 181 | for (int j = 0; j < paramRows; j++)
|
---|
| 182 | params[i][j] = NULL;
|
---|
| 183 | }
|
---|
| 184 | // Now read all non-optional and optional parameters into the table
|
---|
| 185 | curRow = -1;
|
---|
| 186 | for (i = 1; i < argc; i++) {
|
---|
| 187 | if (argv[i][0] != '-') {
|
---|
| 188 | // non-optional parameter encountered
|
---|
| 189 | curRow++;
|
---|
| 190 | params[0][curRow] = new char[strlen(argv[i]) + 1];
|
---|
| 191 | strcpy(params[0][curRow], argv[i]);
|
---|
| 192 | }
|
---|
| 193 | else {
|
---|
| 194 | // option encountered
|
---|
| 195 | char *t = strchr(optionalParams, argv[i][1]);
|
---|
| 196 | if (t != NULL) {
|
---|
| 197 | // this option is optional parameter
|
---|
| 198 | int index = t - optionalParams + 1;
|
---|
| 199 | if (curRow < 0) {
|
---|
| 200 | // it's a global parameter
|
---|
| 201 | for (int j = 0; j < paramRows; j++) {
|
---|
| 202 | params[index][j] = new char[strlen(argv[i] + 2) + 1];
|
---|
| 203 | strcpy(params[index][j], argv[i] + 2);
|
---|
| 204 | }
|
---|
| 205 | }
|
---|
| 206 | else {
|
---|
| 207 | // it's a scene parameter
|
---|
| 208 | if (params[index][curRow] != NULL) {
|
---|
| 209 | delete[] params[index][curRow];
|
---|
| 210 | }
|
---|
| 211 | params[index][curRow] = new char[strlen(argv[i] + 2) + 1];
|
---|
| 212 | strcpy(params[index][curRow], argv[i] + 2);
|
---|
| 213 | }
|
---|
| 214 | }
|
---|
| 215 | }
|
---|
| 216 | }
|
---|
| 217 | curRow = 0;
|
---|
| 218 |
|
---|
| 219 | #ifdef _DEBUG_PARAMS
|
---|
| 220 | // write out the parameter table
|
---|
| 221 | cerr << "Parameter table for " << numParams << " columns and "
|
---|
| 222 | << paramRows << " rows:\n";
|
---|
| 223 | for (int j = 0; j < paramRows; j++) {
|
---|
| 224 | for (i = 0; i < numParams; i++) {
|
---|
| 225 | if (params[i][j] != NULL)
|
---|
| 226 | cerr << params[i][j];
|
---|
| 227 | else
|
---|
| 228 | cerr << "NULL";
|
---|
| 229 | cerr << "\t";
|
---|
| 230 | }
|
---|
| 231 | cerr << "\n";
|
---|
| 232 | }
|
---|
| 233 | cerr << "Params done.\n" << flush;
|
---|
| 234 | #endif // _DEBUG_PARAMS
|
---|
| 235 | }
|
---|
| 236 |
|
---|
| 237 | bool
|
---|
| 238 | Environment::GetParam(const char name,
|
---|
| 239 | const int index,
|
---|
| 240 | char *value) const
|
---|
| 241 | {
|
---|
| 242 | int column;
|
---|
| 243 |
|
---|
| 244 | if (index >= paramRows || index < 0)
|
---|
| 245 | return false;
|
---|
| 246 | if (name == ' ')
|
---|
| 247 | column = 0;
|
---|
| 248 | else {
|
---|
| 249 | char *t = strchr(optionalParams, name);
|
---|
| 250 |
|
---|
| 251 | if (t == NULL)
|
---|
| 252 | return false;
|
---|
| 253 | column = t - optionalParams + 1;
|
---|
| 254 | }
|
---|
| 255 |
|
---|
| 256 | if (params[column][index] == NULL)
|
---|
| 257 | return false;
|
---|
| 258 | // value = new char[strlen(params[column][index]) + 1];
|
---|
| 259 | strcpy(value, params[column][index]);
|
---|
| 260 | return true;
|
---|
| 261 | }
|
---|
| 262 |
|
---|
| 263 | void
|
---|
| 264 | Environment::RegisterOption(const char *name,
|
---|
[1002] | 265 | const EOptType type,
|
---|
| 266 | const char *abbrev,
|
---|
| 267 | const char *defValue)
|
---|
[372] | 268 | {
|
---|
| 269 | int i;
|
---|
| 270 |
|
---|
| 271 | // make sure this option was not yet registered
|
---|
| 272 | for (i = 0; i < numOptions; i++)
|
---|
| 273 | if (!strcmp(name, options[i].name)) {
|
---|
| 274 | Debug << "Error: Option " << name << " registered twice.\n";
|
---|
| 275 | exit(1);
|
---|
| 276 | }
|
---|
| 277 | // make sure we have enough room in memory
|
---|
| 278 | if (numOptions >= maxOptions) {
|
---|
| 279 | Debug << "Error: Too many options. Try enlarge the maxOptions "
|
---|
| 280 | << "definition.\n";
|
---|
| 281 | exit(1);
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | // make sure the abbreviation doesn't start with 'D'
|
---|
| 285 | if (abbrev != NULL && (abbrev[0] == 'D' )) {
|
---|
| 286 | Debug << "Internal error: reserved switch " << abbrev
|
---|
| 287 | << " used as an abbreviation.\n";
|
---|
| 288 | exit(1);
|
---|
| 289 | }
|
---|
| 290 | // new option
|
---|
| 291 | options[numOptions].type = type;
|
---|
[863] | 292 | options[numOptions].name = ::strdup(name);
|
---|
[372] | 293 | // assign abbreviation, if requested
|
---|
| 294 | if (abbrev != NULL) {
|
---|
[863] | 295 | options[numOptions].abbrev = ::strdup(abbrev);
|
---|
[372] | 296 | }
|
---|
| 297 | // assign default value, if requested
|
---|
| 298 | if (defValue != NULL) {
|
---|
[863] | 299 | options[numOptions].defaultValue = ::strdup(defValue);
|
---|
[372] | 300 | if (!CheckType(defValue, type)) {
|
---|
| 301 | Debug << "Internal error: Inconsistent type and default value in option "
|
---|
| 302 | << name << ".\n";
|
---|
| 303 | exit(1);
|
---|
| 304 | }
|
---|
| 305 | }
|
---|
| 306 | // new option registered
|
---|
| 307 | numOptions++;
|
---|
| 308 | }
|
---|
| 309 |
|
---|
| 310 | bool
|
---|
| 311 | Environment::OptionPresent(const char *name) const
|
---|
| 312 | {
|
---|
| 313 | bool found = false;
|
---|
| 314 | int i;
|
---|
| 315 |
|
---|
| 316 | for (i = 0; i < numOptions; i++)
|
---|
| 317 | if (!strcmp(options[i].name, name)) {
|
---|
| 318 | found = true;
|
---|
| 319 | break;
|
---|
| 320 | }
|
---|
| 321 | if (!found) {
|
---|
| 322 | Debug << "Internal error: Option " << name << " not registered.\n" << flush;
|
---|
| 323 | exit(1);
|
---|
| 324 | }
|
---|
| 325 | if (options[i].value != NULL || options[i].defaultValue != NULL)
|
---|
| 326 | return true;
|
---|
| 327 | else
|
---|
| 328 | return false;
|
---|
| 329 | }
|
---|
| 330 |
|
---|
| 331 | int
|
---|
[938] | 332 | Environment::FindOption(const char *name, const bool isFatal) const
|
---|
[372] | 333 | {
|
---|
| 334 | int i;
|
---|
| 335 | bool found = false;
|
---|
| 336 | // is this option registered ?
|
---|
| 337 | for (i = 0; i < numOptions; i++)
|
---|
| 338 | if (!strcmp(options[i].name, name)) {
|
---|
| 339 | found = true;
|
---|
| 340 | break;
|
---|
| 341 | }
|
---|
| 342 | if (!found) {
|
---|
| 343 | // no registration found
|
---|
| 344 | Debug << "Internal error: Required option " << name
|
---|
| 345 | << " not registered.\n" << flush;
|
---|
| 346 | exit(1);
|
---|
| 347 | }
|
---|
| 348 | if (options[i].value == NULL && options[i].defaultValue == NULL)
|
---|
| 349 | // this option was not initialised to some value
|
---|
| 350 | if (isFatal) {
|
---|
| 351 | Debug << "Error: Required option " << name << " not found.\n" << flush;
|
---|
| 352 | exit(1);
|
---|
| 353 | }
|
---|
| 354 | else {
|
---|
| 355 | Debug << "Error: Required option " << name << " not found.\n" << flush;
|
---|
| 356 | return -1;
|
---|
| 357 | }
|
---|
| 358 | return i;
|
---|
| 359 | }
|
---|
| 360 |
|
---|
| 361 | bool
|
---|
| 362 | Environment::GetIntValue(const char *name,
|
---|
| 363 | int &value,
|
---|
| 364 | const bool isFatal) const
|
---|
| 365 | {
|
---|
| 366 | int i = FindOption(name, isFatal);
|
---|
| 367 |
|
---|
| 368 | if (i<0)
|
---|
| 369 | return false;
|
---|
| 370 |
|
---|
| 371 | if (options[i].value != NULL) {
|
---|
| 372 | // option was explicitly specified
|
---|
| 373 | value = strtol(options[i].value, NULL, 10);
|
---|
| 374 | } else {
|
---|
| 375 | // option was not read, so use the default
|
---|
| 376 | value = strtol(options[i].defaultValue, NULL, 10);
|
---|
| 377 | }
|
---|
| 378 |
|
---|
| 379 | return true;
|
---|
| 380 | }
|
---|
| 381 |
|
---|
| 382 | bool
|
---|
| 383 | Environment::GetDoubleValue(const char *name,
|
---|
| 384 | double &value,
|
---|
| 385 | const bool isFatal) const
|
---|
| 386 | {
|
---|
| 387 | int i = FindOption(name, isFatal);
|
---|
| 388 |
|
---|
| 389 | if (i<0)
|
---|
| 390 | return false;
|
---|
| 391 |
|
---|
| 392 | if (options[i].value != NULL) {
|
---|
| 393 | // option was explicitly specified
|
---|
| 394 | value = strtod(options[i].value, NULL);
|
---|
| 395 | } else {
|
---|
| 396 | // option was not read, so use the default
|
---|
| 397 | value = strtod(options[i].defaultValue, NULL);
|
---|
| 398 | }
|
---|
| 399 | return true;
|
---|
| 400 | }
|
---|
| 401 |
|
---|
| 402 | bool
|
---|
| 403 | Environment::GetRealValue(const char *name,
|
---|
| 404 | Real &value,
|
---|
| 405 | const bool isFatal) const
|
---|
| 406 | {
|
---|
| 407 | int i = FindOption(name, isFatal);
|
---|
| 408 |
|
---|
| 409 | if (i<0)
|
---|
| 410 | return false;
|
---|
| 411 |
|
---|
| 412 | if (options[i].value != NULL) {
|
---|
| 413 | // option was explicitly specified
|
---|
[472] | 414 | value = (Real)strtod(options[i].value, NULL);
|
---|
[372] | 415 | } else {
|
---|
| 416 | // option was not read, so use the default
|
---|
[472] | 417 | value = (Real)strtod(options[i].defaultValue, NULL);
|
---|
[372] | 418 | }
|
---|
| 419 | return true;
|
---|
| 420 | }
|
---|
| 421 |
|
---|
| 422 | bool
|
---|
| 423 | Environment::GetFloatValue(const char *name,
|
---|
| 424 | float &value,
|
---|
| 425 | const bool isFatal) const
|
---|
| 426 | {
|
---|
| 427 | int i = FindOption(name, isFatal);
|
---|
| 428 |
|
---|
| 429 | if (i<0)
|
---|
| 430 | return false;
|
---|
| 431 |
|
---|
| 432 | if (options[i].value != NULL) {
|
---|
| 433 | // option was explicitly specified
|
---|
| 434 | value = (float)strtod(options[i].value, NULL);
|
---|
| 435 | } else {
|
---|
| 436 | // option was not read, so use the default
|
---|
| 437 | value = (float)strtod(options[i].defaultValue, NULL);
|
---|
| 438 | }
|
---|
| 439 | return true;
|
---|
| 440 | }
|
---|
| 441 |
|
---|
| 442 | bool
|
---|
| 443 | Environment::GetBool(const char *name,
|
---|
| 444 | const bool isFatal) const
|
---|
| 445 | {
|
---|
| 446 | bool ret;
|
---|
| 447 | if (GetBoolValue(name, ret, isFatal))
|
---|
| 448 | return ret;
|
---|
| 449 | else
|
---|
| 450 | return false;
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | bool
|
---|
| 454 | Environment::ParseBool(const char *name) const
|
---|
| 455 | {
|
---|
| 456 |
|
---|
| 457 | bool value = true;
|
---|
| 458 |
|
---|
| 459 | if (!strcasecmp(name, "false") ||
|
---|
| 460 | !strcasecmp(name, "NO") ||
|
---|
| 461 | !strcmp(name, "-") ||
|
---|
| 462 | !strcasecmp(name, "OFF"))
|
---|
| 463 | value = false;
|
---|
| 464 |
|
---|
| 465 | return value;
|
---|
| 466 | }
|
---|
| 467 |
|
---|
| 468 | void
|
---|
| 469 | Environment::ParseVector(const char *name, Vector3 &v) const
|
---|
| 470 | {
|
---|
| 471 | // option was not read, so use the default
|
---|
| 472 | char *s, *t;
|
---|
| 473 |
|
---|
| 474 | v.x = (Real)strtod(name, &s);
|
---|
| 475 | v.y = (Real)strtod(s + 1, &t);
|
---|
| 476 | v.z = (Real)strtod(t + 1, NULL);
|
---|
| 477 |
|
---|
| 478 | }
|
---|
| 479 |
|
---|
| 480 | bool
|
---|
| 481 | Environment::GetBoolValue(const char *name,
|
---|
| 482 | bool &value,
|
---|
| 483 | const bool isFatal) const
|
---|
| 484 | {
|
---|
| 485 | int i = FindOption(name, isFatal);
|
---|
| 486 |
|
---|
| 487 | if (i<0)
|
---|
| 488 | return false;
|
---|
| 489 |
|
---|
| 490 |
|
---|
| 491 | if (options[i].value != NULL)
|
---|
| 492 | value = ParseBool(options[i].value);
|
---|
| 493 | else
|
---|
| 494 | value = ParseBool(options[i].defaultValue);
|
---|
| 495 |
|
---|
| 496 | return true;
|
---|
| 497 | }
|
---|
| 498 |
|
---|
| 499 | bool
|
---|
| 500 | Environment::GetVectorValue(const char *name,
|
---|
| 501 | Vector3 &v,
|
---|
| 502 | const bool isFatal) const
|
---|
| 503 | {
|
---|
| 504 | int i = FindOption(name, isFatal);
|
---|
| 505 | if (i<0)
|
---|
| 506 | return false;
|
---|
| 507 |
|
---|
| 508 | if (options[i].value != NULL)
|
---|
| 509 |
|
---|
| 510 |
|
---|
| 511 | if (options[i].value != NULL) {
|
---|
| 512 | ParseVector(options[i].value, v);
|
---|
| 513 | }
|
---|
| 514 | else {
|
---|
| 515 | ParseVector(options[i].defaultValue, v);
|
---|
| 516 | }
|
---|
| 517 | return true;
|
---|
| 518 | }
|
---|
| 519 |
|
---|
| 520 | bool
|
---|
| 521 | Environment::GetStringValue(const char *name,
|
---|
| 522 | char *value,
|
---|
| 523 | const bool isFatal) const
|
---|
| 524 | {
|
---|
| 525 | int i = FindOption(name, isFatal);
|
---|
| 526 |
|
---|
| 527 | if (i<0)
|
---|
| 528 | return false;
|
---|
| 529 |
|
---|
| 530 |
|
---|
| 531 | if (options[i].value != NULL) {
|
---|
| 532 | // option was not read, so use the default
|
---|
| 533 | strcpy(value, options[i].value);
|
---|
| 534 | }
|
---|
| 535 | else {
|
---|
| 536 | // option was explicitly specified
|
---|
| 537 | strcpy(value, options[i].defaultValue);
|
---|
| 538 | }
|
---|
| 539 | return true;
|
---|
| 540 | }
|
---|
| 541 |
|
---|
| 542 | void
|
---|
| 543 | Environment::SetInt(const char *name, const int value)
|
---|
| 544 | {
|
---|
| 545 |
|
---|
| 546 | int i = FindOption(name);
|
---|
| 547 | if (i<0)
|
---|
| 548 | return;
|
---|
| 549 |
|
---|
| 550 | if (options[i].type == optInt) {
|
---|
| 551 | delete options[i].value;
|
---|
| 552 | options[i].value = new char[16];
|
---|
| 553 | sprintf(options[i].value, "%.15d", value);
|
---|
| 554 | }
|
---|
| 555 | else {
|
---|
| 556 | Debug << "Internal error: Trying to set non-integer option " << name
|
---|
| 557 | << " to integral value.\n" << flush;
|
---|
| 558 | exit(1);
|
---|
| 559 | }
|
---|
| 560 | }
|
---|
| 561 |
|
---|
| 562 | void
|
---|
| 563 | Environment::SetFloat(const char *name, const Real value)
|
---|
| 564 | {
|
---|
| 565 | int i = FindOption(name);
|
---|
| 566 | if (i<0)
|
---|
| 567 | return;
|
---|
| 568 |
|
---|
| 569 | if (options[i].type == optFloat) {
|
---|
| 570 | delete options[i].value;
|
---|
| 571 | options[i].value = new char[25];
|
---|
| 572 | sprintf(options[i].value, "%.15e", value);
|
---|
| 573 | }
|
---|
| 574 | else {
|
---|
| 575 | Debug << "Internal error: Trying to set non-Real option " << name
|
---|
| 576 | << " to Real value.\n" << flush;
|
---|
| 577 | exit(1);
|
---|
| 578 | }
|
---|
| 579 | }
|
---|
| 580 |
|
---|
| 581 | void
|
---|
| 582 | Environment::SetBool(const char *name, const bool value)
|
---|
| 583 | {
|
---|
| 584 | int i = FindOption(name);
|
---|
| 585 | if (i<0)
|
---|
| 586 | return;
|
---|
| 587 |
|
---|
| 588 | if (options[i].type == optBool) {
|
---|
| 589 | delete options[i].value;
|
---|
| 590 | options[i].value = new char[6];
|
---|
| 591 | if (value)
|
---|
| 592 | sprintf(options[i].value, "true");
|
---|
| 593 | else
|
---|
| 594 | sprintf(options[i].value, "false");
|
---|
| 595 | }
|
---|
| 596 | else {
|
---|
| 597 | Debug << "Internal error: Trying to set non-bool option " << name
|
---|
| 598 | << " to boolean value.\n" << flush;
|
---|
| 599 | exit(1);
|
---|
| 600 | }
|
---|
| 601 | }
|
---|
| 602 |
|
---|
| 603 | void
|
---|
| 604 | Environment::SetVector(const char *name,
|
---|
| 605 | const Vector3 &v)
|
---|
| 606 | {
|
---|
| 607 | int i = FindOption(name);
|
---|
| 608 | if (i<0)
|
---|
| 609 | return;
|
---|
| 610 |
|
---|
| 611 | if (options[i].type == optVector) {
|
---|
| 612 | delete options[i].value;
|
---|
| 613 | options[i].value = new char[128];
|
---|
| 614 | sprintf(options[i].value, "%.15e,%.15e,%.15e", v.x, v.y, v.z);
|
---|
| 615 | }
|
---|
| 616 | else {
|
---|
| 617 | Debug << "Internal error: Trying to set non-vector option " << name
|
---|
| 618 | << " to vector value.\n" << flush;
|
---|
| 619 | exit(1);
|
---|
| 620 | }
|
---|
| 621 | }
|
---|
| 622 |
|
---|
| 623 | void
|
---|
| 624 | Environment::SetString(const char *name, const char *value)
|
---|
| 625 | {
|
---|
| 626 | int i = FindOption(name);
|
---|
| 627 | if (i<0)
|
---|
| 628 | return;
|
---|
| 629 |
|
---|
| 630 | if (options[i].type == optString) {
|
---|
| 631 | delete options[i].value;
|
---|
[863] | 632 | options[i].value = ::strdup(value);
|
---|
[372] | 633 | }
|
---|
| 634 | else {
|
---|
| 635 | Debug << "Internal error: Trying to set non-string option " << name
|
---|
| 636 | << " to string value.\n" << flush;
|
---|
| 637 | exit(1);
|
---|
| 638 | }
|
---|
| 639 | }
|
---|
| 640 |
|
---|
| 641 | void
|
---|
| 642 | Environment::ParseCmdline(const int argc,
|
---|
[492] | 643 | char **argv,
|
---|
| 644 | const int index)
|
---|
[372] | 645 | {
|
---|
| 646 | int curIndex = -1;
|
---|
| 647 |
|
---|
| 648 | for (int i = 1; i < argc; i++) {
|
---|
| 649 | // if this parameter is non-optional, skip it and increment the counter
|
---|
| 650 | if (argv[i][0] != '-') {
|
---|
| 651 | curIndex++;
|
---|
| 652 | continue;
|
---|
| 653 | }
|
---|
| 654 | // make sure to skip all non-optional parameters
|
---|
| 655 | char *t = strchr(optionalParams, argv[i][1]);
|
---|
| 656 | if (t != NULL)
|
---|
| 657 | continue;
|
---|
| 658 |
|
---|
| 659 | // if we are in the scope of the current parameter, parse it
|
---|
| 660 | if (curIndex == -1 || curIndex == index) {
|
---|
| 661 | if (argv[i][1] == 'D') {
|
---|
| 662 | // it's a full name definition
|
---|
| 663 | bool found = false;
|
---|
| 664 | int j;
|
---|
| 665 |
|
---|
| 666 | char *t = strchr(argv[i] + 2, '=');
|
---|
| 667 | if (t == NULL) {
|
---|
| 668 | Debug << "Error: Missing '=' in option. "
|
---|
| 669 | << "Syntax is -D<name>=<value>.\n" << flush;
|
---|
| 670 | exit(1);
|
---|
| 671 | }
|
---|
| 672 | for (j = 0; j < numOptions; j++)
|
---|
| 673 | if (!strncmp(options[j].name, argv[i] + 2, t - argv[i] - 2) &&
|
---|
| 674 | (unsigned)(t - argv[i] - 2) == strlen(options[j].name)) {
|
---|
| 675 | found = true;
|
---|
| 676 | break;
|
---|
| 677 | }
|
---|
| 678 | if (!found) {
|
---|
| 679 | Debug << "Warning: Unregistered option " << argv[i] << ".\n" << flush;
|
---|
| 680 | // exit(1);
|
---|
| 681 | }
|
---|
| 682 | if (found) {
|
---|
| 683 | if (!CheckType(t + 1, options[j].type)) {
|
---|
| 684 | Debug << "Error: invalid type of value " << t + 1 << " in option "
|
---|
| 685 | << options[j].name << ".\n";
|
---|
| 686 | exit(1);
|
---|
| 687 | }
|
---|
| 688 | if (options[j].value != NULL)
|
---|
| 689 | delete options[j].value;
|
---|
| 690 | options[j].value = strdup(t + 1);
|
---|
| 691 | }
|
---|
| 692 | }
|
---|
| 693 | else {
|
---|
| 694 | // it's an abbreviation
|
---|
| 695 | bool found = false;
|
---|
| 696 | int j;
|
---|
| 697 |
|
---|
| 698 | for (j = 0; j < numOptions; j++)
|
---|
| 699 | if (options[j].abbrev != NULL &&
|
---|
| 700 | !strncmp(options[j].abbrev, argv[i] + 1, strlen(options[j].abbrev))) {
|
---|
| 701 | found = true;
|
---|
| 702 | break;
|
---|
| 703 | }
|
---|
| 704 | if (!found) {
|
---|
| 705 | Debug << "Warning: Unregistered option " << argv[i] << ".\n" << flush;
|
---|
| 706 | // exit(1);
|
---|
| 707 | }
|
---|
| 708 | if (found) {
|
---|
| 709 | if (!CheckType(argv[i] + 1 + strlen(options[j].abbrev), options[j].type)) {
|
---|
| 710 | Debug << "Error: invalid type of value "
|
---|
| 711 | << argv[i] + 1 + strlen(options[j].abbrev) << "in option "
|
---|
| 712 | << options[j].name << ".\n";
|
---|
| 713 | exit(1);
|
---|
| 714 | }
|
---|
| 715 | if (options[j].value != NULL)
|
---|
| 716 | delete options[j].value;
|
---|
| 717 | options[j].value = strdup(argv[i] + 1 + strlen(options[j].abbrev));
|
---|
| 718 | }
|
---|
| 719 | }
|
---|
| 720 | }
|
---|
| 721 | }
|
---|
| 722 | #ifdef _DEBUG_PARAMS
|
---|
| 723 | // write out the options table
|
---|
| 724 | cerr << "Options table for " << numOptions << " options:\n";
|
---|
| 725 | for (int j = 0; j < numOptions; j++) {
|
---|
| 726 | cerr << options[j];
|
---|
| 727 | cerr << "\n";
|
---|
| 728 | }
|
---|
| 729 | cerr << "Options done.\n" << flush;
|
---|
| 730 | #endif // _DEBUG_PARAMS
|
---|
| 731 | }
|
---|
| 732 |
|
---|
| 733 |
|
---|
| 734 | char *
|
---|
| 735 | Environment::ParseString(char *buffer, char *string) const
|
---|
| 736 | {
|
---|
| 737 | char *s = buffer;
|
---|
| 738 | char *t = string + strlen(string);
|
---|
| 739 |
|
---|
| 740 | // skip leading whitespaces
|
---|
| 741 | while (*s == ' ' || *s == '\t')
|
---|
| 742 | s++;
|
---|
| 743 | if (*s == '\0')
|
---|
| 744 | return NULL;
|
---|
| 745 | while ((*s >= 'a' && *s <= 'z') ||
|
---|
| 746 | (*s >= 'A' && *s <= 'Z') ||
|
---|
| 747 | (*s >= '0' && *s <= '9') ||
|
---|
| 748 | *s == '_')
|
---|
| 749 | *t++ = *s++;
|
---|
| 750 | *t = '\0';
|
---|
| 751 | // skip trailing whitespaces
|
---|
| 752 | while (*s == ' ' || *s == '\t')
|
---|
| 753 | s++;
|
---|
| 754 | return s;
|
---|
| 755 | }
|
---|
| 756 |
|
---|
| 757 | const char code[] = "JIDHipewhfdhyd74387hHO&{WK:DOKQEIDKJPQ*H#@USX:#FWCQ*EJMQAHPQP(@G#RD";
|
---|
| 758 |
|
---|
| 759 | void
|
---|
| 760 | Environment::DecodeString(char *buff, int max)
|
---|
| 761 | {
|
---|
| 762 | buff[max] = 0;
|
---|
| 763 | char *p = buff;
|
---|
| 764 | const char *cp = code;
|
---|
| 765 | for (; *p; p++) {
|
---|
| 766 | if (*p != '\n')
|
---|
| 767 | *p = *p ^ *cp;
|
---|
| 768 | ++cp;
|
---|
| 769 | if (*cp == 0)
|
---|
| 770 | cp = code;
|
---|
| 771 | }
|
---|
| 772 | }
|
---|
| 773 |
|
---|
| 774 | void
|
---|
| 775 | Environment::CodeString(char *buff, int max)
|
---|
| 776 | {
|
---|
| 777 | buff[max] = 0;
|
---|
| 778 | char *p = buff;
|
---|
| 779 | const char *cp = code;
|
---|
| 780 | for (; *p; p++) {
|
---|
| 781 | if (*p != '\n')
|
---|
| 782 | *p = *p ^ *cp;
|
---|
| 783 | ++cp;
|
---|
| 784 | if (*cp == 0)
|
---|
| 785 | cp = code;
|
---|
| 786 | }
|
---|
| 787 | }
|
---|
| 788 |
|
---|
| 789 | void
|
---|
| 790 | Environment::SaveCodedFile(char *filenameText,
|
---|
| 791 | char *filenameCoded)
|
---|
| 792 | {
|
---|
| 793 | ifstream envStream(filenameText);
|
---|
| 794 |
|
---|
| 795 | // some error had occured
|
---|
| 796 | if (envStream.fail()) {
|
---|
| 797 | cerr << "Error: Can't open file " << filenameText << " for reading (err. "
|
---|
| 798 | << envStream.rdstate() << ").\n";
|
---|
| 799 | return;
|
---|
| 800 | }
|
---|
| 801 | char buff[256];
|
---|
| 802 | envStream.getline(buff, 255);
|
---|
| 803 | buff[8] = 0;
|
---|
| 804 | if (strcmp(buff, "CGX_CF10") == 0)
|
---|
| 805 | return;
|
---|
| 806 |
|
---|
| 807 | ofstream cStream(filenameCoded);
|
---|
| 808 | cStream<<"CGX_CF10";
|
---|
| 809 |
|
---|
| 810 | // main loop
|
---|
| 811 | for (;;) {
|
---|
| 812 | // read in one line
|
---|
| 813 | envStream.getline(buff, 255);
|
---|
| 814 | if (!envStream)
|
---|
| 815 | break;
|
---|
| 816 | CodeString(buff, 255);
|
---|
| 817 | cStream<<buff;
|
---|
| 818 | }
|
---|
| 819 |
|
---|
| 820 | }
|
---|
| 821 |
|
---|
| 822 | bool
|
---|
| 823 | Environment::ReadEnvFile(const char *envFilename)
|
---|
[975] | 824 | {
|
---|
[372] | 825 | char buff[MaxStringLength], name[MaxStringLength];
|
---|
| 826 | char *s, *t;
|
---|
| 827 | int i, line = 0;
|
---|
| 828 | bool found;
|
---|
| 829 | igzstream envStream(envFilename);
|
---|
| 830 |
|
---|
| 831 | // some error had occured
|
---|
| 832 | if (envStream.fail()) {
|
---|
| 833 | cerr << "Error: Can't open file " << envFilename << " for reading (err. "
|
---|
| 834 | << envStream.rdstate() << ").\n";
|
---|
| 835 | return false;
|
---|
| 836 | }
|
---|
[971] | 837 |
|
---|
[372] | 838 | name[0] = '\0';
|
---|
| 839 |
|
---|
| 840 | // bool coded;
|
---|
| 841 | // envStream.getline(buff, 255);
|
---|
| 842 | // buff[8] = 0;
|
---|
| 843 | // if (strcmp(buff, "CGX_CF10") == 0)
|
---|
| 844 | // coded = true;
|
---|
| 845 | // else {
|
---|
| 846 | // coded = false;
|
---|
| 847 | // envStream.Rewind();
|
---|
| 848 | // }
|
---|
| 849 |
|
---|
| 850 | // main loop
|
---|
| 851 | for (;;) {
|
---|
| 852 | // read in one line
|
---|
| 853 | envStream.getline(buff, 255);
|
---|
| 854 |
|
---|
| 855 | if (!envStream)
|
---|
| 856 | break;
|
---|
| 857 |
|
---|
| 858 | // if (coded)
|
---|
| 859 | // DecodeString(buff, 255);
|
---|
| 860 |
|
---|
| 861 | line++;
|
---|
| 862 | // get rid of comments
|
---|
| 863 | s = strchr(buff, '#');
|
---|
| 864 | if (s != NULL)
|
---|
| 865 | *s = '\0';
|
---|
| 866 |
|
---|
| 867 | // get one identifier
|
---|
| 868 | s = ParseString(buff, name);
|
---|
| 869 | // parse line
|
---|
| 870 | while (s != NULL) {
|
---|
| 871 | // it's a group name - make the full name
|
---|
| 872 | if (*s == '{') {
|
---|
| 873 | strcat(name, ".");
|
---|
| 874 | s++;
|
---|
| 875 | s = ParseString(s, name);
|
---|
| 876 | continue;
|
---|
| 877 | }
|
---|
| 878 | // end of group
|
---|
| 879 | if (*s == '}') {
|
---|
| 880 | if (strlen(name) == 0) {
|
---|
| 881 | cerr << "Error: unpaired } in " << envFilename << " (line "
|
---|
| 882 | << line << ").\n";
|
---|
| 883 | envStream.close();
|
---|
| 884 | return false;
|
---|
| 885 | }
|
---|
| 886 | name[strlen(name) - 1] = '\0';
|
---|
| 887 | t = strrchr(name, '.');
|
---|
| 888 | if (t == NULL)
|
---|
| 889 | name[0] = '\0';
|
---|
| 890 | else
|
---|
| 891 | *(t + 1) = '\0';
|
---|
| 892 | s++;
|
---|
| 893 | s = ParseString(s, name);
|
---|
| 894 | continue;
|
---|
| 895 | }
|
---|
| 896 | // find variable name in the table
|
---|
| 897 | found = false;
|
---|
| 898 | for (i = 0; i < numOptions; i++)
|
---|
| 899 | if (!strcmp(name, options[i].name)) {
|
---|
| 900 | found = true;
|
---|
| 901 | break;
|
---|
| 902 | }
|
---|
| 903 | if (!found) {
|
---|
| 904 | cerr << "Warning: unknown option " << name << " in environment file "
|
---|
| 905 | << envFilename << " (line " << line << ").\n";
|
---|
| 906 | } else
|
---|
| 907 | switch (options[i].type) {
|
---|
| 908 | case optInt: {
|
---|
| 909 | strtol(s, &t, 10);
|
---|
| 910 | if (t == s || (*t != ' ' && *t != '\t' &&
|
---|
| 911 | *t != '\0' && *t != '}')) {
|
---|
| 912 | cerr << "Error: Mismatch in int variable " << name << " in "
|
---|
| 913 | << "environment file " << envFilename << " (line "
|
---|
| 914 | << line << ").\n";
|
---|
| 915 | envStream.close();
|
---|
| 916 | return false;
|
---|
| 917 | }
|
---|
| 918 | if (options[i].value != NULL)
|
---|
| 919 | delete options[i].value;
|
---|
| 920 | options[i].value = new char[t - s + 1];
|
---|
| 921 | strncpy(options[i].value, s, t - s);
|
---|
| 922 | options[i].value[t - s] = '\0';
|
---|
| 923 | s = t;
|
---|
| 924 | break;
|
---|
| 925 | }
|
---|
| 926 | case optFloat: {
|
---|
| 927 | strtod(s, &t);
|
---|
| 928 | if (t == s || (*t != ' ' && *t != '\t' &&
|
---|
| 929 | *t != '\0' && *t != '}')) {
|
---|
| 930 | cerr << "Error: Mismatch in Real variable " << name << " in "
|
---|
| 931 | << "environment file " << envFilename << " (line "
|
---|
| 932 | << line << ").\n";
|
---|
| 933 | envStream.close();
|
---|
| 934 | return false;
|
---|
| 935 | }
|
---|
| 936 | if (options[i].value != NULL)
|
---|
| 937 | delete options[i].value;
|
---|
| 938 | options[i].value = new char[t - s + 1];
|
---|
| 939 | strncpy(options[i].value, s, t - s);
|
---|
| 940 | options[i].value[t - s] = '\0';
|
---|
| 941 | s = t;
|
---|
| 942 | break;
|
---|
| 943 | }
|
---|
| 944 | case optBool: {
|
---|
| 945 | t = s;
|
---|
| 946 | while ((*t >= 'a' && *t <= 'z') ||
|
---|
| 947 | (*t >= 'A' && *t <= 'Z') ||
|
---|
| 948 | *t == '+' || *t == '-')
|
---|
| 949 | t++;
|
---|
| 950 | if (((!strncasecmp(s, "true", t - s) && t - s == 4) ||
|
---|
| 951 | (!strncasecmp(s, "false", t - s) && t - s == 5) ||
|
---|
| 952 | (!strncasecmp(s, "YES", t -s) && t - s == 3) ||
|
---|
| 953 | (!strncasecmp(s, "NO", t - s) && t - s == 2) ||
|
---|
| 954 | (!strncasecmp(s, "ON", t - s) && t - s == 2) ||
|
---|
| 955 | (!strncasecmp(s, "OFF", t - s) && t - s == 3) ||
|
---|
| 956 | (t - s == 1 && (*s == '+' || *s == '-'))) &&
|
---|
| 957 | (*t == ' ' || *t == '\t' || *t == '\0' || *t == '}')) {
|
---|
| 958 | if (options[i].value != NULL)
|
---|
| 959 | delete options[i].value;
|
---|
| 960 | options[i].value = new char[t - s + 1];
|
---|
| 961 | strncpy(options[i].value, s, t - s);
|
---|
| 962 | options[i].value[t - s] = '\0';
|
---|
| 963 | s = t;
|
---|
| 964 | }
|
---|
| 965 | else {
|
---|
| 966 | cerr << "Error: Mismatch in bool variable " << name << " in "
|
---|
| 967 | << "environment file " << envFilename << " (line "
|
---|
| 968 | << line << ").\n";
|
---|
| 969 | envStream.close();
|
---|
| 970 | return false;
|
---|
| 971 | }
|
---|
| 972 | break;
|
---|
| 973 | }
|
---|
| 974 | case optVector:{
|
---|
| 975 | strtod(s, &t);
|
---|
| 976 | if (*t == ' ' || *t == '\t') {
|
---|
| 977 | while (*t == ' ' || *t == '\t')
|
---|
| 978 | t++;
|
---|
| 979 | if (*t != ',')
|
---|
| 980 | t--;
|
---|
| 981 | }
|
---|
| 982 | if (t == s || (*t != ' ' && *t != '\t' && *t != ',')) {
|
---|
| 983 | cerr << "Error: Mismatch in vector variable " << name << " in "
|
---|
| 984 | << "environment file " << envFilename << " (line "
|
---|
| 985 | << line << ").\n";
|
---|
| 986 | envStream.close();
|
---|
| 987 | return false;
|
---|
| 988 | }
|
---|
| 989 | char *u;
|
---|
| 990 | strtod(t, &u);
|
---|
| 991 | t = u;
|
---|
| 992 | if (*t == ' ' || *t == '\t') {
|
---|
| 993 | while (*t == ' ' || *t == '\t')
|
---|
| 994 | t++;
|
---|
| 995 | if (*t != ',')
|
---|
| 996 | t--;
|
---|
| 997 | }
|
---|
| 998 | if (t == s || (*t != ' ' && *t != '\t' && *t != ',')) {
|
---|
| 999 | cerr << "Error: Mismatch in vector variable " << name << " in "
|
---|
| 1000 | << "environment file " << envFilename << " (line "
|
---|
| 1001 | << line << ").\n";
|
---|
| 1002 | envStream.close();
|
---|
| 1003 | return false;
|
---|
| 1004 | }
|
---|
| 1005 | strtod(t, &u);
|
---|
| 1006 | t = u;
|
---|
| 1007 | if (t == s || (*t != ' ' && *t != '\t' &&
|
---|
| 1008 | *t != '\0' && *t != '}')) {
|
---|
| 1009 | cerr << "Error: Mismatch in vector variable " << name << " in "
|
---|
| 1010 | << "environment file " << envFilename << " (line "
|
---|
| 1011 | << line << ").\n";
|
---|
| 1012 | envStream.close();
|
---|
| 1013 | return false;
|
---|
| 1014 | }
|
---|
| 1015 | if (options[i].value != NULL)
|
---|
| 1016 | delete options[i].value;
|
---|
| 1017 | options[i].value = new char[t - s + 1];
|
---|
| 1018 | strncpy(options[i].value, s, t - s);
|
---|
| 1019 | options[i].value[t - s] = '\0';
|
---|
| 1020 | s = t;
|
---|
| 1021 | break;
|
---|
| 1022 | }
|
---|
| 1023 | case optString: {
|
---|
| 1024 | if (options[i].value != NULL)
|
---|
| 1025 | delete options[i].value;
|
---|
| 1026 | options[i].value = new char[strlen(s) + 1];
|
---|
| 1027 | strcpy(options[i].value, s);
|
---|
| 1028 | s += strlen(s);
|
---|
| 1029 | break;
|
---|
| 1030 | }
|
---|
| 1031 | default: {
|
---|
| 1032 | Debug << "Internal error: Unknown type of option.\n" << flush;
|
---|
| 1033 | exit(1);
|
---|
| 1034 | }
|
---|
| 1035 | }
|
---|
| 1036 | // prepare the variable name for next pass
|
---|
| 1037 | t = strrchr(name, '.');
|
---|
| 1038 | if (t == NULL)
|
---|
| 1039 | name[0] = '\0';
|
---|
| 1040 | else
|
---|
| 1041 | *(t + 1) = '\0';
|
---|
| 1042 | // get next identifier
|
---|
| 1043 | s = ParseString(s, name);
|
---|
| 1044 | }
|
---|
| 1045 | }
|
---|
| 1046 | envStream.close();
|
---|
| 1047 | return true;
|
---|
| 1048 | }
|
---|
| 1049 |
|
---|
| 1050 | void
|
---|
| 1051 | Environment::PrintUsage(ostream &s) const
|
---|
| 1052 | {
|
---|
| 1053 | // Print out all environment variable names
|
---|
| 1054 | s << "Registered options:\n";
|
---|
| 1055 | for (int j = 0; j < numOptions; j++)
|
---|
| 1056 | s << options[j] << "\n";
|
---|
| 1057 | s << flush;
|
---|
| 1058 | }
|
---|
| 1059 |
|
---|
[859] | 1060 | /**
|
---|
| 1061 | Input scene filename. Currently simplified X3D (.x3d), Unigraphics (.dat),
|
---|
| 1062 | and UNC (.ply) formats are supported.
|
---|
| 1063 | */
|
---|
[372] | 1064 |
|
---|
| 1065 | Environment::Environment()
|
---|
| 1066 | {
|
---|
| 1067 | optionalParams = NULL;
|
---|
| 1068 | paramRows = 0;
|
---|
| 1069 | numParams = 0;
|
---|
| 1070 | params = NULL;
|
---|
[539] | 1071 | maxOptions = 500;
|
---|
[372] | 1072 |
|
---|
| 1073 |
|
---|
| 1074 | // this is maximal nuber of options.
|
---|
| 1075 | numOptions = 0;
|
---|
| 1076 |
|
---|
| 1077 | options = new COption[maxOptions];
|
---|
| 1078 |
|
---|
| 1079 | if (options == NULL ) {
|
---|
| 1080 | Debug << "Error: Memory allocation failed.\n";
|
---|
| 1081 | exit(1);
|
---|
| 1082 | }
|
---|
| 1083 |
|
---|
| 1084 | // register all basic options
|
---|
| 1085 |
|
---|
| 1086 | RegisterOption("Limits.threshold", optFloat, NULL, "0.01");
|
---|
| 1087 | RegisterOption("Limits.small", optFloat, NULL, "1e-6");
|
---|
| 1088 | RegisterOption("Limits.infinity", optFloat, NULL, "1e6");
|
---|
| 1089 |
|
---|
| 1090 | RegisterOption("Scene.filename",
|
---|
[492] | 1091 | optString,
|
---|
| 1092 | "scene_filename=",
|
---|
| 1093 | "atlanta2.x3d");
|
---|
[372] | 1094 |
|
---|
| 1095 | RegisterOption("Unigraphics.meshGrouping",
|
---|
[492] | 1096 | optInt,
|
---|
| 1097 | "unigraphics_mesh_grouping=",
|
---|
| 1098 | "0");
|
---|
[372] | 1099 |
|
---|
[1221] | 1100 | RegisterOption("ObjParser.meshGrouping",
|
---|
| 1101 | optInt,
|
---|
| 1102 | "objparser_mesh_grouping=",
|
---|
| 1103 | "0");
|
---|
[372] | 1104 |
|
---|
| 1105 | RegisterOption("KdTree.Termination.minCost",
|
---|
[492] | 1106 | optInt,
|
---|
| 1107 | "kd_term_min_cost=",
|
---|
| 1108 | "10");
|
---|
[859] | 1109 |
|
---|
[752] | 1110 | RegisterOption("KdTree.Termination.maxNodes",
|
---|
| 1111 | optInt,
|
---|
| 1112 | "kd_term_max_nodes=",
|
---|
| 1113 | "200000");
|
---|
[859] | 1114 |
|
---|
[372] | 1115 | RegisterOption("KdTree.Termination.maxDepth",
|
---|
[492] | 1116 | optInt,
|
---|
| 1117 | "kd_term_max_depth=",
|
---|
| 1118 | "20");
|
---|
[372] | 1119 |
|
---|
| 1120 | RegisterOption("KdTree.Termination.maxCostRatio",
|
---|
[492] | 1121 | optFloat,
|
---|
| 1122 | "kd_term_max_cost_ratio=",
|
---|
| 1123 | "1.5");
|
---|
[372] | 1124 |
|
---|
| 1125 | RegisterOption("KdTree.Termination.ct_div_ci",
|
---|
[492] | 1126 | optFloat,
|
---|
| 1127 | "kd_term_ct_div_ci=",
|
---|
| 1128 | "1.0");
|
---|
[372] | 1129 |
|
---|
| 1130 | RegisterOption("KdTree.splitMethod",
|
---|
[492] | 1131 | optString,
|
---|
| 1132 | "kd_split_method=",
|
---|
| 1133 | "spatialMedian");
|
---|
[372] | 1134 |
|
---|
| 1135 | RegisterOption("KdTree.splitBorder",
|
---|
| 1136 | optFloat,
|
---|
[492] | 1137 | "kd_split_border=",
|
---|
[372] | 1138 | "0.1");
|
---|
| 1139 |
|
---|
| 1140 | RegisterOption("KdTree.sahUseFaces",
|
---|
| 1141 | optBool,
|
---|
[492] | 1142 | "kd_sah_use_faces=",
|
---|
[372] | 1143 | "true");
|
---|
| 1144 |
|
---|
| 1145 |
|
---|
| 1146 | RegisterOption("MeshKdTree.Termination.minCost",
|
---|
| 1147 | optInt,
|
---|
[492] | 1148 | "kd_term_min_cost=",
|
---|
[372] | 1149 | "10");
|
---|
| 1150 |
|
---|
| 1151 | RegisterOption("MeshKdTree.Termination.maxDepth",
|
---|
| 1152 | optInt,
|
---|
[492] | 1153 | "kd_term_max_depth=",
|
---|
[372] | 1154 | "20");
|
---|
| 1155 |
|
---|
| 1156 | RegisterOption("MeshKdTree.Termination.maxCostRatio",
|
---|
| 1157 | optFloat,
|
---|
[492] | 1158 | "kd_term_max_cost_ratio=",
|
---|
[372] | 1159 | "1.5");
|
---|
| 1160 |
|
---|
| 1161 | RegisterOption("MeshKdTree.Termination.ct_div_ci",
|
---|
| 1162 | optFloat,
|
---|
[492] | 1163 | "kd_term_ct_div_ci=",
|
---|
[372] | 1164 | "1.0");
|
---|
| 1165 |
|
---|
| 1166 | RegisterOption("MeshKdTree.splitMethod",
|
---|
| 1167 | optString,
|
---|
[492] | 1168 | "kd_split_method=",
|
---|
[372] | 1169 | "spatialMedian");
|
---|
| 1170 |
|
---|
| 1171 | RegisterOption("MeshKdTree.splitBorder",
|
---|
| 1172 | optFloat,
|
---|
[492] | 1173 | "kd_split_border=",
|
---|
[372] | 1174 | "0.1");
|
---|
| 1175 |
|
---|
[508] | 1176 | RegisterOption("SamplingPreprocessor.totalSamples",
|
---|
[372] | 1177 | optInt,
|
---|
[492] | 1178 | "total_samples=",
|
---|
[372] | 1179 | "1000000");
|
---|
| 1180 |
|
---|
[508] | 1181 | RegisterOption("SamplingPreprocessor.samplesPerPass",
|
---|
[372] | 1182 | optInt,
|
---|
[492] | 1183 | "samples_per_pass=",
|
---|
[372] | 1184 | "10");
|
---|
| 1185 |
|
---|
[811] | 1186 | RegisterOption("RenderSampler.samples",
|
---|
| 1187 | optInt,
|
---|
| 1188 | "render_sampler_samples=",
|
---|
| 1189 | "1000");
|
---|
| 1190 |
|
---|
[1001] | 1191 | RegisterOption("RenderSampler.visibleThreshold",
|
---|
| 1192 | optInt,
|
---|
| 1193 | "render_sampler_visible_threshold=",
|
---|
| 1194 | "0");
|
---|
| 1195 |
|
---|
| 1196 |
|
---|
[997] | 1197 | RegisterOption("RenderSampler.useOcclusionQueries",
|
---|
| 1198 | optBool,
|
---|
| 1199 | "render_sampler_use_occlusion_queries=",
|
---|
| 1200 | "true");
|
---|
| 1201 |
|
---|
| 1202 | RegisterOption("VssPreprocessor.initialSamples",
|
---|
[492] | 1203 | optInt,
|
---|
| 1204 | "initial_samples=",
|
---|
| 1205 | "100000");
|
---|
| 1206 |
|
---|
[1001] | 1207 | RegisterOption("VssPreprocessor.testBeamSampling",
|
---|
| 1208 | optBool,
|
---|
| 1209 | "beam_sampling",
|
---|
| 1210 | "false");
|
---|
[532] | 1211 |
|
---|
[469] | 1212 | RegisterOption("VssPreprocessor.vssSamples",
|
---|
[492] | 1213 | optInt,
|
---|
| 1214 | "vss_samples=",
|
---|
| 1215 | "1000000");
|
---|
[376] | 1216 |
|
---|
[427] | 1217 | RegisterOption("VssPreprocessor.vssSamplesPerPass",
|
---|
[492] | 1218 | optInt,
|
---|
| 1219 | "vss_samples_per_pass=",
|
---|
| 1220 | "1000");
|
---|
| 1221 |
|
---|
[469] | 1222 | RegisterOption("VssPreprocessor.samplesPerPass",
|
---|
[492] | 1223 | optInt,
|
---|
| 1224 | "samples_per_pass=",
|
---|
| 1225 | "100000");
|
---|
[376] | 1226 |
|
---|
[403] | 1227 | RegisterOption("VssPreprocessor.useImportanceSampling",
|
---|
[492] | 1228 | optBool,
|
---|
| 1229 | "vss_use_importance=",
|
---|
| 1230 | "true");
|
---|
[403] | 1231 |
|
---|
[674] | 1232 | RegisterOption("VssPreprocessor.enlargeViewSpace",
|
---|
| 1233 | optBool,
|
---|
| 1234 | "vss_enlarge_viewspace=",
|
---|
[675] | 1235 | "false");
|
---|
[674] | 1236 |
|
---|
[490] | 1237 | RegisterOption("VssPreprocessor.loadInitialSamples",
|
---|
| 1238 | optBool,
|
---|
[674] | 1239 | "vss_load_loadInitialSamples=",
|
---|
[490] | 1240 | "false");
|
---|
[445] | 1241 |
|
---|
[490] | 1242 | RegisterOption("VssPreprocessor.storeInitialSamples",
|
---|
| 1243 | optBool,
|
---|
[674] | 1244 | "vss_store_storedInitialSamples=",
|
---|
[490] | 1245 | "false");
|
---|
| 1246 |
|
---|
| 1247 |
|
---|
[501] | 1248 | RegisterOption("VssPreprocessor.useViewSpaceBox",
|
---|
| 1249 | optBool,
|
---|
[674] | 1250 | "vss_use_viewspace_box=",
|
---|
[508] | 1251 | "false");
|
---|
[501] | 1252 |
|
---|
| 1253 |
|
---|
[445] | 1254 | /************************************************************************************/
|
---|
| 1255 | /* View cells related options */
|
---|
| 1256 | /************************************************************************************/
|
---|
| 1257 |
|
---|
| 1258 |
|
---|
[508] | 1259 | RegisterOption("ViewCells.type",
|
---|
| 1260 | optString,
|
---|
[664] | 1261 | "view_cells_type=",
|
---|
[662] | 1262 | "vspBspTree");
|
---|
[372] | 1263 |
|
---|
[662] | 1264 | RegisterOption("ViewCells.samplingType",
|
---|
| 1265 | optString,
|
---|
[664] | 1266 | "view_cells_sampling_type=",
|
---|
[662] | 1267 | "box");
|
---|
| 1268 |
|
---|
[666] | 1269 | RegisterOption("ViewCells.mergeStats",
|
---|
[660] | 1270 | optString,
|
---|
[666] | 1271 | "view_cells_merge_stats=",
|
---|
| 1272 | "mergeStats.log");
|
---|
[660] | 1273 |
|
---|
[664] | 1274 | RegisterOption("ViewCells.Evaluation.statsPrefix",
|
---|
[660] | 1275 | optString,
|
---|
[664] | 1276 | "view_cells_evaluation_stats_prefix=",
|
---|
[660] | 1277 | "viewCells");
|
---|
[735] | 1278 | RegisterOption("ViewCells.Evaluation.histogram",
|
---|
| 1279 | optBool,
|
---|
| 1280 | "view_cells_evaluation_histogram=",
|
---|
| 1281 | "false");
|
---|
| 1282 |
|
---|
[997] | 1283 | RegisterOption("ViewCells.Evaluation.histoStepSize",
|
---|
[735] | 1284 | optInt,
|
---|
[997] | 1285 | "view_cells_evaluation_histo_step_size=",
|
---|
[744] | 1286 | "5000");
|
---|
[735] | 1287 |
|
---|
[728] | 1288 | RegisterOption("ViewCells.renderCostEvaluationType",
|
---|
| 1289 | optString,
|
---|
| 1290 | "view_cells_render_cost_evaluation=",
|
---|
| 1291 | "perobject");
|
---|
| 1292 |
|
---|
[660] | 1293 | RegisterOption("ViewCells.active",
|
---|
| 1294 | optInt,
|
---|
[664] | 1295 | "view_cells_active=",
|
---|
[660] | 1296 | "1000");
|
---|
[581] | 1297 |
|
---|
[574] | 1298 | RegisterOption("ViewCells.Construction.samples",
|
---|
| 1299 | optInt,
|
---|
| 1300 | "view_cells_construction_samples=",
|
---|
[1134] | 1301 | "0");
|
---|
[574] | 1302 |
|
---|
| 1303 | RegisterOption("ViewCells.Construction.samplesPerPass",
|
---|
| 1304 | optInt,
|
---|
| 1305 | "view_cells_construction_samples_per_pass=",
|
---|
| 1306 | "500000");
|
---|
| 1307 |
|
---|
[508] | 1308 | RegisterOption("ViewCells.PostProcess.samples",
|
---|
| 1309 | optInt,
|
---|
[712] | 1310 | "view_cells_post_process_samples=",
|
---|
[1134] | 1311 | "0");
|
---|
[421] | 1312 |
|
---|
[508] | 1313 | RegisterOption("ViewCells.Visualization.samples",
|
---|
| 1314 | optInt,
|
---|
| 1315 | "view_cells_visualization_samples=",
|
---|
[1134] | 1316 | "0");
|
---|
[372] | 1317 |
|
---|
[1020] | 1318 | RegisterOption("ViewCells.Visualization.maxOutput",
|
---|
| 1319 | optInt,
|
---|
| 1320 | "view_cells_visualization_max_output=",
|
---|
| 1321 | "20");
|
---|
| 1322 |
|
---|
[697] | 1323 | RegisterOption("ViewCells.Filter.maxSize",
|
---|
| 1324 | optInt,
|
---|
| 1325 | "view_cells_filter_max_size=",
|
---|
| 1326 | "4");
|
---|
| 1327 |
|
---|
| 1328 | RegisterOption("ViewCells.Filter.width",
|
---|
| 1329 | optFloat,
|
---|
| 1330 | "view_cells_filter_width=",
|
---|
[746] | 1331 | "200.0");
|
---|
[697] | 1332 |
|
---|
[508] | 1333 | RegisterOption("ViewCells.loadFromFile",
|
---|
| 1334 | optBool,
|
---|
[664] | 1335 | "view_cells_load_from_file=",
|
---|
[508] | 1336 | "false");
|
---|
[485] | 1337 |
|
---|
[586] | 1338 | RegisterOption("ViewCells.PostProcess.refine",
|
---|
| 1339 | optBool,
|
---|
[664] | 1340 | "view_cells_refine=",
|
---|
[586] | 1341 | "false");
|
---|
| 1342 |
|
---|
| 1343 | RegisterOption("ViewCells.PostProcess.compress",
|
---|
| 1344 | optBool,
|
---|
[664] | 1345 | "view_cells_post_process_compress=",
|
---|
[586] | 1346 | "false");
|
---|
| 1347 |
|
---|
[662] | 1348 | RegisterOption("ViewCells.Evaluation.samples",
|
---|
| 1349 | optInt,
|
---|
| 1350 | "view_cells_evaluation_samples=",
|
---|
| 1351 | "8000000");
|
---|
| 1352 |
|
---|
[722] | 1353 | RegisterOption("ViewCells.Evaluation.samplingType",
|
---|
[837] | 1354 | optString,
|
---|
| 1355 | "view_cells_evaluation_sampling_type=",
|
---|
| 1356 | "box");
|
---|
[722] | 1357 |
|
---|
[662] | 1358 | RegisterOption("ViewCells.Evaluation.samplesPerPass",
|
---|
| 1359 | optInt,
|
---|
| 1360 | "view_cells_evaluation_samples_per_pass=",
|
---|
| 1361 | "300000");
|
---|
| 1362 |
|
---|
[508] | 1363 | RegisterOption("ViewCells.exportToFile",
|
---|
| 1364 | optBool,
|
---|
[676] | 1365 | "view_cells_export_to_file=",
|
---|
[508] | 1366 | "false");
|
---|
| 1367 |
|
---|
[844] | 1368 | RegisterOption("ViewCells.exportPvs",
|
---|
| 1369 | optBool,
|
---|
| 1370 | "view_cells_export_pvs=",
|
---|
| 1371 | "false");
|
---|
| 1372 |
|
---|
[840] | 1373 | RegisterOption("ViewCells.exportBboxesForPvs",
|
---|
| 1374 | optBool,
|
---|
[844] | 1375 | "view_cells_export_bounding_boxes=",
|
---|
[840] | 1376 | "true");
|
---|
| 1377 |
|
---|
| 1378 | RegisterOption("ViewCells.boxesFilename",
|
---|
| 1379 | optString,
|
---|
| 1380 | "view_cells_boxes_filename=",
|
---|
| 1381 | "boxes.out");
|
---|
| 1382 |
|
---|
[664] | 1383 | RegisterOption("ViewCells.evaluateViewCells",
|
---|
| 1384 | optBool,
|
---|
[670] | 1385 | "view_cells_evaluate=",
|
---|
[664] | 1386 | "false");
|
---|
| 1387 |
|
---|
[508] | 1388 | RegisterOption("ViewCells.maxViewCells",
|
---|
[667] | 1389 | optInt,
|
---|
| 1390 | "view_cells_max_view_cells=",
|
---|
| 1391 | "0");
|
---|
[508] | 1392 |
|
---|
[511] | 1393 | RegisterOption("ViewCells.maxPvsRatio",
|
---|
| 1394 | optFloat,
|
---|
| 1395 | "view_cells_max_pvs_ratio=",
|
---|
| 1396 | "0.1");
|
---|
[508] | 1397 |
|
---|
| 1398 | RegisterOption("ViewCells.filename",
|
---|
[667] | 1399 | optString,
|
---|
| 1400 | "view_cells_filename=",
|
---|
| 1401 | "atlanta_viewcells_large.x3d");
|
---|
[508] | 1402 |
|
---|
| 1403 | RegisterOption("ViewCells.height",
|
---|
[667] | 1404 | optFloat,
|
---|
| 1405 | "view_cells_height=",
|
---|
| 1406 | "5.0");
|
---|
[508] | 1407 |
|
---|
| 1408 | RegisterOption("ViewCells.Visualization.colorCode",
|
---|
[667] | 1409 | optString,
|
---|
[708] | 1410 | "view_cells_visualization_color_code=",
|
---|
[667] | 1411 | "PVS");
|
---|
[482] | 1412 |
|
---|
[667] | 1413 | RegisterOption("ViewCells.Visualization.clipPlanePos",
|
---|
| 1414 | optFloat,
|
---|
[708] | 1415 | "view_cells_visualization_clip_plane_pos=",
|
---|
[667] | 1416 | "0.35");
|
---|
[579] | 1417 |
|
---|
[508] | 1418 | RegisterOption("ViewCells.Visualization.exportGeometry",
|
---|
[667] | 1419 | optBool,
|
---|
[708] | 1420 | "view_cells_visualization_export_geometry=",
|
---|
[667] | 1421 | "false");
|
---|
[445] | 1422 |
|
---|
[667] | 1423 | RegisterOption("ViewCells.Visualization.exportRays",
|
---|
| 1424 | optBool,
|
---|
[708] | 1425 | "view_cells_visualization_export_rays=",
|
---|
[667] | 1426 | "false");
|
---|
| 1427 |
|
---|
[564] | 1428 | RegisterOption("ViewCells.pruneEmptyViewCells",
|
---|
[667] | 1429 | optBool,
|
---|
[708] | 1430 | "view_cells_prune_empty=",
|
---|
[667] | 1431 | "false");
|
---|
[445] | 1432 |
|
---|
[564] | 1433 | RegisterOption("ViewCells.processOnlyValidViewCells",
|
---|
[667] | 1434 | optBool,
|
---|
[708] | 1435 | "view_cells_process_only_valid_view_cells=",
|
---|
[667] | 1436 | "false");
|
---|
[660] | 1437 |
|
---|
[564] | 1438 |
|
---|
[580] | 1439 | RegisterOption("ViewCells.PostProcess.maxCostRatio",
|
---|
| 1440 | optFloat,
|
---|
[667] | 1441 | "view_cells_post_process_max_cost_ratio=",
|
---|
[580] | 1442 | "0.9");
|
---|
| 1443 |
|
---|
| 1444 | RegisterOption("ViewCells.PostProcess.renderCostWeight",
|
---|
| 1445 | optFloat,
|
---|
[667] | 1446 | "view_cells_post_process_render_cost_weight",
|
---|
[580] | 1447 | "0.5");
|
---|
| 1448 |
|
---|
| 1449 | RegisterOption("ViewCells.PostProcess.avgCostMaxDeviation",
|
---|
| 1450 | optFloat,
|
---|
[1143] | 1451 | "view_cells_avgcost_max_deviations",
|
---|
[580] | 1452 | "0.5");
|
---|
| 1453 |
|
---|
| 1454 | RegisterOption("ViewCells.PostProcess.maxMergesPerPass",
|
---|
| 1455 | optInt,
|
---|
[667] | 1456 | "view_cells_post_process_max_merges_per_pass=",
|
---|
[580] | 1457 | "500");
|
---|
| 1458 |
|
---|
| 1459 | RegisterOption("ViewCells.PostProcess.minViewCells",
|
---|
| 1460 | optInt,
|
---|
[667] | 1461 | "view_cells_post_process_min_view_cells=",
|
---|
[580] | 1462 | "1000");
|
---|
| 1463 |
|
---|
| 1464 | RegisterOption("ViewCells.PostProcess.useRaysForMerge",
|
---|
| 1465 | optBool,
|
---|
| 1466 | "view_cells_post_process_use_rays_for_merge=",
|
---|
| 1467 | "false");
|
---|
[591] | 1468 |
|
---|
| 1469 | RegisterOption("ViewCells.PostProcess.merge",
|
---|
| 1470 | optBool,
|
---|
[666] | 1471 | "view_cells_post_process_merge=",
|
---|
[591] | 1472 | "true");
|
---|
[580] | 1473 |
|
---|
| 1474 | RegisterOption("ViewCells.Visualization.exportMergedViewCells",
|
---|
| 1475 | optBool,
|
---|
| 1476 | "view_cells_viz_export_merged_viewcells=",
|
---|
| 1477 | "false");
|
---|
| 1478 |
|
---|
[582] | 1479 | RegisterOption("ViewCells.maxStaticMemory",
|
---|
| 1480 | optFloat,
|
---|
| 1481 | "view_cells_max_static_mem=",
|
---|
| 1482 | "8.0");
|
---|
[580] | 1483 |
|
---|
[660] | 1484 | RegisterOption("ViewCells.Visualization.useClipPlane",
|
---|
[591] | 1485 | optBool,
|
---|
[660] | 1486 | "view_cells_viz_use_clip_plane=",
|
---|
[591] | 1487 | "false");
|
---|
| 1488 |
|
---|
[666] | 1489 | RegisterOption("ViewCells.showVisualization",
|
---|
| 1490 | optBool,
|
---|
| 1491 | "view_cells_show_visualization=",
|
---|
| 1492 | "false");
|
---|
| 1493 |
|
---|
[660] | 1494 | RegisterOption("ViewCells.Visualization.clipPlaneAxis",
|
---|
[591] | 1495 | optInt,
|
---|
[660] | 1496 | "view_cells_viz_clip_plane_axis=",
|
---|
[591] | 1497 | "0");
|
---|
| 1498 |
|
---|
[1159] | 1499 |
|
---|
[508] | 1500 | /************************************************************************************/
|
---|
| 1501 | /* Render simulation related options */
|
---|
| 1502 | /************************************************************************************/
|
---|
[372] | 1503 |
|
---|
[406] | 1504 |
|
---|
[508] | 1505 | RegisterOption("Simulation.objRenderCost",
|
---|
| 1506 | optFloat,
|
---|
| 1507 | "simulation_obj_render_cost",
|
---|
| 1508 | "1.0");
|
---|
[409] | 1509 |
|
---|
[508] | 1510 | RegisterOption("Simulation.vcOverhead",
|
---|
| 1511 | optFloat,
|
---|
| 1512 | "simulation_vc_overhead",
|
---|
| 1513 | "0.05");
|
---|
[445] | 1514 |
|
---|
[508] | 1515 | RegisterOption("Simulation.moveSpeed",
|
---|
| 1516 | optFloat,
|
---|
| 1517 | "simulation_moveSpeed",
|
---|
| 1518 | "1.0");
|
---|
[445] | 1519 |
|
---|
| 1520 |
|
---|
| 1521 |
|
---|
| 1522 |
|
---|
[508] | 1523 | /************************************************************************************/
|
---|
| 1524 | /* Bsp tree related options */
|
---|
| 1525 | /************************************************************************************/
|
---|
[372] | 1526 |
|
---|
| 1527 |
|
---|
[508] | 1528 | RegisterOption("BspTree.Construction.input",
|
---|
| 1529 | optString,
|
---|
| 1530 | "bsp_construction_input=",
|
---|
| 1531 | "fromViewCells");
|
---|
[372] | 1532 |
|
---|
[660] | 1533 | RegisterOption("BspTree.subdivisionStats",
|
---|
| 1534 | optString,
|
---|
[666] | 1535 | "bsp_subdivision_stats=",
|
---|
[660] | 1536 | "bspSubdivisionStats.log");
|
---|
| 1537 |
|
---|
[508] | 1538 | RegisterOption("BspTree.Construction.samples",
|
---|
| 1539 | optInt,
|
---|
| 1540 | "bsp_construction_samples=",
|
---|
| 1541 | "100000");
|
---|
[390] | 1542 |
|
---|
[508] | 1543 | RegisterOption("BspTree.Construction.epsilon",
|
---|
| 1544 | optFloat,
|
---|
[1023] | 1545 | "bsp_construction_epsilon=",
|
---|
[508] | 1546 | "0.002");
|
---|
[397] | 1547 |
|
---|
[508] | 1548 | RegisterOption("BspTree.Termination.minPolygons",
|
---|
| 1549 | optInt,
|
---|
| 1550 | "bsp_term_min_polygons=",
|
---|
| 1551 | "5");
|
---|
[409] | 1552 |
|
---|
[508] | 1553 | RegisterOption("BspTree.Termination.minPvs",
|
---|
| 1554 | optInt,
|
---|
| 1555 | "bsp_term_min_pvs=",
|
---|
| 1556 | "20");
|
---|
[372] | 1557 |
|
---|
[587] | 1558 | RegisterOption("BspTree.Termination.minProbability",
|
---|
[508] | 1559 | optFloat,
|
---|
[587] | 1560 | "bsp_term_min_probability=",
|
---|
[508] | 1561 | "0.001");
|
---|
[424] | 1562 |
|
---|
[508] | 1563 | RegisterOption("BspTree.Termination.maxRayContribution",
|
---|
| 1564 | optFloat,
|
---|
| 1565 | "bsp_term_ray_contribution=",
|
---|
| 1566 | "0.005");
|
---|
[372] | 1567 |
|
---|
[508] | 1568 | RegisterOption("BspTree.Termination.minAccRayLenght",
|
---|
| 1569 | optFloat,
|
---|
| 1570 | "bsp_term_min_acc_ray_length=",
|
---|
| 1571 | "50");
|
---|
[372] | 1572 |
|
---|
[508] | 1573 | RegisterOption("BspTree.Termination.minRays",
|
---|
| 1574 | optInt,
|
---|
| 1575 | "bsp_term_min_rays=",
|
---|
| 1576 | "-1");
|
---|
[372] | 1577 |
|
---|
[508] | 1578 | RegisterOption("BspTree.Termination.ct_div_ci",
|
---|
| 1579 | optFloat,
|
---|
| 1580 | "bsp_term_ct_div_ci=",
|
---|
| 1581 | "0.0");
|
---|
[372] | 1582 |
|
---|
[508] | 1583 | RegisterOption("BspTree.Termination.maxDepth",
|
---|
| 1584 | optInt,
|
---|
| 1585 | "bsp_term_max_depth=",
|
---|
| 1586 | "100");
|
---|
[372] | 1587 |
|
---|
[508] | 1588 | RegisterOption("BspTree.Termination.maxCostRatio",
|
---|
| 1589 | optFloat,
|
---|
| 1590 | "bsp_term_axis_aligned_max_cost_ratio=",
|
---|
| 1591 | "1.5");
|
---|
[372] | 1592 |
|
---|
[508] | 1593 | RegisterOption("BspTree.Termination.AxisAligned.ct_div_ci",
|
---|
| 1594 | optFloat,
|
---|
| 1595 | "bsp_term_axis_aligned_ct_div_ci=",
|
---|
| 1596 | "0.5");
|
---|
[372] | 1597 |
|
---|
[508] | 1598 | RegisterOption("BspTree.AxisAligned.splitBorder",
|
---|
| 1599 | optFloat,
|
---|
| 1600 | "bsp__axis_aligned_split_border=",
|
---|
| 1601 | "0.1");
|
---|
[372] | 1602 |
|
---|
[508] | 1603 | RegisterOption("BspTree.Termination.AxisAligned.minPolys",
|
---|
| 1604 | optInt,
|
---|
| 1605 | "bsp_term_axis_aligned_max_polygons=",
|
---|
| 1606 | "50");
|
---|
[379] | 1607 |
|
---|
[508] | 1608 | RegisterOption("BspTree.Termination.AxisAligned.minObjects",
|
---|
| 1609 | optInt,
|
---|
| 1610 | "bsp_term_min_objects=",
|
---|
| 1611 | "3");
|
---|
[441] | 1612 |
|
---|
[508] | 1613 | RegisterOption("BspTree.Termination.AxisAligned.minRays",
|
---|
| 1614 | optInt,
|
---|
| 1615 | "bsp_term_axis_aligned_min_rays=",
|
---|
| 1616 | "-1");
|
---|
[374] | 1617 |
|
---|
[508] | 1618 | RegisterOption("BspTree.splitPlaneStrategy",
|
---|
| 1619 | optString,
|
---|
| 1620 | "bsp_split_method=",
|
---|
| 1621 | "leastSplits");
|
---|
[424] | 1622 |
|
---|
[508] | 1623 | RegisterOption("BspTree.maxPolyCandidates",
|
---|
| 1624 | optInt,
|
---|
| 1625 | "bsp_max_poly_candidates=",
|
---|
| 1626 | "20");
|
---|
[469] | 1627 |
|
---|
[508] | 1628 | RegisterOption("BspTree.maxRayCandidates",
|
---|
| 1629 | optInt,
|
---|
| 1630 | "bsp_max_plane_candidates=",
|
---|
| 1631 | "20");
|
---|
[382] | 1632 |
|
---|
[508] | 1633 | RegisterOption("BspTree.maxTests",
|
---|
| 1634 | optInt,
|
---|
| 1635 | "bsp_max_tests=",
|
---|
| 1636 | "5000");
|
---|
[382] | 1637 |
|
---|
[587] | 1638 | RegisterOption("BspTree.Termination.maxViewCells",
|
---|
| 1639 | optInt,
|
---|
| 1640 | "bsp_max_view_cells=",
|
---|
| 1641 | "5000");
|
---|
| 1642 |
|
---|
[508] | 1643 | RegisterOption("BspTree.Visualization.exportSplits",
|
---|
| 1644 | optBool,
|
---|
| 1645 | "bsp_visualization.export_splits",
|
---|
| 1646 | "false");
|
---|
[445] | 1647 |
|
---|
[508] | 1648 | RegisterOption("BspTree.Factor.verticalSplits", optFloat, "bsp_factor_vertical=", "1.0");
|
---|
| 1649 | RegisterOption("BspTree.Factor.largestPolyArea", optFloat, "bsp_factor_largest_poly=", "1.0");
|
---|
| 1650 | RegisterOption("BspTree.Factor.blockedRays", optFloat, "bsp_factor_blocked=", "1.0");
|
---|
| 1651 | RegisterOption("BspTree.Factor.leastSplits", optFloat, "bsp_factor_least_splits=", "1.0");
|
---|
| 1652 | RegisterOption("BspTree.Factor.balancedPolys", optFloat, "bsp_factor_balanced_polys=", "1.0");
|
---|
| 1653 | RegisterOption("BspTree.Factor.balancedViewCells", optFloat, "bsp_factor_balanced_view_cells=", "1.0");
|
---|
| 1654 | RegisterOption("BspTree.Factor.leastRaySplits", optFloat, "bsp_factor_least_ray_splits=", "1.0");
|
---|
| 1655 | RegisterOption("BspTree.Factor.balancedRays", optFloat, "bsp_factor_balanced_rays=", "1.0");
|
---|
| 1656 | RegisterOption("BspTree.Factor.pvs", optFloat, "bsp_factor_pvs=", "1.0");
|
---|
[408] | 1657 |
|
---|
[508] | 1658 | /************************************************************************************/
|
---|
| 1659 | /* Preprocessor related options */
|
---|
| 1660 | /************************************************************************************/
|
---|
[408] | 1661 |
|
---|
[508] | 1662 | RegisterOption("Preprocessor.type",
|
---|
| 1663 | optString,
|
---|
| 1664 | "preprocessor=",
|
---|
| 1665 | "sampling");
|
---|
[408] | 1666 |
|
---|
[508] | 1667 | RegisterOption("Preprocessor.samplesFilename",
|
---|
| 1668 | optString,
|
---|
[676] | 1669 | "preprocessor_samples_filename=",
|
---|
[508] | 1670 | "rays.out");
|
---|
[408] | 1671 |
|
---|
[1379] | 1672 | RegisterOption("Preprocessor.loadMeshes",
|
---|
[658] | 1673 | optBool,
|
---|
[1379] | 1674 | "loadMeshes=",
|
---|
| 1675 | "true");
|
---|
[658] | 1676 |
|
---|
[563] | 1677 | RegisterOption("Preprocessor.pvsRenderErrorSamples",
|
---|
| 1678 | optInt,
|
---|
| 1679 | "pvsRenderErrorSamples=",
|
---|
| 1680 | "10000");
|
---|
[682] | 1681 |
|
---|
| 1682 | RegisterOption("Preprocessor.useGlRenderer",
|
---|
| 1683 | optBool,
|
---|
| 1684 | "preprocessor_use_gl_renderer=",
|
---|
| 1685 | "false");
|
---|
| 1686 |
|
---|
[538] | 1687 | RegisterOption("Preprocessor.useGlDebugger",
|
---|
| 1688 | optBool,
|
---|
[682] | 1689 | "preprocessor_use_gl_debugger=",
|
---|
[538] | 1690 | "false");
|
---|
| 1691 |
|
---|
[534] | 1692 | RegisterOption("Preprocessor.detectEmptyViewSpace",
|
---|
| 1693 | optBool,
|
---|
[682] | 1694 | "preprocessor_detect_empty_viewspace=",
|
---|
[534] | 1695 | "false");
|
---|
| 1696 |
|
---|
[599] | 1697 | RegisterOption("Preprocessor.quitOnFinish",
|
---|
| 1698 | optBool,
|
---|
[1112] | 1699 | "preprocessor_quit_on_finish",
|
---|
[599] | 1700 | "true");
|
---|
[534] | 1701 |
|
---|
[685] | 1702 | RegisterOption("Preprocessor.computeVisibility",
|
---|
| 1703 | optBool,
|
---|
| 1704 | "preprocessor_compute_visibility=",
|
---|
| 1705 | "true");
|
---|
[682] | 1706 |
|
---|
[871] | 1707 | RegisterOption("Preprocessor.exportVisibility",
|
---|
| 1708 | optBool,
|
---|
[997] | 1709 | "preprocessor_export_visibility=",
|
---|
[871] | 1710 | "true");
|
---|
[682] | 1711 |
|
---|
[871] | 1712 | RegisterOption("Preprocessor.visibilityFile",
|
---|
| 1713 | optString,
|
---|
| 1714 | "preprocessor_visibility_file=",
|
---|
| 1715 | "visibility.xml");
|
---|
| 1716 |
|
---|
| 1717 | RegisterOption("Preprocessor.applyVisibilityFilter",
|
---|
| 1718 | optBool,
|
---|
[997] | 1719 | "preprocessor_apply_filter=",
|
---|
[871] | 1720 | "true");
|
---|
[904] | 1721 |
|
---|
| 1722 | RegisterOption("Preprocessor.applyVisibilitySpatialFilter",
|
---|
| 1723 | optBool,
|
---|
[997] | 1724 | "preprocessor_apply_spatial_filter=",
|
---|
[904] | 1725 | "true");
|
---|
[871] | 1726 |
|
---|
[878] | 1727 | RegisterOption("Preprocessor.visibilityFilterWidth",
|
---|
| 1728 | optFloat,
|
---|
| 1729 | "preprocessor_visibility_filter_width=",
|
---|
| 1730 | "0.02");
|
---|
[871] | 1731 |
|
---|
[991] | 1732 | RegisterOption("Preprocessor.histogram.maxValue",
|
---|
| 1733 | optInt,
|
---|
| 1734 | "preprocessor_histogram_max_value=",
|
---|
| 1735 | "1000");
|
---|
[871] | 1736 |
|
---|
[1221] | 1737 | RegisterOption("Preprocessor.rayCastMethod",
|
---|
| 1738 | optInt,
|
---|
| 1739 | "preprocessor_ray_cast_method=",
|
---|
| 1740 | "0");
|
---|
| 1741 |
|
---|
[991] | 1742 | RegisterOption("Preprocessor.histogram.intervals",
|
---|
| 1743 | optInt,
|
---|
| 1744 | "preprocessor_histogram_intervals=",
|
---|
| 1745 | "20");
|
---|
[878] | 1746 |
|
---|
[991] | 1747 |
|
---|
[469] | 1748 | /************************************************************************************/
|
---|
| 1749 | /* VSS Preprocessor cells related options */
|
---|
| 1750 | /************************************************************************************/
|
---|
[382] | 1751 |
|
---|
[469] | 1752 | RegisterOption("VssTree.maxDepth", optInt, "kd_depth=", "12");
|
---|
| 1753 | RegisterOption("VssTree.minPvs", optInt, "kd_minpvs=", "1");
|
---|
| 1754 | RegisterOption("VssTree.minRays", optInt, "kd_minrays=", "10");
|
---|
| 1755 | RegisterOption("VssTree.maxCostRatio", optFloat, "maxcost=", "0.95");
|
---|
| 1756 | RegisterOption("VssTree.maxRayContribution", optFloat, "maxraycontrib=", "0.5");
|
---|
[382] | 1757 |
|
---|
[469] | 1758 | RegisterOption("VssTree.epsilon", optFloat, "kd_eps=", "1e-6");
|
---|
| 1759 | RegisterOption("VssTree.ct_div_ci", optFloat, "kd_ctdivci=", "1.0");
|
---|
| 1760 | RegisterOption("VssTree.randomize", optBool, "randomize", "false");
|
---|
| 1761 | RegisterOption("VssTree.splitType", optString, "split=", "queries");
|
---|
| 1762 | RegisterOption("VssTree.splitUseOnlyDrivingAxis", optBool, "splitdriving=", "false");
|
---|
| 1763 | RegisterOption("VssTree.useRss", optBool, "rss=", "false");
|
---|
| 1764 | RegisterOption("VssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000");
|
---|
[382] | 1765 |
|
---|
[469] | 1766 | RegisterOption("VssTree.minSize", optFloat, "minsize=", "0.001");
|
---|
[382] | 1767 |
|
---|
[469] | 1768 | RegisterOption("VssTree.maxTotalMemory", optFloat, "mem=", "60.0");
|
---|
| 1769 | RegisterOption("VssTree.maxStaticMemory", optFloat, "statmem=", "8.0");
|
---|
[438] | 1770 |
|
---|
[469] | 1771 | RegisterOption("VssTree.queryType", optString, "qtype=", "static");
|
---|
[438] | 1772 |
|
---|
[532] | 1773 |
|
---|
| 1774 |
|
---|
[469] | 1775 | RegisterOption("VssTree.queryPosWeight", optFloat, "qposweight=", "0.0");
|
---|
[997] | 1776 | RegisterOption("VssTree.useRefDirSplits", optBool, "refdir=", "false");
|
---|
[469] | 1777 | RegisterOption("VssTree.refDirAngle", optFloat, "refangle=", "10");
|
---|
| 1778 | RegisterOption("VssTree.refDirBoxMaxSize", optFloat, "refboxsize=", "0.1");
|
---|
| 1779 | RegisterOption("VssTree.accessTimeThreshold", optInt, "accesstime=", "1000");
|
---|
| 1780 | RegisterOption("VssTree.minCollapseDepth", optInt, "colldepth=", "4");
|
---|
[446] | 1781 |
|
---|
[469] | 1782 | RegisterOption("VssTree.interleaveDirSplits", optBool, "interleavedirsplits", "true");
|
---|
| 1783 | RegisterOption("VssTree.dirSplitDepth", optInt, "dirsplidepth=", "10");
|
---|
| 1784 |
|
---|
| 1785 |
|
---|
| 1786 | RegisterOption("RssPreprocessor.initialSamples",
|
---|
| 1787 | optInt,
|
---|
[492] | 1788 | "initial_samples=",
|
---|
[469] | 1789 | "100000");
|
---|
| 1790 |
|
---|
[463] | 1791 | RegisterOption("RssPreprocessor.vssSamples",
|
---|
[508] | 1792 | optInt,
|
---|
| 1793 | "rss_vss_samples=",
|
---|
| 1794 | "1000000");
|
---|
| 1795 |
|
---|
[469] | 1796 | RegisterOption("RssPreprocessor.vssSamplesPerPass",
|
---|
[508] | 1797 | optInt,
|
---|
| 1798 | "rss_vss_samples_per_pass=",
|
---|
| 1799 | "1000");
|
---|
| 1800 |
|
---|
[492] | 1801 | RegisterOption("RssPreprocessor.samplesPerPass",
|
---|
[508] | 1802 | optInt,
|
---|
| 1803 | "rss_samples_per_pass=",
|
---|
| 1804 | "100000");
|
---|
| 1805 |
|
---|
[469] | 1806 | RegisterOption("RssPreprocessor.useImportanceSampling",
|
---|
[508] | 1807 | optBool,
|
---|
[1112] | 1808 | "rss_use_importance",
|
---|
[508] | 1809 | "true");
|
---|
| 1810 |
|
---|
[492] | 1811 | RegisterOption("RssPreprocessor.objectBasedSampling",
|
---|
[508] | 1812 | optBool,
|
---|
[1112] | 1813 | "rss_object_based_sampling",
|
---|
[508] | 1814 | "true");
|
---|
| 1815 |
|
---|
[492] | 1816 | RegisterOption("RssPreprocessor.directionalSampling",
|
---|
[508] | 1817 | optBool,
|
---|
[1112] | 1818 | "rss_directional_sampling",
|
---|
[508] | 1819 | "false");
|
---|
| 1820 |
|
---|
[1199] | 1821 | RegisterOption("RssTree.hybridDepth", optInt, "hybrid_depth=", "10");
|
---|
[469] | 1822 | RegisterOption("RssTree.maxDepth", optInt, "kd_depth=", "12");
|
---|
| 1823 | RegisterOption("RssTree.minPvs", optInt, "kd_minpvs=", "1");
|
---|
| 1824 | RegisterOption("RssTree.minRays", optInt, "kd_minrays=", "10");
|
---|
| 1825 | RegisterOption("RssTree.maxCostRatio", optFloat, "maxcost=", "0.95");
|
---|
| 1826 | RegisterOption("RssTree.maxRayContribution", optFloat, "maxraycontrib=", "0.5");
|
---|
[508] | 1827 |
|
---|
[469] | 1828 | RegisterOption("RssTree.epsilon", optFloat, "kd_eps=", "1e-6");
|
---|
| 1829 | RegisterOption("RssTree.ct_div_ci", optFloat, "kd_ctdivci=", "1.0");
|
---|
[997] | 1830 | RegisterOption("RssTree.randomize", optBool, "randomize=", "false");
|
---|
[1199] | 1831 | RegisterOption("RssTree.splitType", optString, "rss_split=", "queries");
|
---|
[469] | 1832 | RegisterOption("RssTree.splitUseOnlyDrivingAxis", optBool, "splitdriving=", "false");
|
---|
[508] | 1833 |
|
---|
[469] | 1834 | RegisterOption("RssTree.numberOfEndPointDomains", optInt, "endpoints=", "10000");
|
---|
[508] | 1835 |
|
---|
[469] | 1836 | RegisterOption("RssTree.minSize", optFloat, "minsize=", "0.001");
|
---|
[508] | 1837 |
|
---|
[469] | 1838 | RegisterOption("RssTree.maxTotalMemory", optFloat, "mem=", "60.0");
|
---|
| 1839 | RegisterOption("RssTree.maxStaticMemory", optFloat, "statmem=", "8.0");
|
---|
[508] | 1840 |
|
---|
[469] | 1841 | RegisterOption("RssTree.queryType", optString, "qtype=", "static");
|
---|
[508] | 1842 |
|
---|
[469] | 1843 | RegisterOption("RssTree.queryPosWeight", optFloat, "qposweight=", "0.0");
|
---|
| 1844 | RegisterOption("RssTree.useRefDirSplits", optBool, "refdir", "false");
|
---|
| 1845 | RegisterOption("RssTree.refDirAngle", optFloat, "refangle=", "10");
|
---|
| 1846 | RegisterOption("RssTree.refDirBoxMaxSize", optFloat, "refboxsize=", "0.1");
|
---|
| 1847 | RegisterOption("RssTree.accessTimeThreshold", optInt, "accesstime=", "1000");
|
---|
| 1848 | RegisterOption("RssTree.minCollapseDepth", optInt, "colldepth=", "4");
|
---|
[508] | 1849 |
|
---|
[997] | 1850 | RegisterOption("RssTree.interleaveDirSplits", optBool, "interleavedirsplits=", "true");
|
---|
[469] | 1851 | RegisterOption("RssTree.dirSplitDepth", optInt, "dirsplidepth=", "10");
|
---|
[997] | 1852 | RegisterOption("RssTree.importanceBasedCost", optBool, "importance_based_cost=", "true");
|
---|
[492] | 1853 | RegisterOption("RssTree.maxRays", optInt, "rss_max_rays=", "2000000");
|
---|
[508] | 1854 |
|
---|
[516] | 1855 | RegisterOption("RssTree.perObjectTree", optBool, "rss_per_object_tree", "false");
|
---|
| 1856 |
|
---|
[997] | 1857 | RegisterOption("RssPreprocessor.Export.pvs", optBool, "rss_export_pvs=", "false");
|
---|
| 1858 | RegisterOption("RssPreprocessor.Export.rssTree", optBool, "rss_export_rss_tree=", "false");
|
---|
| 1859 | RegisterOption("RssPreprocessor.Export.rays", optBool, "rss_export_rays=", "false");
|
---|
[469] | 1860 | RegisterOption("RssPreprocessor.Export.numRays", optInt, "rss_export_num_rays=", "5000");
|
---|
[997] | 1861 | RegisterOption("RssPreprocessor.useViewcells", optBool, "rss_use_viewcells=", "false");
|
---|
[563] | 1862 | RegisterOption("RssPreprocessor.updateSubdivision",
|
---|
| 1863 | optBool,
|
---|
[997] | 1864 | "rss_update_subdivision=",
|
---|
[563] | 1865 | "false");
|
---|
[463] | 1866 |
|
---|
[492] | 1867 |
|
---|
[508] | 1868 | /************************************************************************************/
|
---|
[1023] | 1869 | /* Rss preprocessor related options */
|
---|
[508] | 1870 | /************************************************************************************/
|
---|
| 1871 |
|
---|
| 1872 |
|
---|
[490] | 1873 | RegisterOption("RssPreprocessor.loadInitialSamples",
|
---|
[508] | 1874 | optBool,
|
---|
| 1875 | "vss_load_loadInitialSamples=",
|
---|
| 1876 | "false");
|
---|
[445] | 1877 |
|
---|
[490] | 1878 | RegisterOption("RssPreprocessor.storeInitialSamples",
|
---|
[508] | 1879 | optBool,
|
---|
| 1880 | "vss_store_storeInitialSamples=",
|
---|
| 1881 | "false");
|
---|
[490] | 1882 |
|
---|
[508] | 1883 |
|
---|
| 1884 | /************************************************************************************/
|
---|
[1023] | 1885 | /* View space partition BSP tree related options */
|
---|
[508] | 1886 | /************************************************************************************/
|
---|
| 1887 |
|
---|
[654] | 1888 | RegisterOption("VspBspTree.Termination.minGlobalCostRatio",
|
---|
| 1889 | optFloat,
|
---|
[997] | 1890 | "vsp_bsp_term_min_global_cost_ratio=",
|
---|
[654] | 1891 | "0.0001");
|
---|
[508] | 1892 |
|
---|
[655] | 1893 | RegisterOption("VspBspTree.useSplitCostQueue",
|
---|
| 1894 | optBool,
|
---|
[667] | 1895 | "vsp_bsp_use_split_cost_queue=",
|
---|
[655] | 1896 | "true");
|
---|
| 1897 |
|
---|
[654] | 1898 | RegisterOption("VspBspTree.Termination.globalCostMissTolerance",
|
---|
| 1899 | optInt,
|
---|
[997] | 1900 | "vsp_bsp_term_global_cost_miss_tolerance=",
|
---|
[654] | 1901 | "4");
|
---|
| 1902 |
|
---|
[469] | 1903 | RegisterOption("VspBspTree.Termination.minPolygons",
|
---|
[508] | 1904 | optInt,
|
---|
| 1905 | "vsp_bsp_term_min_polygons=",
|
---|
[1134] | 1906 | "-1");
|
---|
[445] | 1907 |
|
---|
[469] | 1908 | RegisterOption("VspBspTree.Termination.minPvs",
|
---|
[508] | 1909 | optInt,
|
---|
| 1910 | "vsp_bsp_term_min_pvs=",
|
---|
| 1911 | "20");
|
---|
[660] | 1912 |
|
---|
[547] | 1913 | RegisterOption("VspBspTree.Termination.minProbability",
|
---|
[508] | 1914 | optFloat,
|
---|
[547] | 1915 | "vsp_bsp_term_min_probability=",
|
---|
[508] | 1916 | "0.001");
|
---|
[445] | 1917 |
|
---|
[660] | 1918 | RegisterOption("VspBspTree.subdivisionStats",
|
---|
| 1919 | optString,
|
---|
| 1920 | "vsp_bsp_subdivision_stats=",
|
---|
| 1921 | "vspBspSubdivisionStats.log");
|
---|
| 1922 |
|
---|
[469] | 1923 | RegisterOption("VspBspTree.Termination.maxRayContribution",
|
---|
[508] | 1924 | optFloat,
|
---|
| 1925 | "vsp_bsp_term_ray_contribution=",
|
---|
[1134] | 1926 | "2");
|
---|
[463] | 1927 |
|
---|
[469] | 1928 | RegisterOption("VspBspTree.Termination.minAccRayLenght",
|
---|
[508] | 1929 | optFloat,
|
---|
| 1930 | "vsp_bsp_term_min_acc_ray_length=",
|
---|
| 1931 | "50");
|
---|
[445] | 1932 |
|
---|
[469] | 1933 | RegisterOption("VspBspTree.Termination.minRays",
|
---|
[508] | 1934 | optInt,
|
---|
| 1935 | "vsp_bsp_term_min_rays=",
|
---|
| 1936 | "-1");
|
---|
[445] | 1937 |
|
---|
[469] | 1938 | RegisterOption("VspBspTree.Termination.ct_div_ci",
|
---|
[508] | 1939 | optFloat,
|
---|
| 1940 | "vsp_bsp_term_ct_div_ci=",
|
---|
| 1941 | "0.0");
|
---|
[445] | 1942 |
|
---|
[469] | 1943 | RegisterOption("VspBspTree.Termination.maxDepth",
|
---|
[508] | 1944 | optInt,
|
---|
| 1945 | "vsp_bsp_term_max_depth=",
|
---|
[1134] | 1946 | "50");
|
---|
[445] | 1947 |
|
---|
[469] | 1948 | RegisterOption("VspBspTree.Termination.AxisAligned.maxCostRatio",
|
---|
[482] | 1949 | optFloat,
|
---|
[666] | 1950 | "vsp_bsp_term_axis_aligned_max_cost_ratio=",
|
---|
[482] | 1951 | "1.5");
|
---|
[445] | 1952 |
|
---|
[612] | 1953 | RegisterOption("VspBspTree.useCostHeuristics",
|
---|
| 1954 | optBool,
|
---|
[666] | 1955 | "vsp_bsp_use_cost_heuristics=",
|
---|
[612] | 1956 | "false");
|
---|
| 1957 |
|
---|
[478] | 1958 | RegisterOption("VspBspTree.Termination.maxViewCells",
|
---|
[482] | 1959 | optInt,
|
---|
[666] | 1960 | "vsp_bsp_term_max_view_cells=",
|
---|
[744] | 1961 | "10000");
|
---|
[478] | 1962 |
|
---|
[472] | 1963 | RegisterOption("VspBspTree.Termination.maxCostRatio",
|
---|
| 1964 | optFloat,
|
---|
[666] | 1965 | "vsp_bsp_term_max_cost_ratio=",
|
---|
[472] | 1966 | "1.5");
|
---|
[445] | 1967 |
|
---|
[472] | 1968 | RegisterOption("VspBspTree.Termination.missTolerance",
|
---|
[997] | 1969 | optInt,
|
---|
| 1970 | "vsp_bsp_term_miss_tolerance=",
|
---|
| 1971 | "4");
|
---|
| 1972 |
|
---|
[469] | 1973 | RegisterOption("VspBspTree.splitPlaneStrategy",
|
---|
[1134] | 1974 | optInt,
|
---|
[508] | 1975 | "vsp_bsp_split_method=",
|
---|
[1134] | 1976 | "1026");
|
---|
[448] | 1977 |
|
---|
[469] | 1978 | RegisterOption("VspBspTree.maxPolyCandidates",
|
---|
[508] | 1979 | optInt,
|
---|
| 1980 | "vsp_bsp_max_poly_candidates=",
|
---|
| 1981 | "20");
|
---|
[1134] | 1982 |
|
---|
[469] | 1983 | RegisterOption("VspBspTree.maxRayCandidates",
|
---|
[508] | 1984 | optInt,
|
---|
| 1985 | "vsp_bsp_max_plane_candidates=",
|
---|
| 1986 | "20");
|
---|
[469] | 1987 |
|
---|
| 1988 | RegisterOption("VspBspTree.maxTests",
|
---|
[508] | 1989 | optInt,
|
---|
| 1990 | "vsp_bsp_max_tests=",
|
---|
| 1991 | "5000");
|
---|
[469] | 1992 |
|
---|
| 1993 | RegisterOption("VspBspTree.Construction.samples",
|
---|
[508] | 1994 | optInt,
|
---|
[673] | 1995 | "vsp_bsp_construction_samples=",
|
---|
[508] | 1996 | "100000");
|
---|
[469] | 1997 |
|
---|
[801] | 1998 | RegisterOption("VspBspTree.Construction.minBand",
|
---|
| 1999 | optFloat,
|
---|
| 2000 | "vsp_bsp_construction_min_band=",
|
---|
[1074] | 2001 | "0.01");
|
---|
[801] | 2002 |
|
---|
| 2003 | RegisterOption("VspBspTree.Construction.maxBand",
|
---|
| 2004 | optFloat,
|
---|
[1147] | 2005 | "vsp_bsp_construction_max_band=",
|
---|
[1074] | 2006 | "0.99");
|
---|
[801] | 2007 |
|
---|
[822] | 2008 | RegisterOption("VspBspTree.Construction.useDrivingAxisForMaxCost",
|
---|
| 2009 | optBool,
|
---|
| 2010 | "vsp_bsp_construction_use_drivingaxis_for_maxcost=",
|
---|
| 2011 | "false");
|
---|
| 2012 |
|
---|
[469] | 2013 | RegisterOption("VspBspTree.Construction.epsilon",
|
---|
[508] | 2014 | optFloat,
|
---|
[1023] | 2015 | "vsp_bsp_construction_epsilon=",
|
---|
[508] | 2016 | "0.002");
|
---|
[469] | 2017 |
|
---|
| 2018 | RegisterOption("VspBspTree.Visualization.exportSplits",
|
---|
[508] | 2019 | optBool,
|
---|
| 2020 | "vsp_bsp_visualization.export_splits",
|
---|
| 2021 | "false");
|
---|
| 2022 |
|
---|
[485] | 2023 | RegisterOption("VspBspTree.splitUseOnlyDrivingAxis",
|
---|
[508] | 2024 | optBool,
|
---|
[667] | 2025 | "vsp_bsp_split_only_driving_axis=",
|
---|
[508] | 2026 | "false");
|
---|
| 2027 |
|
---|
[607] | 2028 | RegisterOption("VspBspTree.usePolygonSplitIfAvailable",
|
---|
| 2029 | optBool,
|
---|
| 2030 | "vsp_bsp_usePolygonSplitIfAvailable=",
|
---|
[611] | 2031 | "false");
|
---|
[607] | 2032 |
|
---|
[508] | 2033 | RegisterOption("VspBspTree.Termination.AxisAligned.minRays",
|
---|
| 2034 | optInt,
|
---|
| 2035 | "bsp_term_axis_aligned_min_rays=",
|
---|
[1134] | 2036 | "0");
|
---|
[492] | 2037 |
|
---|
[508] | 2038 | RegisterOption("VspBspTree.Termination.AxisAligned.maxRayContribution",
|
---|
| 2039 | optFloat,
|
---|
| 2040 | "bsp_term_axis_aligned_min_rays=",
|
---|
[1134] | 2041 | "2");
|
---|
[508] | 2042 |
|
---|
[676] | 2043 | RegisterOption("VspBspTree.Factor.leastRaySplits",
|
---|
| 2044 | optFloat,
|
---|
| 2045 | "vsp_bsp_factor_least_ray_splits=",
|
---|
| 2046 | "1.0");
|
---|
| 2047 |
|
---|
| 2048 | RegisterOption("VspBspTree.Factor.balancedRays",
|
---|
| 2049 | optFloat,
|
---|
| 2050 | "vsp_bsp_factor_balanced_rays=",
|
---|
| 2051 | "1.0");
|
---|
| 2052 |
|
---|
| 2053 | RegisterOption("VspBspTree.Factor.pvs",
|
---|
| 2054 | optFloat,
|
---|
| 2055 | "vsp_bsp_factor_pvs=",
|
---|
| 2056 | "1.0");
|
---|
[664] | 2057 |
|
---|
[580] | 2058 | RegisterOption("VspBspTree.Construction.renderCostWeight",
|
---|
[478] | 2059 | optFloat,
|
---|
[1002] | 2060 | "vsp_bsp_post_process_render_cost_weight=",
|
---|
[1134] | 2061 | "1.0");
|
---|
[478] | 2062 |
|
---|
[1020] | 2063 | RegisterOption("VspBspTree.Construction.renderCostDecreaseWeight",
|
---|
| 2064 | optFloat,
|
---|
[1121] | 2065 | "vsp_bsp_construction_render_cost_decrease_weight=",
|
---|
[1020] | 2066 | "0.99");
|
---|
| 2067 |
|
---|
[486] | 2068 | RegisterOption("VspBspTree.Construction.randomize",
|
---|
| 2069 | optBool,
|
---|
| 2070 | "vsp_bsp_construction_randomize=",
|
---|
| 2071 | "false");
|
---|
[508] | 2072 |
|
---|
[663] | 2073 | RegisterOption("VspBspTree.simulateOctree",
|
---|
| 2074 | optBool,
|
---|
| 2075 | "vsp_bsp_simulate_octree=",
|
---|
| 2076 | "false");
|
---|
| 2077 |
|
---|
[735] | 2078 | RegisterOption("VspBspTree.nodePriorityQueueType",
|
---|
| 2079 | optInt,
|
---|
| 2080 | "vsp_bsp_node_queue_type=",
|
---|
| 2081 | "0");
|
---|
[664] | 2082 |
|
---|
| 2083 | RegisterOption("VspBspTree.useRandomAxis",
|
---|
| 2084 | optBool,
|
---|
| 2085 | "-vsp_bsp_use_random_axis=",
|
---|
| 2086 | "false");
|
---|
| 2087 |
|
---|
[508] | 2088 | RegisterOption("VspBspTree.maxTotalMemory",
|
---|
| 2089 | optFloat,
|
---|
| 2090 | "vsp_bsp_max_total_mem=",
|
---|
| 2091 | "60.0");
|
---|
| 2092 |
|
---|
| 2093 | RegisterOption("VspBspTree.maxStaticMemory",
|
---|
| 2094 | optFloat,
|
---|
| 2095 | "vsp_bsp_max_static_mem=",
|
---|
| 2096 | "8.0");
|
---|
[564] | 2097 |
|
---|
[1023] | 2098 |
|
---|
| 2099 |
|
---|
[1027] | 2100 | /***************************************************************************/
|
---|
| 2101 | /* View space partition tree related options */
|
---|
| 2102 | /***************************************************************************/
|
---|
[1023] | 2103 |
|
---|
[580] | 2104 |
|
---|
[1027] | 2105 | RegisterOption("VspTree.Construction.samples",
|
---|
| 2106 | optInt,
|
---|
| 2107 | "vsp_construction_samples=",
|
---|
| 2108 | "10000");
|
---|
| 2109 |
|
---|
[1121] | 2110 |
|
---|
| 2111 | RegisterOption("VspTree.Construction.renderCostDecreaseWeight",
|
---|
| 2112 | optFloat,
|
---|
| 2113 | "vsp_construction_render_cost_decrease_weight=",
|
---|
| 2114 | "0.99");
|
---|
| 2115 |
|
---|
[1023] | 2116 | RegisterOption("VspTree.Termination.maxDepth",
|
---|
| 2117 | optInt,
|
---|
| 2118 | "vsp_term_max_depth=",
|
---|
| 2119 | "100");
|
---|
| 2120 |
|
---|
| 2121 | RegisterOption("VspTree.Termination.minRays",
|
---|
| 2122 | optInt,
|
---|
| 2123 | "vsp_term_min_rays=",
|
---|
| 2124 | "-1");
|
---|
| 2125 |
|
---|
| 2126 |
|
---|
| 2127 | RegisterOption("VspTree.Termination.minPvs",
|
---|
| 2128 | optInt,
|
---|
| 2129 | "vsp_term_min_pvs=",
|
---|
| 2130 | "20");
|
---|
| 2131 |
|
---|
| 2132 | RegisterOption("VspTree.Termination.minProbability",
|
---|
| 2133 | optFloat,
|
---|
| 2134 | "vsp_term_min_probability=",
|
---|
| 2135 | "0.001");
|
---|
| 2136 |
|
---|
| 2137 | RegisterOption("VspTree.Termination.maxRayContribution",
|
---|
| 2138 | optFloat,
|
---|
| 2139 | "vsp_term_ray_contribution=",
|
---|
| 2140 | "0.9");
|
---|
| 2141 |
|
---|
| 2142 | RegisterOption("VspTree.Termination.maxCostRatio",
|
---|
| 2143 | optFloat,
|
---|
| 2144 | "vsp_term_max_cost_ratio=",
|
---|
| 2145 | "1.5");
|
---|
| 2146 |
|
---|
| 2147 | RegisterOption("VspTree.Termination.maxViewCells",
|
---|
| 2148 | optInt,
|
---|
| 2149 | "vsp_term_max_view_cells=",
|
---|
| 2150 | "10000");
|
---|
[564] | 2151 |
|
---|
[1023] | 2152 |
|
---|
| 2153 | RegisterOption("VspTree.Termination.missTolerance",
|
---|
| 2154 | optInt,
|
---|
| 2155 | "vsp_term_miss_tolerance=",
|
---|
| 2156 | "4");
|
---|
| 2157 |
|
---|
| 2158 | RegisterOption("VspTree.Termination.minGlobalCostRatio",
|
---|
| 2159 | optFloat,
|
---|
| 2160 | "vsp_term_min_global_cost_ratio=",
|
---|
| 2161 | "0.0001");
|
---|
| 2162 |
|
---|
| 2163 | RegisterOption("VspTree.Termination.globalCostMissTolerance",
|
---|
| 2164 | optInt,
|
---|
| 2165 | "vsp_term_global_cost_miss_tolerance=",
|
---|
| 2166 | "4");
|
---|
| 2167 |
|
---|
| 2168 | RegisterOption("VspTree.Termination.ct_div_ci",
|
---|
| 2169 | optFloat,
|
---|
| 2170 | "vsp_term_ct_div_ci=",
|
---|
| 2171 | "0.0");
|
---|
| 2172 |
|
---|
| 2173 | RegisterOption("VspTree.Construction.epsilon",
|
---|
| 2174 | optFloat,
|
---|
| 2175 | "vsp_construction_epsilon=",
|
---|
| 2176 | "0.002");
|
---|
| 2177 |
|
---|
| 2178 | RegisterOption("VspTree.splitUseOnlyDrivingAxis",
|
---|
| 2179 | optBool,
|
---|
| 2180 | "vsp_split_only_driving_axis=",
|
---|
| 2181 | "false");
|
---|
| 2182 |
|
---|
| 2183 | RegisterOption("VspTree.maxStaticMemory",
|
---|
| 2184 | optFloat,
|
---|
| 2185 | "vsp_max_static_mem=",
|
---|
| 2186 | "8.0");
|
---|
| 2187 |
|
---|
| 2188 | RegisterOption("VspTree.useCostHeuristics",
|
---|
| 2189 | optBool,
|
---|
| 2190 | "vsp_use_cost_heuristics=",
|
---|
| 2191 | "false");
|
---|
| 2192 |
|
---|
| 2193 | RegisterOption("VspTree.simulateOctree",
|
---|
| 2194 | optBool,
|
---|
| 2195 | "vsp_simulate_octree=",
|
---|
| 2196 | "false");
|
---|
| 2197 |
|
---|
| 2198 | RegisterOption("VspTree.Construction.randomize",
|
---|
| 2199 | optBool,
|
---|
| 2200 | "vsp_construction_randomize=",
|
---|
| 2201 | "false");
|
---|
| 2202 |
|
---|
| 2203 | RegisterOption("VspTree.subdivisionStats",
|
---|
| 2204 | optString,
|
---|
| 2205 | "vsp_subdivision_stats=",
|
---|
| 2206 | "vspSubdivisionStats.log");
|
---|
| 2207 |
|
---|
| 2208 | RegisterOption("VspTree.Construction.minBand",
|
---|
| 2209 | optFloat,
|
---|
| 2210 | "vsp_construction_min_band=",
|
---|
[1074] | 2211 | "0.01");
|
---|
[1023] | 2212 |
|
---|
| 2213 | RegisterOption("VspTree.Construction.maxBand",
|
---|
| 2214 | optFloat,
|
---|
[1074] | 2215 | "vsp_construction_max_band=",
|
---|
| 2216 | "0.99");
|
---|
[1106] | 2217 |
|
---|
[1149] | 2218 | RegisterOption("VspTree.maxTests",
|
---|
| 2219 | optInt,
|
---|
| 2220 | "vsp_max_tests=",
|
---|
[1161] | 2221 | "5000");
|
---|
[1143] | 2222 |
|
---|
| 2223 |
|
---|
[1074] | 2224 |
|
---|
[1288] | 2225 | /***********************************************************************/
|
---|
| 2226 | /* Object space partition tree related options */
|
---|
| 2227 | /***********************************************************************/
|
---|
[1143] | 2228 |
|
---|
[1294] | 2229 |
|
---|
[1106] | 2230 | RegisterOption("OspTree.Construction.randomize",
|
---|
[1288] | 2231 | optBool,
|
---|
| 2232 | "osp_construction_randomize=",
|
---|
| 2233 | "false");
|
---|
[1106] | 2234 |
|
---|
| 2235 | RegisterOption("OspTree.Termination.maxDepth",
|
---|
| 2236 | optInt,
|
---|
| 2237 | "osp_term_max_depth=",
|
---|
| 2238 | "30");
|
---|
| 2239 |
|
---|
| 2240 | RegisterOption("OspTree.Termination.maxLeaves",
|
---|
| 2241 | optInt,
|
---|
| 2242 | "osp_term_max_leaves=",
|
---|
| 2243 | "1000");
|
---|
| 2244 |
|
---|
| 2245 | RegisterOption("OspTree.Termination.minObjects",
|
---|
| 2246 | optInt,
|
---|
| 2247 | "osp_term_min_objects=",
|
---|
| 2248 | "1");
|
---|
| 2249 |
|
---|
| 2250 | RegisterOption("OspTree.Termination.minProbability",
|
---|
| 2251 | optFloat,
|
---|
| 2252 | "osp_term_min_objects=",
|
---|
[1288] | 2253 | "0.00001");
|
---|
[1106] | 2254 |
|
---|
| 2255 | RegisterOption("OspTree.Termination.missTolerance",
|
---|
| 2256 | optInt,
|
---|
| 2257 | "osp_term_miss_tolerance=",
|
---|
[1288] | 2258 | "8");
|
---|
[1106] | 2259 |
|
---|
| 2260 | RegisterOption("OspTree.Termination.maxCostRatio",
|
---|
| 2261 | optFloat,
|
---|
| 2262 | "osp_term_max_cost_ratio=",
|
---|
| 2263 | "0.99");
|
---|
| 2264 |
|
---|
| 2265 | RegisterOption("OspTree.Termination.minGlobalCostRatio",
|
---|
| 2266 | optFloat,
|
---|
| 2267 | "osp_term_min_global_cost_ratio=",
|
---|
| 2268 | "0.00001");
|
---|
| 2269 |
|
---|
| 2270 | RegisterOption("OspTree.Termination.globalCostMissTolerance",
|
---|
| 2271 | optInt,
|
---|
| 2272 | "osp_term_global_cost_miss_tolerance=",
|
---|
| 2273 | "4");
|
---|
| 2274 |
|
---|
| 2275 | RegisterOption("OspTree.Termination.ct_div_ci",
|
---|
| 2276 | optFloat,
|
---|
| 2277 | "osp_term_ct_div_ci=",
|
---|
| 2278 | "0");
|
---|
| 2279 |
|
---|
| 2280 | RegisterOption("OspTree.Construction.epsilon",
|
---|
[1288] | 2281 | optFloat,
|
---|
| 2282 | "osp_construction_epsilon=",
|
---|
| 2283 | "0.00001");
|
---|
[1106] | 2284 |
|
---|
| 2285 | // if only the driving axis is used for axis aligned split
|
---|
| 2286 | RegisterOption("OspTree.splitUseOnlyDrivingAxis",
|
---|
[1288] | 2287 | optBool,
|
---|
| 2288 | "osp_split_only_driving_axis=",
|
---|
| 2289 | "false");
|
---|
[1106] | 2290 |
|
---|
| 2291 | RegisterOption("OspTree.maxStaticMemory",
|
---|
[1288] | 2292 | optFloat,
|
---|
| 2293 | "osp_max_static_mem=",
|
---|
| 2294 | "8.0");
|
---|
[1106] | 2295 |
|
---|
| 2296 | RegisterOption("OspTree.useCostHeuristics",
|
---|
[1288] | 2297 | optBool,
|
---|
| 2298 | "osp_use_cost_heuristics=",
|
---|
| 2299 | "true");
|
---|
[1106] | 2300 |
|
---|
| 2301 | RegisterOption("OspTree.subdivisionStats",
|
---|
| 2302 | optString,
|
---|
| 2303 | "osp_subdivision_stats=",
|
---|
| 2304 | "ospSubdivisionStats.log");
|
---|
| 2305 |
|
---|
| 2306 | RegisterOption("OspTree.Construction.splitBorder",
|
---|
| 2307 | optFloat,
|
---|
| 2308 | "osp_construction_split_border=",
|
---|
| 2309 | "0.01");
|
---|
| 2310 |
|
---|
[1121] | 2311 | RegisterOption("OspTree.Construction.renderCostDecreaseWeight",
|
---|
[1288] | 2312 | optFloat,
|
---|
| 2313 | "osp_construction_render_cost_decrease_weight=",
|
---|
| 2314 | "0.99");
|
---|
[1106] | 2315 |
|
---|
| 2316 |
|
---|
[1288] | 2317 |
|
---|
[1297] | 2318 | /**********************************************************************/
|
---|
| 2319 | /* Bounding Volume Hierarchy related options */
|
---|
| 2320 | /**********************************************************************/
|
---|
[1288] | 2321 |
|
---|
| 2322 | RegisterOption("BvHierarchy.Construction.randomize",
|
---|
| 2323 | optBool,
|
---|
| 2324 | "bvh_construction_randomize=",
|
---|
| 2325 | "false");
|
---|
| 2326 |
|
---|
| 2327 | RegisterOption("BvHierarchy.Termination.maxDepth",
|
---|
| 2328 | optInt,
|
---|
| 2329 | "bvh_term_max_depth=",
|
---|
| 2330 | "30");
|
---|
| 2331 |
|
---|
| 2332 | RegisterOption("BvHierarchy.Termination.maxLeaves",
|
---|
| 2333 | optInt,
|
---|
| 2334 | "bvh_term_max_leaves=",
|
---|
| 2335 | "1000");
|
---|
| 2336 |
|
---|
| 2337 | RegisterOption("BvHierarchy.Termination.minObjects",
|
---|
| 2338 | optInt,
|
---|
| 2339 | "bvh_term_min_objects=",
|
---|
| 2340 | "1");
|
---|
| 2341 |
|
---|
| 2342 | RegisterOption("BvHierarchy.Termination.minProbability",
|
---|
| 2343 | optFloat,
|
---|
| 2344 | "bvh_term_min_objects=",
|
---|
| 2345 | "0.00001");
|
---|
| 2346 |
|
---|
[1370] | 2347 | RegisterOption("BvHierarchy.Termination.minRays",
|
---|
| 2348 | optInt,
|
---|
| 2349 | "bvh_term_min_rays=",
|
---|
| 2350 | "0");
|
---|
| 2351 |
|
---|
[1288] | 2352 | RegisterOption("BvHierarchy.Termination.missTolerance",
|
---|
| 2353 | optInt,
|
---|
| 2354 | "osp_term_miss_tolerance=",
|
---|
| 2355 | "8");
|
---|
| 2356 |
|
---|
| 2357 | RegisterOption("BvHierarchy.Termination.maxCostRatio",
|
---|
| 2358 | optFloat,
|
---|
| 2359 | "bvh_term_max_cost_ratio=",
|
---|
| 2360 | "0.99");
|
---|
| 2361 |
|
---|
| 2362 | RegisterOption("BvHierarchy.Termination.minGlobalCostRatio",
|
---|
| 2363 | optFloat,
|
---|
| 2364 | "bvh_term_min_global_cost_ratio=",
|
---|
| 2365 | "0.00001");
|
---|
| 2366 |
|
---|
| 2367 | RegisterOption("BvHierarchy.Termination.globalCostMissTolerance",
|
---|
| 2368 | optInt,
|
---|
| 2369 | "bvh_term_global_cost_miss_tolerance=",
|
---|
| 2370 | "4");
|
---|
| 2371 |
|
---|
| 2372 | // if only the driving axis is used for axis aligned split
|
---|
| 2373 | RegisterOption("BvHierarchy.splitUseOnlyDrivingAxis",
|
---|
| 2374 | optBool,
|
---|
| 2375 | "bvh_split_only_driving_axis=",
|
---|
| 2376 | "false");
|
---|
| 2377 |
|
---|
| 2378 | RegisterOption("BvHierarchy.maxStaticMemory",
|
---|
| 2379 | optFloat,
|
---|
| 2380 | "bvh_max_static_mem=",
|
---|
| 2381 | "8.0");
|
---|
| 2382 |
|
---|
| 2383 | RegisterOption("BvHierarchy.useCostHeuristics",
|
---|
| 2384 | optBool,
|
---|
| 2385 | "bvh_use_cost_heuristics=",
|
---|
| 2386 | "true");
|
---|
| 2387 |
|
---|
| 2388 | RegisterOption("BvHierarchy.subdivisionStats",
|
---|
[1174] | 2389 | optString,
|
---|
[1288] | 2390 | "bvh_subdivision_stats=",
|
---|
| 2391 | "bvhSubdivisionStats.log");
|
---|
[1174] | 2392 |
|
---|
[1288] | 2393 | RegisterOption("BvHierarchy.Construction.renderCostDecreaseWeight",
|
---|
| 2394 | optFloat,
|
---|
| 2395 | "bvh_construction_render_cost_decrease_weight=",
|
---|
| 2396 | "0.99");
|
---|
[1359] | 2397 |
|
---|
| 2398 | RegisterOption("BvHierarchy.Construction.useGlobalSorting",
|
---|
| 2399 | optBool,
|
---|
| 2400 | "bvh_construction_use_global_sorting=",
|
---|
| 2401 | "false");
|
---|
[1288] | 2402 |
|
---|
[1359] | 2403 |
|
---|
| 2404 | /*******************************************************************/
|
---|
| 2405 | /* Hierarchy Manager related options */
|
---|
| 2406 | /*******************************************************************/
|
---|
[1288] | 2407 |
|
---|
| 2408 | RegisterOption("Hierarchy.subdivisionStats",
|
---|
| 2409 | optString,
|
---|
| 2410 | "hierarchy_subdivision_stats=",
|
---|
| 2411 | "hierarchySubdivisionStats.log");
|
---|
| 2412 |
|
---|
| 2413 | RegisterOption("Hierarchy.type",
|
---|
| 2414 | optString,
|
---|
| 2415 | "hierarchy_type=",
|
---|
| 2416 | "bvh");
|
---|
| 2417 |
|
---|
| 2418 | RegisterOption("Hierarchy.Termination.minGlobalCostRatio",
|
---|
| 2419 | optFloat,
|
---|
| 2420 | "hierarchy_term_min_global_cost_ratio=",
|
---|
| 2421 | "0.00001");
|
---|
| 2422 |
|
---|
| 2423 | RegisterOption("Hierarchy.Termination.globalCostMissTolerance",
|
---|
| 2424 | optInt,
|
---|
| 2425 | "hierarchy_term_global_cost_miss_tolerance=",
|
---|
| 2426 | "4");
|
---|
| 2427 |
|
---|
| 2428 | RegisterOption("Hierarchy.Termination.maxLeaves",
|
---|
| 2429 | optInt,
|
---|
| 2430 | "hierarchy_term_max_leaves=",
|
---|
| 2431 | "1000");
|
---|
| 2432 |
|
---|
[1293] | 2433 | RegisterOption("Hierarchy.Construction.type",
|
---|
| 2434 | optInt,
|
---|
| 2435 | "hierarchy_construction_type=",
|
---|
| 2436 | "0");
|
---|
| 2437 |
|
---|
[1311] | 2438 | RegisterOption("Hierarchy.Construction.minDepthForOsp",
|
---|
| 2439 | optInt,
|
---|
| 2440 | "hierarchy_construction_min_depth_for_osp=",
|
---|
| 2441 | "-1");
|
---|
| 2442 |
|
---|
[1370] | 2443 | RegisterOption("Hierarchy.Construction.startWithObjectSpace",
|
---|
| 2444 | optBool,
|
---|
| 2445 | "hierarchy_construction_start_with_osp=",
|
---|
| 2446 | "true");
|
---|
| 2447 |
|
---|
[1314] | 2448 | RegisterOption("Hierarchy.Construction.repairQueue",
|
---|
| 2449 | optBool,
|
---|
| 2450 | "hierarchy_construction_repair_queue=",
|
---|
| 2451 | "true");
|
---|
[1311] | 2452 |
|
---|
[1370] | 2453 | RegisterOption("Hierarchy.Construction.minDepthForVsp",
|
---|
| 2454 | optInt,
|
---|
| 2455 | "hierarchy_construction_min_depth_for_vsp=",
|
---|
| 2456 | "-1");
|
---|
[1359] | 2457 |
|
---|
[469] | 2458 | //////////////////////////////////////////////////////////////////////////////////
|
---|
[372] | 2459 | }
|
---|
| 2460 |
|
---|
| 2461 | void
|
---|
| 2462 | Environment::SetStaticOptions()
|
---|
| 2463 | {
|
---|
| 2464 |
|
---|
| 2465 | // get Global option values
|
---|
| 2466 | GetRealValue("Limits.threshold", Limits::Threshold);
|
---|
| 2467 | GetRealValue("Limits.small", Limits::Small);
|
---|
| 2468 | GetRealValue("Limits.infinity", Limits::Infinity);
|
---|
| 2469 |
|
---|
| 2470 |
|
---|
| 2471 | }
|
---|
| 2472 |
|
---|
[938] | 2473 | bool
|
---|
[492] | 2474 | Environment::Parse(const int argc, char **argv, bool useExePath)
|
---|
[372] | 2475 | {
|
---|
[938] | 2476 | bool result = true;
|
---|
[372] | 2477 | // Read the names of the scene, environment and output files
|
---|
| 2478 | ReadCmdlineParams(argc, argv, "");
|
---|
| 2479 |
|
---|
| 2480 | char *envFilename = new char[128];
|
---|
| 2481 |
|
---|
| 2482 | char filename[64];
|
---|
| 2483 |
|
---|
| 2484 | // Get the environment file name
|
---|
| 2485 | if (!GetParam(' ', 0, filename)) {
|
---|
| 2486 | // user didn't specified environment file explicitly, so
|
---|
[1199] | 2487 | strcpy(filename, "default.env");
|
---|
[372] | 2488 | }
|
---|
| 2489 |
|
---|
| 2490 | if (useExePath) {
|
---|
| 2491 | char *path = GetPath(argv[0]);
|
---|
| 2492 | if (*path != 0)
|
---|
| 2493 | sprintf(envFilename, "%s/%s", path, filename);
|
---|
| 2494 | else
|
---|
| 2495 | strcpy(envFilename, filename);
|
---|
| 2496 |
|
---|
| 2497 | delete path;
|
---|
| 2498 | }
|
---|
| 2499 | else
|
---|
| 2500 | strcpy(envFilename, filename);
|
---|
| 2501 |
|
---|
| 2502 |
|
---|
| 2503 | // Now it's time to read in environment file.
|
---|
| 2504 | if (!ReadEnvFile(envFilename)) {
|
---|
| 2505 | // error - bad input file name specified ?
|
---|
| 2506 | cerr<<"Error parsing environment file "<<envFilename<<endl;
|
---|
[938] | 2507 | result = false;
|
---|
[372] | 2508 | }
|
---|
| 2509 | delete envFilename;
|
---|
| 2510 |
|
---|
| 2511 | // Parse the command line; options given on the command line subsume
|
---|
| 2512 | // stuff specified in the input environment file.
|
---|
| 2513 | ParseCmdline(argc, argv, 0);
|
---|
| 2514 |
|
---|
| 2515 | SetStaticOptions();
|
---|
| 2516 |
|
---|
| 2517 | // Check for request for help
|
---|
| 2518 | if (CheckForSwitch(argc, argv, '?')) {
|
---|
| 2519 | PrintUsage(cout);
|
---|
| 2520 | exit(0);
|
---|
| 2521 | }
|
---|
[938] | 2522 |
|
---|
| 2523 | return true;
|
---|
[372] | 2524 | }
|
---|
[860] | 2525 |
|
---|
[878] | 2526 | }
|
---|