home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / include / k3d / k3dsdk / bezier_triangle_patch.h < prev    next >
C/C++ Source or Header  |  2008-12-22  |  4KB  |  106 lines

  1. #ifndef K3DSDK_BEZIER_TRIANGLE_PATCH_H
  2. #define K3DSDK_BEZIER_TRIANGLE_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. /** \file
  24.         \author Ashish Myles (marcianx@gmail.com)
  25. */
  26.  
  27. #include "mesh.h"
  28.  
  29. namespace k3d
  30. {
  31.  
  32. namespace bezier_triangle_patch
  33. {
  34.  
  35. /// Gathers the member arrays of a bezier_triangle_patch primitive into a convenient package
  36. class const_primitive
  37. {
  38. public:
  39.     const_primitive(
  40.         const mesh::indices_t& PatchFirstPoints,
  41.         const mesh::orders_t& PatchOrders,
  42.         const mesh::selection_t& PatchSelections,
  43.         const mesh::materials_t& PatchMaterials,
  44.         const mesh::indices_t& PatchPoints,
  45.         const mesh::weights_t& PatchPointWeights,
  46.         const mesh::attribute_arrays_t& ConstantData,
  47.         const mesh::attribute_arrays_t& UniformData,
  48.         const mesh::attribute_arrays_t& VaryingData
  49.         );
  50.  
  51.     const mesh::indices_t& patch_first_points;
  52.     const mesh::orders_t& patch_orders;
  53.     const mesh::selection_t& patch_selections;
  54.     const mesh::materials_t& patch_materials;
  55.     const mesh::indices_t& patch_points;
  56.     const mesh::weights_t& patch_point_weights;
  57.     const mesh::attribute_arrays_t& constant_data;
  58.     const mesh::attribute_arrays_t& uniform_data;
  59.     const mesh::attribute_arrays_t& varying_data;
  60. };
  61.  
  62. /// Gathers the member arrays of a bezier_triangle_patch primitive into a convenient package
  63. class primitive
  64. {
  65. public:
  66.     primitive(
  67.         mesh::indices_t& PatchFirstPoints,
  68.         mesh::orders_t& PatchOrders,
  69.         mesh::selection_t& PatchSelections,
  70.         mesh::materials_t& PatchMaterials,
  71.         mesh::indices_t& PatchPoints,
  72.         mesh::weights_t& PatchPointWeights,
  73.         mesh::attribute_arrays_t& ConstantData,
  74.         mesh::attribute_arrays_t& UniformData,
  75.         mesh::attribute_arrays_t& VaryingData
  76.         );
  77.  
  78.     mesh::indices_t& patch_first_points;
  79.     mesh::orders_t& patch_orders;
  80.     mesh::selection_t& patch_selections;
  81.     mesh::materials_t& patch_materials;
  82.     mesh::indices_t& patch_points;
  83.     mesh::weights_t& patch_point_weights;
  84.     mesh::attribute_arrays_t& constant_data;
  85.     mesh::attribute_arrays_t& uniform_data;
  86.     mesh::attribute_arrays_t& varying_data;
  87. };
  88.  
  89. /// Creates a new bezier_triangle_patch mesh primitive, returning references to its member arrays.
  90. /// The caller is responsible for the lifetime of the returned object.
  91. primitive* create(mesh& Mesh);
  92.  
  93. /// Tests the given mesh primitive to see if it is a valid bezier_triangle_patch primitive, returning references to its member arrays, or NULL.
  94. /// The caller is responsible for the lifetime of the returned object.
  95. const_primitive* validate(const mesh::primitive& GenericPrimitive);
  96. /// Tests the given mesh primitive to see if it is a valid bezier_triangle_patch primitive, returning references to its member arrays, or NULL.
  97. /// The caller is responsible for the lifetime of the returned object.
  98. primitive* validate(mesh::primitive& GenericPrimitive);
  99.  
  100. } // namespace bezier_triangle_patch
  101.  
  102. } // namespace k3d
  103.  
  104. #endif // !K3DSDK_BEZIER_TRIANGLE_PATCH_H
  105.  
  106.