47 lines
1.6 KiB
C++
47 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#ifndef GLM_FORCE_RADIANS
|
|
#define GLM_FORCE_RADIANS
|
|
#endif
|
|
#include <vector>
|
|
#include "../../inc/glm/glm.hpp"
|
|
#include "../../core/Defines.h"
|
|
#include "../Hashers.h"
|
|
#include "../Util/TransferFunction.h"
|
|
|
|
#include "BaseVoxelizer.h"
|
|
|
|
class PVMVoxelizer : public BaseVoxelizer
|
|
{
|
|
public:
|
|
PVMVoxelizer();
|
|
virtual ~PVMVoxelizer() override;
|
|
|
|
bool Initialize() override;
|
|
bool LoadScene(const std::string& sceneFileName) override;
|
|
bool UnloadScene() override;
|
|
|
|
std::vector<glm::uvec3> GetValidCoords(unsigned8 scale) override;
|
|
void Voxelize(unsigned8 scale, unsigned8 partScale, glm::uvec3 partCoord, const std::function<void(const VoxelInfo&, bool best)>& nodeAdder,
|
|
bool colors = true, bool normals = true, bool reflectivity = true) override;
|
|
// Keep other voxelize overloads from the base
|
|
using BaseVoxelizer::Voxelize;
|
|
|
|
protected:
|
|
private:
|
|
static void ReadVolumeData(const std::string& filename, unsigned32& width, unsigned32& height, unsigned32& depth, unsigned32& components, std::vector<unsigned8>& data);
|
|
|
|
// Voxelize overload that allows for custom filters. Default is average.
|
|
void Voxelize(unsigned8 scale, unsigned8 partScale, glm::uvec3 partCoord,
|
|
const std::function<void(const VoxelInfo&, bool best)>& nodeAdder,
|
|
const std::function<float(const std::vector<float> values)>& opacityFilter,
|
|
const std::function<glm::u8vec3(const std::vector<glm::u8vec3>, const std::vector<float>)>& colorFilter);
|
|
|
|
unsigned32 mWidth, mHeight, mDepth, mComponents;
|
|
unsigned8 mScale;
|
|
std::vector<unsigned8> mVolume;
|
|
TransferFunction<glm::u8vec3> mTransferFunction;
|
|
float mMinOpacity;
|
|
};
|
|
|