#pragma once #include "../../core/Defines.h" #include "../../core/Serializer.h" #include "../../core/CollectionHelper.h" #include "MaterialLibrary.h" #include "Block.h" #include "../../inc/tbb/parallel_sort.h" #include #include template, unsigned8 channelsPerPixel = 3> class BlockBasedMaterialLibrary : public MaterialLibrary { private: std::vector> mBlocks; std::vector mBlocksImportance; public: BlockBasedMaterialLibrary() : MaterialLibrary() {} BlockBasedMaterialLibrary(std::vector texture, unsigned short textureSize, MaterialLibraryPointer highestMaterialIndex) : MaterialLibrary(texture, textureSize, highestMaterialIndex) { } // Copy constructor BlockBasedMaterialLibrary(const BlockBasedMaterialLibrary& other) : MaterialLibrary(other) { this->mBlocks = other.mBlocks; this->mBlocksImportance = other.mBlocksImportance; } ~BlockBasedMaterialLibrary() {} //void Finalize() //{ // std::srand(time(0)); // // TODO: optimize the texture to get the lowest cost for the blocks // std::random_shuffle(mMaterials->begin(), mMaterials->end()); // MaterialLibrary::Finalize(false); //} };