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

Function patch_eval_subdivision

kernels/subdiv/patch_eval_grid.h:209–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207
208 template<typename Tessellator>
209 inline void patch_eval_subdivision (const HalfEdge* h, Tessellator tessellator)
210 {
211 const unsigned N = h->numEdges();
212 int neighborSubdiv[GeneralCatmullClarkPatch3fa::SIZE]; // FIXME: use array_t
213 float levels[GeneralCatmullClarkPatch3fa::SIZE];
214 for (unsigned i=0; i<N; i++) {
215 assert(i<GeneralCatmullClarkPatch3fa::SIZE);
216 neighborSubdiv[i] = h->hasOpposite() ? h->opposite()->numEdges() != 4 : 0;
217 levels[i] = h->edge_level;
218 h = h->next();
219 }
220 if (N == 4)
221 {
222 const Vec2f uv[4] = { Vec2f(0.0f,0.0f), Vec2f(1.0f,0.0f), Vec2f(1.0f,1.0f), Vec2f(0.0f,1.0f) };
223 tessellator(uv,neighborSubdiv,levels,0);
224 }
225 else
226 {
227 for (unsigned i=0; i<N; i++)
228 {
229 assert(i<MAX_PATCH_VALENCE);
230 static_assert(MAX_PATCH_VALENCE <= 16, "MAX_PATCH_VALENCE > 16");
231 const int h = (i >> 2) & 3, l = i & 3;
232 const Vec2f subPatchID((float)l,(float)h);
233 const Vec2f uv[4] = { 2.0f*subPatchID + (0.5f+Vec2f(0.0f,0.0f)),
234 2.0f*subPatchID + (0.5f+Vec2f(1.0f,0.0f)),
235 2.0f*subPatchID + (0.5f+Vec2f(1.0f,1.0f)),
236 2.0f*subPatchID + (0.5f+Vec2f(0.0f,1.0f)) };
237 const int neighborSubdiv1[4] = { 0,0,0,0 };
238 const float levels1[4] = { 0.5f*levels[(i+0)%N], 0.5f*levels[(i+0)%N], 0.5f*levels[(i+N-1)%N], 0.5f*levels[(i+N-1)%N] };
239 tessellator(uv,neighborSubdiv1,levels1,i);
240 }
241 }
242 }
243 }
244}
245

Callers 2

buildMethod · 0.85
rebuildMethod · 0.85

Calls 2

numEdgesMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected