38 lines
1.3 KiB
C++
38 lines
1.3 KiB
C++
#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 <vector>
|
|
#include <iterator>
|
|
|
|
template<typename T, typename Comparer = std::less<T>, unsigned8 channelsPerPixel = 3>
|
|
class BlockBasedMaterialLibrary : public MaterialLibrary<T, Comparer, channelsPerPixel>
|
|
{
|
|
private:
|
|
std::vector<Block<T>> mBlocks;
|
|
std::vector<size_t> mBlocksImportance;
|
|
public:
|
|
BlockBasedMaterialLibrary() : MaterialLibrary<T, Comparer, channelsPerPixel>() {}
|
|
BlockBasedMaterialLibrary(std::vector<unsigned char> texture, unsigned short textureSize, MaterialLibraryPointer highestMaterialIndex) : MaterialLibrary<T, Comparer, channelsPerPixel>(texture, textureSize, highestMaterialIndex)
|
|
{ }
|
|
|
|
// Copy constructor
|
|
BlockBasedMaterialLibrary(const BlockBasedMaterialLibrary& other) : MaterialLibrary<T, Comparer, channelsPerPixel>(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);
|
|
//}
|
|
}; |