| 6 | namespace embree |
| 7 | { |
| 8 | SubdivPatch1Base::SubdivPatch1Base (const unsigned int gID, |
| 9 | const unsigned int pID, |
| 10 | const unsigned int subPatch, |
| 11 | const SubdivMesh *const mesh, |
| 12 | const size_t time, |
| 13 | const Vec2f uv[4], |
| 14 | const float edge_level[4], |
| 15 | const int subdiv[4], |
| 16 | const int simd_width) |
| 17 | : flags(0), type(INVALID_PATCH), geom(gID), prim(pID), time_(unsigned(time)) |
| 18 | { |
| 19 | static_assert(sizeof(SubdivPatch1Base) == 5 * 64, "SubdivPatch1Base has wrong size"); |
| 20 | |
| 21 | const HalfEdge* edge = mesh->getHalfEdge(0,pID); |
| 22 | |
| 23 | if (edge->patch_type == HalfEdge::BILINEAR_PATCH) |
| 24 | { |
| 25 | type = BILINEAR_PATCH; |
| 26 | new (patch_v) BilinearPatch3fa(edge,mesh->getVertexBuffer(time)); |
| 27 | } |
| 28 | else if (edge->patch_type == HalfEdge::REGULAR_QUAD_PATCH) |
| 29 | { |
| 30 | #if PATCH_USE_BEZIER_PATCH |
| 31 | type = BEZIER_PATCH; |
| 32 | new (patch_v) BezierPatch3fa(BSplinePatch3fa(CatmullClarkPatch3fa(edge,mesh->getVertexBuffer(time)))); |
| 33 | #else |
| 34 | type = BSPLINE_PATCH; |
| 35 | new (patch_v) BSplinePatch3fa(CatmullClarkPatch3fa(edge,mesh->getVertexBuffer(time))); // FIXME: init BSpline directly from half edge structure |
| 36 | #endif |
| 37 | } |
| 38 | #if PATCH_USE_GREGORY == 2 |
| 39 | else if (edge->patch_type == HalfEdge::IRREGULAR_QUAD_PATCH) |
| 40 | { |
| 41 | type = GREGORY_PATCH; |
| 42 | new (patch_v) DenseGregoryPatch3fa(GregoryPatch3fa(CatmullClarkPatch3fa(edge,mesh->getVertexBuffer(time)))); |
| 43 | } |
| 44 | #endif |
| 45 | else |
| 46 | { |
| 47 | type = EVAL_PATCH; |
| 48 | set_edge(mesh->getHalfEdge(0,pID)); |
| 49 | set_subPatch(subPatch); |
| 50 | } |
| 51 | |
| 52 | for (size_t i=0; i<4; i++) { |
| 53 | u[i] = (unsigned short)clamp(uv[i].x * (0x10000/8.0f), 0.0f, float(0xFFFF)); |
nothing calls this directly
no test coverage detected