refactoring
Some checks failed
Build Potree Converter / Build iOS (pull_request) Failing after 16s
Build Potree Converter / Build desktop (mac_arm) (pull_request) Successful in 18s
Build Potree Converter / Build desktop (ubuntu-act_cpp-24.04) (pull_request) Successful in 19s
Build Potree Converter / Build desktop (windows_x64) (pull_request) Successful in 46s

This commit is contained in:
2025-02-24 15:06:18 +02:00
parent ad10822935
commit e29873b70f

View File

@@ -6,24 +6,28 @@
#include <unordered_map>
#include <iostream>
#include <vector>
#include <array>
#include <string_view>
namespace Potree
{
enum class AttributeType {
INT8 = 0,
INT16 = 1,
INT32 = 2,
INT64 = 3,
INT8,
INT16,
INT32,
INT64,
UINT8,
UINT16,
UINT32,
UINT64,
FLOAT,
DOUBLE,
UNDEFINED
};
UINT8 = 10,
UINT16 = 11,
UINT32 = 12,
UINT64 = 13,
FLOAT = 20,
DOUBLE = 21,
UNDEFINED = 123456,
constexpr std::array<std::string_view, static_cast<int>(AttributeType::UNDEFINED) + 1> typenameMapping =
{
"int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "float", "double", "undefined"
};
inline int getAttributeTypeSize(AttributeType type) {
@@ -44,44 +48,9 @@ namespace Potree
return mapping[type];
}
inline std::string getAttributeTypename(AttributeType type) {
if (type == AttributeType::INT8) {
return "int8";
}
else if (type == AttributeType::INT16) {
return "int16";
}
else if (type == AttributeType::INT32) {
return "int32";
}
else if (type == AttributeType::INT64) {
return "int64";
}
else if (type == AttributeType::UINT8) {
return "uint8";
}
else if (type == AttributeType::UINT16) {
return "uint16";
}
else if (type == AttributeType::UINT32) {
return "uint32";
}
else if (type == AttributeType::UINT64) {
return "uint64";
}
else if (type == AttributeType::FLOAT) {
return "float";
}
else if (type == AttributeType::DOUBLE) {
return "double";
}
else if (type == AttributeType::UNDEFINED) {
return "undefined";
}
else {
return "error";
}
inline std::string getAttributeTypename(AttributeType type)
{
return std::string(typenameMapping[static_cast<int>(type)]);
}
inline AttributeType typenameToType(const std::string& name) {
@@ -133,11 +102,11 @@ namespace Potree
AttributeType type = AttributeType::UNDEFINED;
// TODO: should be type-dependent, not always double. won't work properly with 64 bit integers
Potree::Vector3 min = { Infinity };
Potree::Vector3 max = { -Infinity };
Vector3 min = { Infinity };
Vector3 max = { -Infinity };
Potree::Vector3 scale = { 1.0, 1.0, 1.0 };
Potree::Vector3 offset = { 0.0, 0.0, 0.0 };
Vector3 scale = { 1.0, 1.0, 1.0 };
Vector3 offset = { 0.0, 0.0, 0.0 };
// histogram that counts occurances of points with same attribute value.
// only for 1 byte types, due to storage size