Repository navigation
Expand file tree
/
Copy pathSIM_PBVisualizeExpanedValues.cpp
More file actions
115 lines (82 loc) · 3.06 KB
/
Copy pathSIM_PBVisualizeExpanedValues.cpp
File metadata and controls
115 lines (82 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
////////////////////////////////////////////////////
// VISUALIZER - STRUCTURE
#include "include.h"
#include "SIM_Pebble.h"
#include "SIM_PBVisualizeExpanedValues.h"
const SIM_DopDescription * SIM_PBVisualizeExpanedValues::getDopDescription()
{
static PRM_Template theTemplates[] = {
PRM_Template()
};
static PRM_Template theGuideTemplates[] = {
PRM_Template(PRM_TOGGLE, 1, &SIMshowguideName, PRMzeroDefaults),
PRM_Template(PRM_RGB, 3, &SIMcolorName, PRMoneDefaults, 0, &PRMunitRange),
PRM_Template(PRM_INT_J, 1, &thePatchName, PRMzeroDefaults, NULL, &thePatchRng),
PRM_Template(PRM_STRING, 1, &theChannelsName, &theChannelsDef),
PRM_Template(PRM_FLT_J, 1, &theUpperName, PRMzeroDefaults, 0, &theUpperRng),
PRM_Template()
};
static SIM_DopDescription theDopDescription(true, "sim_pb_visualize_ev", "Pebble Visualize Expanded Data", "VisualizeEV", classname(), theTemplates);
theDopDescription.setGuideTemplates(theGuideTemplates);
return &theDopDescription;
};
void SIM_PBVisualizeExpanedValues::buildGuideGeometrySubclass(const SIM_RootData & root, const SIM_Options & options, const GU_DetailHandle & gdh, UT_DMatrix4 * xform, const SIM_Time & t) const
{
// Build our template geometry, if we are so asked.
initAlternateRepresentation();
if (!m_pebble) return;
for (const Patch* _pb : m_pebble->m_P) if (_pb == NULL) return;
if (gdh.isNull()) return;
GU_DetailHandleAutoWriteLock gdl(gdh);
GU_Detail *gdp = gdl.getGdp();
UT_Vector3 color = getColor(options);
GA_RWHandleV3 cdh(gdp->findPointAttribute("Cd"));
if (!cdh.isValid())
{
cdh = GA_RWHandleV3(gdp->addFloatTuple(GA_ATTRIB_POINT, "Cd", 3, GA_Defaults(1.0)));
cdh->setTypeInfo(GA_TYPE_COLOR);
};
//const vector<Patch*>& PEBBLE = m_pebble->m_P;
float upper = getUpper(options);
int patch = getPatch(options);
UT_String chan;
getChannels(chan, options);
if (patch < 0) return;
if (patch >= m_pebble->m_P.size()) return;
const Patch& pb = *m_pebble->m_P[patch];
if (pb.chs.find(chan) == -1) return;
Page* P = getExpandedPrimVar(m_pebble->m_P, pb, "P");
//Page* N = getExpandedPrimVar(m_pebble->m_P, pb, "N");
//Page* DPDU = new Page(pb.dim[0] + 2, pb.dim[1] + 2, true);
//Page* DPDV = new Page(pb.dim[0] + 2, pb.dim[1] + 2, true);
//getExpandedPrimVarDiv(m_pebble->m_P, pb, DPDU, DPDV);
//Page* V = getExpandedPrimVarProjected(m_pebble->m_P, pb, chan);
// FRAME
for (int i = 0; i < pb.dim[0]+2; i++)
for (int j = 0; j < pb.dim[1]+2; j++)
{
//UT_Vector3 n = N->get(i, j);
//UT_Vector3 dpdu = DPDU->get(i, j);
//UT_Vector3 dpdv = DPDV->get(i, j);
UT_Vector3 p = P->get(i, j);
//UT_Vector3 v = V->get(i, j);
//GEO_PrimPoly* PPN = GEO_PrimPoly::build(gdp, 2, true, false);
GA_Offset pt = gdp->appendPointBlock(1);
//p += upper*n;
gdp->setPos3(pt, p);
cdh.set(pt, UT_Vector3(0, 0, 1));
//PPN->setPointOffset(0, pt);
pt++;
//p += v[0] * dpdu + v[1] * dpdv;
//p += dpdu;
//p += dpdv;
//gdp->setPos3(pt, p);
//cdh.set(pt, UT_Vector3(0, 0.5, 1));
//PPN->setPointOffset(1, pt);
};
delete P;
//delete DPDU;
//delete DPDV;
//delete N;
//delete V;
};