| 673 | |
| 674 | // Entry point for a bake thread |
| 675 | template<typename TBaker> uint32 __stdcall BakeThread(void* data) |
| 676 | { |
| 677 | BakeThreadData* threadData = reinterpret_cast<BakeThreadData*>(data); |
| 678 | const MeshBaker* meshBaker = threadData->Baker; |
| 679 | |
| 680 | BakeThreadContext context; |
| 681 | TBaker baker; |
| 682 | |
| 683 | while(meshBaker->killBakeThreads == false) |
| 684 | { |
| 685 | const uint64 currTag = meshBaker->bakeTag; |
| 686 | if(context.BakeTag != currTag) |
| 687 | context.Init(threadData->BakeOutput, threadData->Samples, |
| 688 | threadData->CurrBatch, threadData->Baker, currTag); |
| 689 | |
| 690 | if(BakeDriver<TBaker>(context, baker) == false) |
| 691 | Sleep(5); |
| 692 | } |
| 693 | |
| 694 | return 0; |
| 695 | } |
| 696 | |
| 697 | |
| 698 | // Builds a BVH tree for an entire model/scene |