Enzo
Loading...
Searching...
No Matches
Transform.h
1#pragma once
2
3#include "Engine/Operator/Attribute.h"
4#include "Engine/Types.h"
5
6namespace enzo {
7class Transform {
8 public:
9 Transform(ga::Attribute &attribute, ga::Offset offset) {
10 // Compute 4x4 transform matrix from attributes
11
12 // Use vector attribute as the position in the matrix
13 if (attribute.getType() == ga::AttrType::vectorT) {
14 mat_ = bt::Matrix4::Identity();
15 mat_.col(3).head<3>() = attribute.getVector3(offset);
16
17 // Use matrix types directly
18 } else if (attribute.getType() == ga::AttrType::matrixT) {
19 mat_ = attribute.getMatrix4(offset);
20
21 // Fallback to identity
22 } else {
23 mat_ = bt::Matrix4::Identity();
24 }
25 }
26
27 const bt::Matrix4 &getMatrix() const { return mat_; }
28
29 private:
30 bt::Matrix4 mat_;
31};
32} // namespace enzo
Basic attribute, parameter, and node types for Enzo.
size_t Offset
ga::Offset is the index of an element in a given AttributeOwner.
Definition Types.h:43
Definition Transform.h:7
Containers for geometry data.
AttributeType getType() const
Returns the attribute type this attribute stores.
Definition Attribute.cpp:140