| 495 | } |
| 496 | |
| 497 | void LocalFileFormat::bake(const Baker & baker, |
| 498 | const std::string & formatName, |
| 499 | std::ostream & ostream) const |
| 500 | { |
| 501 | int DEFAULT_CUBE_SIZE = 0; |
| 502 | int SHAPER_BIT_DEPTH = 10; |
| 503 | int CUBE_BIT_DEPTH = 12; |
| 504 | |
| 505 | |
| 506 | // NOTE: This code is very old, Lustre and Flame have long been able |
| 507 | // to support much larger cube sizes. Furthermore there is no |
| 508 | // need to use the legacy 3dl format since CLF/CTF is supported. |
| 509 | if(formatName == "lustre") |
| 510 | { |
| 511 | DEFAULT_CUBE_SIZE = 33; |
| 512 | } |
| 513 | else if(formatName == "flame") |
| 514 | { |
| 515 | DEFAULT_CUBE_SIZE = 17; |
| 516 | } |
| 517 | else |
| 518 | { |
| 519 | std::ostringstream os; |
| 520 | os << "Unknown 3dl format name, '"; |
| 521 | os << formatName << "'."; |
| 522 | throw Exception(os.str().c_str()); |
| 523 | } |
| 524 | |
| 525 | ConstConfigRcPtr config = baker.getConfig(); |
| 526 | |
| 527 | int cubeSize = baker.getCubeSize(); |
| 528 | if(cubeSize==-1) cubeSize = DEFAULT_CUBE_SIZE; |
| 529 | cubeSize = std::max(2, cubeSize); // smallest cube is 2x2x2 |
| 530 | |
| 531 | int shaperSize = baker.getShaperSize(); |
| 532 | if(shaperSize==-1) shaperSize = cubeSize; |
| 533 | |
| 534 | std::vector<float> cubeData; |
| 535 | cubeData.resize(cubeSize*cubeSize*cubeSize*3); |
| 536 | GenerateIdentityLut3D(&cubeData[0], cubeSize, 3, LUT3DORDER_FAST_BLUE); |
| 537 | PackedImageDesc cubeImg(&cubeData[0], cubeSize*cubeSize*cubeSize, 1, 3); |
| 538 | ConstCPUProcessorRcPtr inputToTarget = GetInputToTargetProcessor(baker); |
| 539 | inputToTarget->apply(cubeImg); |
| 540 | |
| 541 | // Write out the file. |
| 542 | // For for maximum compatibility with other apps, we will |
| 543 | // not utilize the shaper or output any metadata. |
| 544 | |
| 545 | if(formatName == "lustre") |
| 546 | { |
| 547 | int meshInputBitDepth = CubeDimensionLenToLustreBitDepth(cubeSize); |
| 548 | ostream << "3DMESH\n"; |
| 549 | ostream << "Mesh " << meshInputBitDepth << " " << CUBE_BIT_DEPTH << "\n"; |
| 550 | } |
| 551 | |
| 552 | std::vector<float> shaperData(shaperSize); |
| 553 | GenerateIdentityLut1D(&shaperData[0], shaperSize, 1); |
| 554 |
nothing calls this directly
no test coverage detected