subd_split.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2011-2013 Blender Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef __SUBD_SPLIT_H__
  17. #define __SUBD_SPLIT_H__
  18. /* DiagSplit: Parallel, Crack-free, Adaptive Tessellation for Micropolygon Rendering
  19. * Splits up patches and determines edge tessellation factors for dicing. Patch
  20. * evaluation at arbitrary points is required for this to work. See the paper
  21. * for more details. */
  22. #include "subd/subd_dice.h"
  23. #include "util/util_types.h"
  24. #include "util/util_vector.h"
  25. CCL_NAMESPACE_BEGIN
  26. class Mesh;
  27. class Patch;
  28. #define DSPLIT_NON_UNIFORM -1
  29. class DiagSplit {
  30. public:
  31. vector<QuadDice::SubPatch> subpatches_quad;
  32. vector<QuadDice::EdgeFactors> edgefactors_quad;
  33. SubdParams params;
  34. explicit DiagSplit(const SubdParams &params);
  35. float3 to_world(Patch *patch, float2 uv);
  36. int T(Patch *patch, float2 Pstart, float2 Pend);
  37. void partition_edge(
  38. Patch *patch, float2 *P, int *t0, int *t1, float2 Pstart, float2 Pend, int t);
  39. void dispatch(QuadDice::SubPatch &sub, QuadDice::EdgeFactors &ef);
  40. void split(QuadDice::SubPatch &sub, QuadDice::EdgeFactors &ef, int depth = 0);
  41. void split_quad(Patch *patch, QuadDice::SubPatch *subpatch = NULL);
  42. };
  43. CCL_NAMESPACE_END
  44. #endif /* __SUBD_SPLIT_H__ */