Files
CDAG/Research/scene/Material/MaterialQuantizer/NormalQuantizer.h

20 lines
836 B
C++

#pragma once
#include <map>
#include <vector>
#include "../SmallNormal.h"
#include "BaseQuantizer.h"
// Super simple quantizer: takes the original value, sets some bits to zero so that only the given number of bits remain
class NormalQuantizer : public BaseQuantizer<SmallNormal, NormalCompare>, public QuickQuantizer<SmallNormal>
{
public:
NormalQuantizer(unsigned8 bits);
std::map<SmallNormal, SmallNormal, NormalCompare>* QuantizeMaterials(std::vector<SmallNormal> materials) const override;
std::string GetQuantizerDescriptor() const override;
SmallNormal Quantize(const SmallNormal& normal) const override;
private:
// if the number of bits is smaller than or equal to this number, all possible quantization values will be added.
static const unsigned8 QUANTIZE_ALL_UP_TO = 14;
unsigned8 mBits;
unsigned32 mChannelMask;
};