W3DRopeDraw.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: W3DRopeDraw.h //////////////////////////////////////////////////////////////////////////
  24. // Author:
  25. // Desc:
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __W3DRopeDraw_H_
  29. #define __W3DRopeDraw_H_
  30. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/DrawModule.h"
  32. #include "WW3D2/Line3D.h"
  33. //-------------------------------------------------------------------------------------------------
  34. /** W3D rope draw */
  35. //-------------------------------------------------------------------------------------------------
  36. class W3DRopeDraw : public DrawModule, public RopeDrawInterface
  37. {
  38. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( W3DRopeDraw, "W3DRopeDraw" )
  39. MAKE_STANDARD_MODULE_MACRO( W3DRopeDraw )
  40. public:
  41. W3DRopeDraw( Thing *thing, const ModuleData* moduleData );
  42. // virtual destructor prototype provided by memory pool declaration
  43. virtual void doDrawModule(const Matrix3D* transformMtx);
  44. virtual void setShadowsEnabled(Bool enable) { }
  45. virtual void releaseShadows(void) {}; ///< we don't care about preserving temporary shadows.
  46. virtual void allocateShadows(void) {}; ///< we don't care about preserving temporary shadows.
  47. virtual void setFullyObscuredByShroud(Bool fullyObscured) { }
  48. virtual void reactToTransformChange(const Matrix3D* oldMtx, const Coord3D* oldPos, Real oldAngle) { }
  49. virtual void reactToGeometryChange() { }
  50. virtual void initRopeParms(Real length, Real width, const RGBColor& color, Real wobbleLen, Real wobbleAmp, Real wobbleRate);
  51. virtual void setRopeCurLen(Real length);
  52. virtual void setRopeSpeed(Real curSpeed, Real maxSpeed, Real accel);
  53. virtual RopeDrawInterface* getRopeDrawInterface() { return this; }
  54. virtual const RopeDrawInterface* getRopeDrawInterface() const { return this; }
  55. private:
  56. struct SegInfo
  57. {
  58. Line3DClass* line;
  59. Line3DClass* softLine;
  60. Real wobbleAxisX;
  61. Real wobbleAxisY;
  62. };
  63. std::vector<SegInfo> m_segments; ///< the rope render object in the W3D scene
  64. Real m_curLen; ///< length of rope
  65. Real m_maxLen; ///< length of rope
  66. Real m_width; ///< width of rope
  67. RGBColor m_color; ///< color of rope
  68. Real m_curSpeed;
  69. Real m_maxSpeed;
  70. Real m_accel;
  71. Real m_wobbleLen;
  72. Real m_wobbleAmp;
  73. Real m_wobbleRate;
  74. Real m_curWobblePhase;
  75. Real m_curZOffset;
  76. void tossSegments();
  77. void buildSegments();
  78. };
  79. #endif // __W3DRopeDraw_H_