curves.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 __CURVES_H__
  17. #define __CURVES_H__
  18. #include "util/util_array.h"
  19. #include "util/util_types.h"
  20. CCL_NAMESPACE_BEGIN
  21. class Device;
  22. class DeviceScene;
  23. class Progress;
  24. class Scene;
  25. void curvebounds(float *lower, float *upper, float3 *p, int dim);
  26. typedef enum CurvePrimitiveType {
  27. CURVE_TRIANGLES = 0,
  28. CURVE_LINE_SEGMENTS = 1,
  29. CURVE_SEGMENTS = 2,
  30. CURVE_RIBBONS = 3,
  31. CURVE_NUM_PRIMITIVE_TYPES,
  32. } CurvePrimitiveType;
  33. typedef enum CurveShapeType {
  34. CURVE_RIBBON = 0,
  35. CURVE_THICK = 1,
  36. CURVE_NUM_SHAPE_TYPES,
  37. } CurveShapeType;
  38. typedef enum CurveTriangleMethod {
  39. CURVE_CAMERA_TRIANGLES,
  40. CURVE_TESSELATED_TRIANGLES
  41. } CurveTriangleMethod;
  42. typedef enum CurveLineMethod {
  43. CURVE_ACCURATE,
  44. CURVE_CORRECTED,
  45. CURVE_UNCORRECTED
  46. } CurveLineMethod;
  47. class ParticleCurveData {
  48. public:
  49. ParticleCurveData();
  50. ~ParticleCurveData();
  51. array<int> psys_firstcurve;
  52. array<int> psys_curvenum;
  53. array<int> psys_shader;
  54. array<float> psys_rootradius;
  55. array<float> psys_tipradius;
  56. array<float> psys_shape;
  57. array<bool> psys_closetip;
  58. array<int> curve_firstkey;
  59. array<int> curve_keynum;
  60. array<float> curve_length;
  61. array<float2> curve_uv;
  62. array<float3> curve_vcol;
  63. array<float3> curvekey_co;
  64. array<float> curvekey_time;
  65. };
  66. /* HairSystem Manager */
  67. class CurveSystemManager {
  68. public:
  69. CurvePrimitiveType primitive;
  70. CurveShapeType curve_shape;
  71. CurveLineMethod line_method;
  72. CurveTriangleMethod triangle_method;
  73. int resolution;
  74. int subdivisions;
  75. bool use_curves;
  76. bool use_encasing;
  77. bool use_backfacing;
  78. bool use_tangent_normal_geometry;
  79. bool need_update;
  80. bool need_mesh_update;
  81. CurveSystemManager();
  82. ~CurveSystemManager();
  83. void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);
  84. void device_free(Device *device, DeviceScene *dscene);
  85. bool modified(const CurveSystemManager &CurveSystemManager);
  86. bool modified_mesh(const CurveSystemManager &CurveSystemManager);
  87. void tag_update(Scene *scene);
  88. void tag_update_mesh();
  89. };
  90. CCL_NAMESPACE_END
  91. #endif /* __CURVES_H__ */