subd_patch_table.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 2011-2016 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_PATCH_TABLE_H__
  17. #define __SUBD_PATCH_TABLE_H__
  18. #include "util/util_array.h"
  19. #include "util/util_types.h"
  20. #ifdef WITH_OPENSUBDIV
  21. # ifdef _MSC_VER
  22. # include "iso646.h"
  23. # endif
  24. # include <opensubdiv/far/patchTable.h>
  25. #endif
  26. CCL_NAMESPACE_BEGIN
  27. #ifdef WITH_OPENSUBDIV
  28. using namespace OpenSubdiv;
  29. #else
  30. /* forward declare for when OpenSubdiv is unavailable */
  31. namespace Far {
  32. struct PatchTable;
  33. }
  34. #endif
  35. #define PATCH_ARRAY_SIZE 4
  36. #define PATCH_PARAM_SIZE 2
  37. #define PATCH_HANDLE_SIZE 3
  38. #define PATCH_NODE_SIZE 1
  39. struct PackedPatchTable {
  40. array<uint> table;
  41. size_t num_arrays;
  42. size_t num_indices;
  43. size_t num_patches;
  44. size_t num_nodes;
  45. /* calculated size from num_* members */
  46. size_t total_size();
  47. void pack(Far::PatchTable *patch_table, int offset = 0);
  48. void copy_adjusting_offsets(uint *dest, int doffset);
  49. };
  50. CCL_NAMESPACE_END
  51. #endif /* __SUBD_PATCH_TABLE_H__ */