feat: add eigen vector type
This commit is contained in:
@@ -19,6 +19,9 @@ ga::Attribute::Attribute(std::string name, ga::AttributeType type)
|
||||
case(AttrType::floatT):
|
||||
floatStore_=std::make_shared<std::vector<float>>();
|
||||
break;
|
||||
case(AttrType::vectorT):
|
||||
vector3Store_=std::make_shared<std::vector<enzo::bt::Vector3>>();
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("Type " + std::to_string(static_cast<int>(type_)) + " was not properly accounted for");
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace enzo{
|
||||
// data stores
|
||||
std::shared_ptr<std::vector<int>> intStore_;
|
||||
std::shared_ptr<std::vector<float>> floatStore_;
|
||||
std::shared_ptr<std::vector<enzo::bt::Vector3>> vector3Store_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include "Engine/Operator/Attribute.h"
|
||||
#include "Engine/Types.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -23,14 +24,24 @@ public:
|
||||
// get attribute data pointer
|
||||
// TODO: check types match
|
||||
// TODO: add the other types
|
||||
|
||||
// int
|
||||
if constexpr (std::is_same<int, T>::value)
|
||||
{
|
||||
data_=attribute->intStore_;
|
||||
}
|
||||
|
||||
// float
|
||||
else if constexpr (std::is_same<float, T>::value)
|
||||
{
|
||||
data_=attribute->floatStore_;
|
||||
}
|
||||
|
||||
// vector 3
|
||||
else if constexpr (std::is_same<enzo::bt::Vector3, T>::value)
|
||||
{
|
||||
data_=attribute->vector3Store_;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("Type " + std::to_string(static_cast<int>(type_)) + " was not properly accounted for");
|
||||
@@ -75,5 +86,6 @@ private:
|
||||
|
||||
using AttributeHandleInt = AttributeHandle<int>;
|
||||
using AttributeHandleFloat = AttributeHandle<float>;
|
||||
using AttributeHandleVector3 = AttributeHandle<enzo::bt::Vector3>;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user