PolyScenePrimitive.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. Copyright (C) 2011 by Ivan Safrin
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #pragma once
  20. #include "PolyGlobals.h"
  21. #include "PolySceneMesh.h"
  22. namespace Polycode {
  23. /**
  24. * 3D primitive mesh.
  25. */
  26. class _PolyExport ScenePrimitive : public SceneMesh {
  27. public:
  28. /**
  29. * Create a primitive mesh of specified type and size.
  30. * @param type Type of primitive to create. Current types are ScenePrimitive::TYPE_BOX, ScenePrimitive::TYPE_PLANE, ScenePrimitive::TYPE_VPLANE, ScenePrimitive::TYPE_SPHERE, ScenePrimitive::TYPE_CYLINDER, ScenePrimitive::TYPE_CONE and ScenePrimitive::TYPE_TORUS
  31. * @param v1 See the constant primitive types for values for these parameters
  32. * @param v2 See the constant primitive types for values for these parameters
  33. * @param v3 See the constant primitive types for values for these parameters
  34. * @param v4 See the constant primitive types for values for these parameters
  35. * @param v5 See the constant primitive types for values for these parameters
  36. */
  37. ScenePrimitive(int type, Number v1=1.0f, Number v2=1.0f, Number v3=1.0f,Number v4=0.0f,Number v5=0.0f);
  38. virtual ~ScenePrimitive();
  39. /**
  40. * A cube.
  41. * v1 - X size
  42. * v2 - Y size
  43. * v3 - Z size
  44. */
  45. static const int TYPE_BOX = 0;
  46. /**
  47. * A horizontal plane.
  48. * v1 - X size
  49. * v2 - Z size
  50. */
  51. static const int TYPE_PLANE = 1;
  52. /**
  53. * A sphere.
  54. * v1 - Sphere radius
  55. * v2 - Lat segments
  56. * v3 - Long segments
  57. */
  58. static const int TYPE_SPHERE = 2;
  59. /**
  60. * A cylinder.
  61. * v1 - Cylinder length
  62. * v2 - Cylinder radius
  63. * v3 - Number of segments.
  64. */
  65. static const int TYPE_CYLINDER = 3;
  66. /**
  67. * A cone.
  68. * v1 - Cone length.
  69. * v2 - Cone raidus.
  70. * v3 - Number of segments.
  71. */
  72. static const int TYPE_CONE = 4;
  73. /**
  74. * A vertical plane.
  75. * v1 - X size
  76. * v2 - Y size
  77. */
  78. static const int TYPE_VPLANE = 5;
  79. /**
  80. * A torus.
  81. * v1 - Torus radius.
  82. * v2 - Pipe radius.
  83. * v3 - Number of ring segments.
  84. * v4- Number of pipe segments.
  85. */
  86. static const int TYPE_TORUS = 6;
  87. protected:
  88. };
  89. }