29 lines
1.5 KiB
C++
29 lines
1.5 KiB
C++
#pragma once
|
|
#include <functional>
|
|
#include <vector>
|
|
#include "../../inc/glm/glm.hpp"
|
|
#include "../Defines.h"
|
|
#include "VoxelInfo.h"
|
|
|
|
class BaseVoxelizer
|
|
{
|
|
public:
|
|
virtual ~BaseVoxelizer() {}
|
|
|
|
// Should be called before using the octreebuilder. This method initialize the parts of the voxelizer that are not dependent on the scene.
|
|
virtual bool Initialize() = 0;
|
|
|
|
// Loads the scene at the given filename
|
|
virtual bool LoadScene(const std::string& filename) = 0;
|
|
// Unloads the currently loaded scene (freeing up memory)
|
|
virtual bool UnloadScene() = 0;
|
|
// Returns all coordinates that should be voxelized at a certain scale.
|
|
virtual std::vector<glm::uvec3> GetValidCoords(unsigned8 scale) = 0;
|
|
// Voxelizes the currently loaded scene at the given scale. Scale is given as the log_2 of the resolution (e.g. for 1024x1024x1024 use scale = 10).
|
|
// Overload can be used to voxelize a certain subsection of the scene.
|
|
// For each filled voxel that is found, the node adder is called. The boolean in the nodeadder is
|
|
// used as certain voxelizers can give multiple colors for the same voxels. The "best" boolean can then be used to indicate if this is the best color for a voxel.
|
|
virtual 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) = 0;
|
|
virtual void Voxelize(unsigned8 scale, const std::function<void(const VoxelInfo&, bool best)>& nodeAdder) { Voxelize(scale, scale, glm::uvec3(0), nodeAdder); }
|
|
}; |