feat: setup GopTransform
This commit is contained in:
23
src/OpDefs/CMakeLists.txt
Normal file
23
src/OpDefs/CMakeLists.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
|
||||
project(enzoOps1)
|
||||
|
||||
find_package(Boost REQUIRED)
|
||||
# eigen (math)
|
||||
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
|
||||
|
||||
set(libName enzoOps1)
|
||||
add_library(${libName} SHARED
|
||||
main.cpp
|
||||
../Engine/Operator/OperatorTable.cpp
|
||||
../Engine/Operator/GeometryOpDef.cpp
|
||||
../Engine/Operator/Geometry.cpp
|
||||
../Engine/Operator/Attribute.cpp
|
||||
../Engine/Network/NetworkManager.cpp
|
||||
)
|
||||
target_link_libraries(${libName} PRIVATE Qt6::Core Qt6::Widgets Qt6::SvgWidgets Qt6::OpenGLWidgets glm::glm Eigen3::Eigen TBB::tbb)
|
||||
|
||||
|
||||
MESSAGE("CURRENT SOURCE DIR" ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(${libName} PUBLIC ../)
|
||||
target_include_directories(${libName} PUBLIC .)
|
||||
15
src/OpDefs/GopTransform.hpp
Normal file
15
src/OpDefs/GopTransform.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include "Engine/Operator/GeometryOpDef.h"
|
||||
|
||||
class GopTransform
|
||||
: public enzo::nt::GeometryOpDef
|
||||
{
|
||||
public:
|
||||
GopTransform(enzo::nt::OpId opId);
|
||||
virtual void cookOp();
|
||||
static enzo::nt::GeometryOpDef* ctor(enzo::nt::OpId opId)
|
||||
{
|
||||
return new GopTransform(opId);
|
||||
}
|
||||
|
||||
};
|
||||
56
src/OpDefs/main.cpp
Normal file
56
src/OpDefs/main.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "Engine/Operator/OperatorTable.h"
|
||||
#include "OpDefs/GopTransform.hpp"
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/dll.hpp>
|
||||
#include <string>
|
||||
#include "Engine/Operator/AttributeHandle.h"
|
||||
#include <iostream>
|
||||
|
||||
extern "C"
|
||||
{ BOOST_SYMBOL_EXPORT std::string myVar = "hello world";
|
||||
BOOST_SYMBOL_EXPORT void newSopOperator(enzo::op::OperatorTable* table)
|
||||
{
|
||||
table->addOperator(
|
||||
&GopTransform::ctor
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GopTransform::GopTransform(enzo::nt::OpId opId)
|
||||
: enzo::nt::GeometryOpDef(opId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GopTransform::cookOp()
|
||||
{
|
||||
using namespace enzo;
|
||||
|
||||
if(outputRequested(0))
|
||||
{
|
||||
// copy input geometry
|
||||
geo::Geometry geo = cloneInputGeo(0);
|
||||
|
||||
// ----
|
||||
// create geometry start
|
||||
// ----
|
||||
auto PAttr = geo.getAttribByName(ga::AttrOwner::POINT, "P");
|
||||
ga::AttributeHandleVector3 PAttrHandle(PAttr);
|
||||
|
||||
for(int i=0; i<PAttrHandle.getAllValues().size(); ++i)
|
||||
{
|
||||
enzo::bt::Vector3 vector = PAttrHandle.getValue(i);
|
||||
vector.y()+=2.5;
|
||||
PAttrHandle.setValue(i, vector);
|
||||
}
|
||||
// ----
|
||||
|
||||
|
||||
|
||||
// set output geometry
|
||||
setOutputGeometry(0, geo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user