home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / include / k3d / k3dsdk / nurbs_patch.h < prev    next >
C/C++ Source or Header  |  2009-02-16  |  7KB  |  197 lines

  1. #ifndef K3DSDK_NURBS_PATCH_H
  2. #define K3DSDK_NURBS_PATCH_H
  3.  
  4. // K-3D
  5. // Copyright (c) 1995-2008, Timothy M. Shead
  6. //
  7. // Contact: tshead@k-3d.com
  8. //
  9. // This program is free software; you can redistribute it and/or
  10. // modify it under the terms of the GNU General Public
  11. // License as published by the Free Software Foundation; either
  12. // version 2 of the License, or (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. // General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public
  20. // License along with this program; if not, write to the Free Software
  21. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  22.  
  23. #include "mesh.h"
  24.  
  25. namespace k3d
  26. {
  27.  
  28. namespace nurbs_patch
  29. {
  30.  
  31. /// Gathers the member arrays of a nurbs_patch primitive into a convenient package
  32. class const_primitive
  33. {
  34. public:
  35.     const_primitive(
  36.         const mesh::indices_t& PatchFirstPoints,
  37.         const mesh::counts_t& PatchUPointCounts,
  38.         const mesh::counts_t& PatchVPointCounts,
  39.         const mesh::orders_t& PatchUOrders,
  40.         const mesh::orders_t& PatchVOrders,
  41.         const mesh::indices_t& PatchUFirstKnots,
  42.         const mesh::indices_t& PatchVFirstKnots,
  43.         const mesh::selection_t& PatchSelections,
  44.         const mesh::materials_t& PatchMaterials,
  45.         const mesh::indices_t& PatchPoints,
  46.         const mesh::weights_t& PatchPointWeights,
  47.         const mesh::knots_t& PatchUKnots,
  48.         const mesh::knots_t& PatchVKnots,
  49.         const mesh::counts_t& PatchTrimLoopCounts,
  50.         const mesh::indices_t& PatchFirstTrimLoops,
  51.         const mesh::indices_t& TrimLoopFirstCurves,
  52.         const mesh::counts_t& TrimLoopCurveCounts,
  53.         const mesh::selection_t& TrimLoopSelections,
  54.         const mesh::indices_t& CurveFirstPoints,
  55.         const mesh::counts_t& CurvePointCounts,
  56.         const mesh::orders_t& CurveOrders,
  57.         const mesh::indices_t& CurveFirstKnots,
  58.         const mesh::selection_t& CurveSelections,
  59.         const mesh::indices_t& CurvePoints,
  60.         const mesh::weights_t& CurvePointWeights,
  61.         const mesh::knots_t& CurveKnots,
  62.         const mesh::points_2d_t& Points,
  63.         const mesh::selection_t& PointSelections,
  64.         const mesh::attribute_arrays_t& ConstantData,
  65.         const mesh::attribute_arrays_t& UniformData,
  66.         const mesh::attribute_arrays_t& VaryingData
  67.         );
  68.  
  69.     const mesh::indices_t& patch_first_points;
  70.     const mesh::counts_t& patch_u_point_counts;
  71.     const mesh::counts_t& patch_v_point_counts;
  72.     const mesh::orders_t& patch_u_orders;
  73.     const mesh::orders_t& patch_v_orders;
  74.     const mesh::indices_t& patch_u_first_knots;
  75.     const mesh::indices_t& patch_v_first_knots;
  76.     const mesh::selection_t& patch_selections;
  77.     const mesh::materials_t& patch_materials;
  78.     const mesh::indices_t& patch_points;
  79.     const mesh::weights_t& patch_point_weights;
  80.     const mesh::knots_t& patch_u_knots;
  81.     const mesh::knots_t& patch_v_knots;
  82.     const mesh::counts_t& patch_trim_loop_counts;
  83.     const mesh::indices_t& patch_first_trim_loops;
  84.     const mesh::indices_t& trim_loop_first_curves;
  85.     const mesh::counts_t& trim_loop_curve_counts;
  86.     const mesh::selection_t& trim_loop_selections;
  87.     const mesh::indices_t& curve_first_points;
  88.     const mesh::counts_t& curve_point_counts;
  89.     const mesh::orders_t& curve_orders;
  90.     const mesh::indices_t& curve_first_knots;
  91.     const mesh::selection_t& curve_selections;
  92.     const mesh::indices_t& curve_points;
  93.     const mesh::weights_t& curve_point_weights;
  94.     const mesh::knots_t& curve_knots;
  95.     const mesh::points_2d_t& points;
  96.     const mesh::selection_t& point_selections;
  97.     const mesh::attribute_arrays_t& constant_data;
  98.     const mesh::attribute_arrays_t& uniform_data;
  99.     const mesh::attribute_arrays_t& varying_data;
  100. };
  101.  
  102. /// Gathers the member arrays of a nurbs_patch primitive into a convenient package
  103. class primitive
  104. {
  105. public:
  106.     primitive(
  107.         mesh::indices_t& PatchFirstPoints,
  108.         mesh::counts_t& PatchUPointCounts,
  109.         mesh::counts_t& PatchVPointCounts,
  110.         mesh::orders_t& PatchUOrders,
  111.         mesh::orders_t& PatchVOrders,
  112.         mesh::indices_t& PatchUFirstKnots,
  113.         mesh::indices_t& PatchVFirstKnots,
  114.         mesh::selection_t& PatchSelections,
  115.         mesh::materials_t& PatchMaterials,
  116.         mesh::indices_t& PatchPoints,
  117.         mesh::weights_t& PatchPointWeights,
  118.         mesh::knots_t& PatchUKnots,
  119.         mesh::knots_t& PatchVKnots,
  120.         mesh::counts_t& PatchTrimLoopCounts,
  121.         mesh::indices_t& PatchFirstTrimLoops,
  122.         mesh::indices_t& TrimLoopFirstCurves,
  123.         mesh::counts_t& TrimLoopCurveCounts,
  124.         mesh::selection_t& TrimLoopSelections,
  125.         mesh::indices_t& CurveFirstPoints,
  126.         mesh::counts_t& CurvePointCounts,
  127.         mesh::orders_t& CurveOrders,
  128.         mesh::indices_t& CurveFirstKnots,
  129.         mesh::selection_t& CurveSelections,
  130.         mesh::indices_t& CurvePoints,
  131.         mesh::weights_t& CurvePointWeights,
  132.         mesh::knots_t& CurveKnots,
  133.         mesh::points_2d_t& Points,
  134.         mesh::selection_t& PointSelections,
  135.         mesh::attribute_arrays_t& ConstantData,
  136.         mesh::attribute_arrays_t& UniformData,
  137.         mesh::attribute_arrays_t& VaryingData
  138.         );
  139.  
  140.     mesh::indices_t& patch_first_points;
  141.     mesh::counts_t& patch_u_point_counts;
  142.     mesh::counts_t& patch_v_point_counts;
  143.     mesh::orders_t& patch_u_orders;
  144.     mesh::orders_t& patch_v_orders;
  145.     mesh::indices_t& patch_u_first_knots;
  146.     mesh::indices_t& patch_v_first_knots;
  147.     mesh::selection_t& patch_selections;
  148.     mesh::materials_t& patch_materials;
  149.     mesh::indices_t& patch_points;
  150.     mesh::weights_t& patch_point_weights;
  151.     mesh::knots_t& patch_u_knots;
  152.     mesh::knots_t& patch_v_knots;
  153.     mesh::counts_t& patch_trim_loop_counts;
  154.     mesh::indices_t& patch_first_trim_loops;
  155.     mesh::indices_t& trim_loop_first_curves;
  156.     mesh::counts_t& trim_loop_curve_counts;
  157.     mesh::selection_t& trim_loop_selections;
  158.     mesh::indices_t& curve_first_points;
  159.     mesh::counts_t& curve_point_counts;
  160.     mesh::orders_t& curve_orders;
  161.     mesh::indices_t& curve_first_knots;
  162.     mesh::selection_t& curve_selections;
  163.     mesh::indices_t& curve_points;
  164.     mesh::weights_t& curve_point_weights;
  165.     mesh::knots_t& curve_knots;
  166.     mesh::points_2d_t& points;
  167.     mesh::selection_t& point_selections;
  168.     mesh::attribute_arrays_t& constant_data;
  169.     mesh::attribute_arrays_t& uniform_data;
  170.     mesh::attribute_arrays_t& varying_data;
  171. };
  172.  
  173. /// Creates a new nurbs_patch mesh primitive, returning references to its member arrays.
  174. /// The caller is responsible for the lifetime of the returned object.
  175. primitive* create(mesh& Mesh);
  176.  
  177. /** \deprecated This method exists for the sole purpose of easing the transition to generic primitives. */
  178. const_primitive* validate(const mesh& Mesh);
  179. /** \deprecated This method exists for the sole purpose of easing the transition to generic primitives. */
  180. primitive* validate(mesh& Mesh);
  181.  
  182. /*
  183. /// Tests the given mesh primitive to see if it is a valid nurbs_patch primitive, returning references to its member arrays, or NULL.
  184. /// The caller is responsible for the lifetime of the returned object.
  185. const_primitive* validate(const mesh::primitive& GenericPrimitive);
  186. /// Tests the given mesh primitive to see if it is a valid nurbs_patch primitive, returning references to its member arrays, or NULL.
  187. /// The caller is responsible for the lifetime of the returned object.
  188. primitive* validate(mesh::primitive& GenericPrimitive);
  189. */
  190.  
  191. } // namespace nurbs_patch
  192.  
  193. } // namespace k3d
  194.  
  195. #endif // !K3DSDK_NURBS_PATCH_H
  196.  
  197.