#pragma once #include "BaseMaterialOctreeBuilder.h" #include "../../scene/Material/Color.h" #include "../../scene/Octree/MaterialLibraryMultiRootTree.h" #include "../../scene/Octree/MaterialTree.h" #include "../Comparers.h" #include "../../scene/Material/MaterialQuantizer/BaseQuantizer.h" class MaterialLibraryMultiRootOctreeBuilder : public BaseMaterialOctreeBuilder { public: MaterialLibraryMultiRootOctreeBuilder(BaseQuantizer* quantizer = NULL); ~MaterialLibraryMultiRootOctreeBuilder() override; std::string GetTreeType() override; protected: // Initialize the main tree void InitTree() override; void FinalizeTree() override; // Step to finalize the main tree (for example storing it to a file) void TerminateTree() override; bool IsLimitedColors() const; bool UsePreprocessing() const override; // Initialize the tree for the current pass. void InitCurPassTree(glm::uvec3 coord) override; // Terminate the tree in the current pass. This means it should also be appended to the main tree and deleted void FinalizeCurPassTree(glm::uvec3 coord) override; // Should add a node to the current pass tree at the given coordinate and color void AddNode(const glm::uvec3& coordinate, const Color& color) override; void AddMissingNode(const glm::uvec3& coordinate, const Color& color) override; void PreProcessNode(const glm::uvec3& coordinate, const Color& color) override; void FinalizePreprocessing() override; void CalculateUniqueSceneColors(); std::vector GetOctreeNodesPerLevel() override; std::vector GetNodesPerLevel() override; private: MaterialLibraryMultiRoot* mTree; MaterialTree* mIntermediateTree; bool mQuantizeColors; BaseQuantizer* mQuantizer; std::vector mSceneColors; std::unordered_map mColorReplacers; };