forestBrushElement.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _FOREST_EDITOR_BRUSHELEMENT_H_
  23. #define _FOREST_EDITOR_BRUSHELEMENT_H_
  24. //#ifndef _SIMOBJECT_H_
  25. //#include "console/simObject.h"
  26. //#endif
  27. #ifndef _SIMSET_H_
  28. #include "console/simSet.h"
  29. #endif
  30. //-------------------------------------------------------------------------
  31. // ForestBrushElement
  32. //-------------------------------------------------------------------------
  33. class ForestItemData;
  34. class ForestBrushElement : public SimObject
  35. {
  36. typedef SimObject Parent;
  37. public:
  38. ForestBrushElement();
  39. DECLARE_CONOBJECT( ForestBrushElement );
  40. static void initPersistFields();
  41. public:
  42. /// The type of ForestItem this element holds placement parameters for.
  43. ForestItemData *mData;
  44. /// The probability that this element will be
  45. /// created during an editor brush stroke.
  46. F32 mProbability;
  47. /// The max rotation in degrees that items will be placed.
  48. F32 mRotationRange;
  49. /// The minimum random size for each item.
  50. F32 mScaleMin;
  51. /// The maximum random size of each item.
  52. F32 mScaleMax;
  53. /// An exponent used to bias between the minimum
  54. /// and maximum random sizes.
  55. F32 mScaleExponent;
  56. /// Min variation in the sink radius.
  57. F32 mSinkMin;
  58. /// Max variation in the sink radius.
  59. F32 mSinkMax;
  60. /// This is the radius used to calculate how much to
  61. /// sink the trunk at its base and is used to sink
  62. /// the tree into the ground when its on a slope.
  63. F32 mSinkRadius;
  64. /// The min surface slope in degrees this item will be placed on.
  65. F32 mSlopeMin;
  66. /// The max surface slope in degrees this item will be placed on.
  67. F32 mSlopeMax;
  68. /// The min world space elevation this item will be placed.
  69. F32 mElevationMin;
  70. /// The max world space elevation this item will be placed.
  71. F32 mElevationMax;
  72. };
  73. //-------------------------------------------------------------------------
  74. // ForestBrush
  75. //-------------------------------------------------------------------------
  76. class ForestBrush : public SimGroup
  77. {
  78. typedef SimGroup Parent;
  79. public:
  80. ForestBrush();
  81. DECLARE_CONOBJECT( ForestBrush );
  82. virtual bool onAdd();
  83. virtual void addObject(SimObject*);
  84. static SimGroup* getGroup();
  85. bool containsItemData( const ForestItemData *inData );
  86. protected:
  87. static SimObjectPtr<SimGroup> smGroup;
  88. };
  89. //-------------------------------------------------------------------------
  90. // ForestBrushGroup
  91. //-------------------------------------------------------------------------
  92. class ForestBrushGroup : public SimGroup
  93. {
  94. typedef SimGroup Parent;
  95. public:
  96. ForestBrushGroup();
  97. DECLARE_CONOBJECT(ForestBrushGroup);
  98. virtual bool onAdd();
  99. virtual void addObject(SimObject*);
  100. bool containsBrushData(const ForestBrush* inData);
  101. protected:
  102. static SimObjectPtr<SimGroup> smGroup;
  103. };
  104. #endif // _FOREST_EDITOR_BRUSHELEMENT_H_