feat: add cgal and viewport smooth normals

This commit is contained in:
parker
2025-07-31 18:19:14 +01:00
parent afd3559a4d
commit 2bdada366b
5 changed files with 112 additions and 9 deletions

View File

@@ -1,10 +1,23 @@
#pragma once
#include "Engine/Operator/Attribute.h"
#include "Engine/Types.h"
#include <CGAL/Surface_mesh/Surface_mesh.h>
#include <CGAL/Simple_cartesian.h>
#include <variant>
namespace enzo::geo
{
using Kernel = CGAL::Simple_cartesian<double>;
using Point = Kernel::Point_3;
using Vector = Kernel::Vector_3;
using HeMesh = CGAL::Surface_mesh<Point>;
using vertexDescriptor = HeMesh::Vertex_index;
using faceDescriptor = HeMesh::Face_index;
using V_index = HeMesh::Vertex_index;
using F_index = HeMesh::Face_index;
class Geometry
{
public:
@@ -12,6 +25,8 @@ public:
ga::AttributeHandle<int> addIntAttribute(ga::AttributeOwner owner, std::string name);
ga::AttributeHandle<bt::Vector3> addVector3Attribute(ga::AttributeOwner owner, std::string name);
std::shared_ptr<ga::Attribute> getAttribByName(ga::AttributeOwner owner, std::string name);
std::vector<bt::Vector3> derivePointNormals();
HeMesh computeHalfEdgeMesh();
private:
using attribVector = std::vector<std::shared_ptr<ga::Attribute>>;
attribVector& getAttributeStore(ga::AttributeOwner& owner);