EmitterRotationPropPage.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. ** Command & Conquer Renegade(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. #if !defined(AFX_EMITTERROTATIONPROPPAGE_H__35F8A2F6_C91C_4750_BF06_100433C1ECBB__INCLUDED_)
  19. #define AFX_EMITTERROTATIONPROPPAGE_H__35F8A2F6_C91C_4750_BF06_100433C1ECBB__INCLUDED_
  20. #if _MSC_VER > 1000
  21. #pragma once
  22. #endif // _MSC_VER > 1000
  23. // EmitterRotationPropPage.h : header file
  24. //
  25. #include "ColorBar.H"
  26. #include "Part_Emt.H"
  27. // Forward delcarations
  28. class EmitterInstanceListClass;
  29. /////////////////////////////////////////////////////////////////////////////
  30. // EmitterRotationPropPageClass dialog
  31. class EmitterRotationPropPageClass : public CPropertyPage
  32. {
  33. DECLARE_DYNCREATE(EmitterRotationPropPageClass)
  34. // Construction
  35. public:
  36. EmitterRotationPropPageClass();
  37. ~EmitterRotationPropPageClass();
  38. // Dialog Data
  39. //{{AFX_DATA(EmitterRotationPropPageClass)
  40. enum { IDD = IDD_PROP_PAGE_EMITTER_ROTATION };
  41. CSpinButtonCtrl m_InitialOrientationRandomSpin;
  42. CSpinButtonCtrl m_RotationRandomSpin;
  43. //}}AFX_DATA
  44. // Overrides
  45. // ClassWizard generate virtual function overrides
  46. //{{AFX_VIRTUAL(EmitterRotationPropPageClass)
  47. protected:
  48. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  49. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  50. virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  51. //}}AFX_VIRTUAL
  52. // Implementation
  53. protected:
  54. // Generated message map functions
  55. //{{AFX_MSG(EmitterRotationPropPageClass)
  56. virtual BOOL OnInitDialog();
  57. //}}AFX_MSG
  58. DECLARE_MESSAGE_MAP()
  59. public:
  60. /////////////////////////////////////////////////////////
  61. //
  62. // Public methods
  63. //
  64. //
  65. // Inline accessors
  66. //
  67. EmitterInstanceListClass * Get_Emitter (void) const { return m_pEmitterList; }
  68. void Set_Emitter (EmitterInstanceListClass *pemitter_list) { m_pEmitterList = pemitter_list; Initialize (); }
  69. bool Is_Data_Valid (void) const { return m_bValid; }
  70. void Get_Rotation_Keyframes (ParticlePropertyStruct<float> &rotations) { rotations = m_Rotations; }
  71. void On_Lifetime_Changed (float lifetime);
  72. protected:
  73. /////////////////////////////////////////////////////////
  74. //
  75. // Protected methods
  76. //
  77. void Initialize (void);
  78. void Update_Rotations (void);
  79. private:
  80. float Normalize_Rotation(float rot);
  81. float Normalize_Rotation(float rot,float min,float max);
  82. float Denormalize_Rotation(float normalized_val);
  83. /////////////////////////////////////////////////////////
  84. //
  85. // Private member data
  86. //
  87. EmitterInstanceListClass * m_pEmitterList;
  88. bool m_bValid;
  89. ColorBarClass * m_RotationBar;
  90. ParticlePropertyStruct<float> m_Rotations;
  91. float m_Lifetime;
  92. float m_MinRotation;
  93. float m_MaxRotation;
  94. float m_InitialOrientationRandom;
  95. };
  96. inline float EmitterRotationPropPageClass::Normalize_Rotation(float rot)
  97. {
  98. return (rot - m_MinRotation) / (m_MaxRotation - m_MinRotation);
  99. }
  100. inline float EmitterRotationPropPageClass::Normalize_Rotation(float rot,float min,float max)
  101. {
  102. return (rot - min) / (max - min);
  103. }
  104. inline float EmitterRotationPropPageClass::Denormalize_Rotation(float normalized_val)
  105. {
  106. return normalized_val * (m_MaxRotation - m_MinRotation) + m_MinRotation;
  107. }
  108. //{{AFX_INSERT_LOCATION}}
  109. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  110. #endif // !defined(AFX_EMITTERROTATIONPROPPAGE_H__35F8A2F6_C91C_4750_BF06_100433C1ECBB__INCLUDED_)