| 64 | } |
| 65 | |
| 66 | bool eval(Ref This, const float& u, const float& v, const float dscale, const size_t depth) |
| 67 | { |
| 68 | if (!This) return false; |
| 69 | //PRINT(depth); |
| 70 | //PRINT2(u,v); |
| 71 | |
| 72 | switch (This.type()) |
| 73 | { |
| 74 | case Patch::BILINEAR_PATCH: { |
| 75 | //PRINT("bilinear"); |
| 76 | ((typename Patch::BilinearPatch*)This.object())->patch.eval(u,v,P,dPdu,dPdv,ddPdudu,ddPdvdv,ddPdudv,dscale); |
| 77 | PATCH_DEBUG_SUBDIVISION(This,-1,c,c); |
| 78 | return true; |
| 79 | } |
| 80 | case Patch::BSPLINE_PATCH: { |
| 81 | //PRINT("bspline"); |
| 82 | ((typename Patch::BSplinePatch*)This.object())->patch.eval(u,v,P,dPdu,dPdv,ddPdudu,ddPdvdv,ddPdudv,dscale); |
| 83 | PATCH_DEBUG_SUBDIVISION(This,-1,c,-1); |
| 84 | return true; |
| 85 | } |
| 86 | case Patch::BEZIER_PATCH: { |
| 87 | //PRINT("bezier"); |
| 88 | ((typename Patch::BezierPatch*)This.object())->patch.eval(u,v,P,dPdu,dPdv,ddPdudu,ddPdvdv,ddPdudv,dscale); |
| 89 | PATCH_DEBUG_SUBDIVISION(This,-1,c,-1); |
| 90 | return true; |
| 91 | } |
| 92 | case Patch::GREGORY_PATCH: { |
| 93 | //PRINT("gregory"); |
| 94 | ((typename Patch::GregoryPatch*)This.object())->patch.eval(u,v,P,dPdu,dPdv,ddPdudu,ddPdvdv,ddPdudv,dscale); |
| 95 | PATCH_DEBUG_SUBDIVISION(This,-1,-1,c); |
| 96 | return true; |
| 97 | } |
| 98 | case Patch::SUBDIVIDED_QUAD_PATCH: { |
| 99 | //PRINT("subdivided quad"); |
| 100 | return eval_quad(((typename Patch::SubdividedQuadPatch*)This.object()),u,v,dscale,depth); |
| 101 | } |
| 102 | case Patch::SUBDIVIDED_GENERAL_PATCH: { |
| 103 | //PRINT("general_patch"); |
| 104 | assert(dscale == 1.0f); |
| 105 | return eval_general(((typename Patch::SubdividedGeneralPatch*)This.object()),u,v,depth); |
| 106 | } |
| 107 | case Patch::EVAL_PATCH: { |
| 108 | //PRINT("eval_patch"); |
| 109 | CatmullClarkPatch patch; patch.deserialize(This.object()); |
| 110 | FeatureAdaptiveEval<Vertex,Vertex_t>(patch,u,v,dscale,depth,P,dPdu,dPdv,ddPdudu,ddPdvdv,ddPdudv); |
| 111 | return true; |
| 112 | } |
| 113 | default: |
| 114 | assert(false); |
| 115 | return false; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | private: |
| 120 | Vertex* const P; |
no test coverage detected