28 lines
813 B
C++
28 lines
813 B
C++
#pragma once
|
|
|
|
#include "ShortIndexed.hpp"
|
|
|
|
namespace buffer {
|
|
/// ShortIndexed with merge indices for LOD
|
|
class LodShortIndexed: public ShortIndexed {
|
|
public:
|
|
using LodData = std::pair<Data, std::vector<size_t>>;
|
|
|
|
LodShortIndexed(GLenum shape, const ShortIndexed::Data &data, const std::vector<size_t> &lod_offsets);
|
|
LodShortIndexed(GLenum shape, const LodShortIndexed::LodData &data);
|
|
virtual ~LodShortIndexed();
|
|
|
|
uint draw(params params) override;
|
|
|
|
void inline setLevel(size_t l) { level = l; }
|
|
|
|
private:
|
|
size_t level = 0;
|
|
std::vector<size_t> offsets;
|
|
constexpr inline size_t getOffset(size_t level) const {
|
|
return level <= 0 ? 0 : (level-1 < offsets.size() ? offsets[level-1] : IndexSize);
|
|
}
|
|
};
|
|
}
|
|
|