feat: hard face normals per vertex

This commit is contained in:
parker
2025-07-31 21:33:16 +01:00
parent 8a77048ea0
commit 8b7793cc73
5 changed files with 95 additions and 15 deletions

View File

@@ -25,17 +25,31 @@ void GOP_house::cookOp(enzo::op::Context context)
ga::AttributeHandleVector3 PAttrHandle(PAttr);
int startPt = PAttrHandle.getSize();
std::vector<bt::Vector3> pts = {
{-1,-1,-1},{1,-1,-1},{1,-1,1},{-1,-1,1},
{-1,1,-1},{1,1,-1},{1,1,1},{-1,1,1},
{0,2,-1},{0,2,1}
{-1,-1,-1},
{1,-1,-1},
{1,-1,1},
{-1,-1,1},
{-1,1,-1},
{1,1,-1},
{1,1,1},
{-1,1,1},
{0,2,-1},
{0,2,1}
};
for (auto& p : pts) PAttrHandle.addValue(p);
auto pointAttr = geo.getAttribByName(ga::AttrOwner::VERTEX, "point");
ga::AttributeHandleInt pointAttrHandle(pointAttr);
std::vector<std::vector<int>> faces = {
{3,2,6,9,7},{0,1,5,8,4},{0,3,7,4},{1,2,6,5},
{0,1,2,3},{4,7,9},{4,9,8},{5,6,9},{5,9,8}
{7,9,6,2,3},
{4,8,5,1,0},
{4,7,3,0},
{5,6,2,1},
{0,1,2,3},
{9,7,4},
{8,9,4},
{9,6,5},
{8,5,9}
};
for (auto& f : faces) for (int i : f) pointAttrHandle.addValue(startPt + i);