#include "GUI_PolygonNormalShade.h"
using namespace HDK_Sample;
const char *NCD_OPTION = "visNasCd";
{
const int priority = 0;
NCD_OPTION, "Normal Color Override",
}
GUI_PolygonNormalShade::GUI_PolygonNormalShade()
{
}
GUI_PolygonNormalShade::~GUI_PolygonNormalShade()
{
}
{
{
return ph;
}
if(!gt_prm)
{
return ph;
}
bool point_normals = false;
if(gt_prm->getVertexAttributes())
nh = gt_prm->getVertexAttributes()->get("N");
if(!nh)
{
if(gt_prm->getPointAttributes())
nh = gt_prm->getPointAttributes()->get("N");
if(!nh)
{
if(mesh)
nh = mesh->createPointNormals();
}
point_normals = true;
}
if(nh)
{
auto *cd =
for(int i=0; i<nh->entries(); i++)
{
nh->import(i, col.
data(), 3);
cd->getData(i)[0]= col.
x() *0.5 + 0.5;
cd->getData(i)[1]= col.
y() *0.5 + 0.5;
cd->getData(i)[2]= col.
z() *0.5 + 0.5;
}
if(point_normals)
{
gt_prm->getPointAttributes()->addAttribute("Cd", cdh, true);
ah,
mesh->getVertexAttributes(),
mesh->getUniformAttributes(),
mesh->getDetailAttributes());
}
else
{
gt_prm->getVertexAttributes()->addAttribute("Cd", cdh, true);
mesh->getPointAttributes(),
ah,
mesh->getUniformAttributes(),
mesh->getDetailAttributes());
}
}
return ph;
}