PolyScenePrimitive.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 "PolyString.h"
  21. #include "PolyGlobals.h"
  22. #include "PolySceneMesh.h"
  23. #include "PolyCoreServices.h"
  24. #include <string>
  25. using std::string;
  26. namespace Polycode {
  27. /**
  28. * 3D primitive mesh.
  29. */
  30. class _PolyExport ScenePrimitive : public SceneMesh {
  31. public:
  32. /**
  33. * Create a primitive mesh of specified type and size.
  34. * @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
  35. * @param v1 See the constant primitive types for values for these parameters
  36. * @param v2 See the constant primitive types for values for these parameters
  37. * @param v3 See the constant primitive types for values for these parameters
  38. * @param v4 See the constant primitive types for values for these parameters
  39. * @param v5 See the constant primitive types for values for these parameters
  40. */
  41. ScenePrimitive(int type, Number v1=1.0f, Number v2=1.0f, Number v3=1.0f,Number v4=0.0f,Number v5=0.0f);
  42. virtual ~ScenePrimitive();
  43. /**
  44. * A cube.
  45. * v1 - X size
  46. * v2 - Y size
  47. * v3 - Z size
  48. */
  49. static const int TYPE_BOX = 0;
  50. /**
  51. * A horizontal plane.
  52. * v1 - X size
  53. * v2 - Z size
  54. */
  55. static const int TYPE_PLANE = 1;
  56. /**
  57. * A sphere.
  58. * v1 - Sphere radius
  59. * v2 - Lat segments
  60. * v3 - Long segments
  61. */
  62. static const int TYPE_SPHERE = 2;
  63. /**
  64. * A cylinder.
  65. * v1 - Cylinder radius
  66. * v2 - Cylinder length
  67. * v3 - Number of segments.
  68. */
  69. static const int TYPE_CYLINDER = 3;
  70. /**
  71. * A cone.
  72. * v1 - Cone length.
  73. * v2 - Cone raidus.
  74. * v3 - Number of segments.
  75. */
  76. static const int TYPE_CONE = 4;
  77. /**
  78. * A vertical plane.
  79. * v1 - X size
  80. * v2 - Y size
  81. */
  82. static const int TYPE_VPLANE = 5;
  83. /**
  84. * A torus.
  85. * v1 - Torus radius.
  86. * v2 - Pipe radius.
  87. * v3 - Number of ring segments.
  88. * v4- Number of pipe segments.
  89. */
  90. static const int TYPE_TORUS = 6;
  91. protected:
  92. };
  93. }