subd_patch.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_PATCH_H__
  17. #define __SUBD_PATCH_H__
  18. #include "util/util_boundbox.h"
  19. #include "util/util_types.h"
  20. CCL_NAMESPACE_BEGIN
  21. class Patch {
  22. public:
  23. virtual ~Patch()
  24. {
  25. }
  26. virtual void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v) = 0;
  27. virtual BoundBox bound() = 0;
  28. virtual int ptex_face_id()
  29. {
  30. return -1;
  31. }
  32. int patch_index;
  33. int shader;
  34. };
  35. /* Linear Quad Patch */
  36. class LinearQuadPatch : public Patch {
  37. public:
  38. float3 hull[4];
  39. float3 normals[4];
  40. void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v);
  41. BoundBox bound();
  42. };
  43. /* Bicubic Patch */
  44. class BicubicPatch : public Patch {
  45. public:
  46. float3 hull[16];
  47. void eval(float3 *P, float3 *dPdu, float3 *dPdv, float3 *N, float u, float v);
  48. BoundBox bound();
  49. };
  50. CCL_NAMESPACE_END
  51. #endif /* __SUBD_PATCH_H__ */