MCPcopy Create free account
hub / github.com/RenderKit/embree / eval

Method eval

kernels/subdiv/patch_eval_grid.h:122–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 }
121
122 bool eval(Ref This, const BBox2f& srange, const BBox2f& erange, const unsigned depth)
123 {
124 if (erange.empty())
125 return true;
126
127 const int lx0 = (int) ceilf(erange.lower.x);
128 const int lx1 = (int) ceilf(erange.upper.x) + (erange.upper.x == x1 && (srange.lower.x < erange.upper.x || erange.upper.x == 0));
129 const int ly0 = (int) ceilf(erange.lower.y);
130 const int ly1 = (int) ceilf(erange.upper.y) + (erange.upper.y == y1 && (srange.lower.y < erange.upper.y || erange.upper.y == 0));
131 if (lx0 >= lx1 || ly0 >= ly1)
132 return true;
133
134 if (!This)
135 return false;
136
137 switch (This.type())
138 {
139 case Patch::BILINEAR_PATCH: {
140 evalLocalGrid((Patch::BilinearPatch*)This.object(),srange,lx0,lx1,ly0,ly1);
141 return true;
142 }
143 case Patch::BSPLINE_PATCH: {
144 evalLocalGrid((Patch::BSplinePatch*)This.object(),srange,lx0,lx1,ly0,ly1);
145 return true;
146 }
147 case Patch::BEZIER_PATCH: {
148 evalLocalGrid((Patch::BezierPatch*)This.object(),srange,lx0,lx1,ly0,ly1);
149 return true;
150 }
151 case Patch::GREGORY_PATCH: {
152 evalLocalGrid((Patch::GregoryPatch*)This.object(),srange,lx0,lx1,ly0,ly1);
153 return true;
154 }
155 case Patch::SUBDIVIDED_QUAD_PATCH:
156 {
157 const Vec2f c = srange.center();
158 const BBox2f srange0(srange.lower,c);
159 const BBox2f srange1(Vec2f(c.x,srange.lower.y),Vec2f(srange.upper.x,c.y));
160 const BBox2f srange2(c,srange.upper);
161 const BBox2f srange3(Vec2f(srange.lower.x,c.y),Vec2f(c.x,srange.upper.y));
162
163 Patch::SubdividedQuadPatch* patch = (Patch::SubdividedQuadPatch*)This.object();
164 eval(patch->child[0],srange0,intersect(srange0,erange),depth+1);
165 eval(patch->child[1],srange1,intersect(srange1,erange),depth+1);
166 eval(patch->child[2],srange2,intersect(srange2,erange),depth+1);
167 eval(patch->child[3],srange3,intersect(srange3,erange),depth+1);
168 return true;
169 }
170 case Patch::EVAL_PATCH: {
171 CatmullClarkPatch patch; patch.deserialize(This.object());
172 FeatureAdaptiveEvalGrid(patch,srange,erange,depth,x0,x1,y0,y1,swidth,sheight,Px,Py,Pz,U,V,Nx,Ny,Nz,dwidth,dheight);
173 count += (lx1-lx0)*(ly1-ly0);
174 return true;
175 }
176 default:
177 assert(false);
178 return false;
179 }

Callers 1

evalLocalGridMethod · 0.45

Calls 7

objectMethod · 0.80
evalFunction · 0.70
intersectFunction · 0.50
emptyMethod · 0.45
typeMethod · 0.45
centerMethod · 0.45

Tested by

no test coverage detected