afxZodiacPlane.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  2. // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
  3. // Copyright (C) 2015 Faust Logic, Inc.
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to
  7. // deal in the Software without restriction, including without limitation the
  8. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9. // sell copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. // IN THE SOFTWARE.
  22. //
  23. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  24. #ifndef _AFX_ZODIAC_PLANE_H_
  25. #define _AFX_ZODIAC_PLANE_H_
  26. #include "afx/ce/afxZodiacDefs.h"
  27. class afxZodiacPlaneData : public GameBaseData, public afxZodiacDefs
  28. {
  29. typedef GameBaseData Parent;
  30. public:
  31. enum BlendType
  32. {
  33. BLEND_NORMAL = 0x0,
  34. BLEND_ADDITIVE = 0x1,
  35. BLEND_SUBTRACTIVE = 0x2,
  36. BLEND_RESERVED = 0x3,
  37. BLEND_MASK = 0x3
  38. };
  39. enum FacingType
  40. {
  41. FACES_UP = 0,
  42. FACES_DOWN,
  43. FACES_FORWARD,
  44. FACES_BACK,
  45. FACES_RIGHT,
  46. FACES_LEFT,
  47. FACES_BITS = 3
  48. };
  49. public:
  50. StringTableEntry txr_name;
  51. GFXTexHandle txr;
  52. F32 radius_xy;
  53. F32 start_ang;
  54. F32 ang_per_sec;
  55. F32 grow_in_time;
  56. F32 shrink_out_time;
  57. F32 growth_rate;
  58. LinearColorF color;
  59. U32 blend_flags;
  60. bool respect_ori_cons;
  61. bool use_full_xfm;
  62. U32 zflags;
  63. U32 face_dir;
  64. bool double_sided;
  65. void expand_zflags();
  66. void merge_zflags();
  67. public:
  68. /*C*/ afxZodiacPlaneData();
  69. /*C*/ afxZodiacPlaneData(const afxZodiacPlaneData&, bool = false);
  70. virtual void packData(BitStream*);
  71. virtual void unpackData(BitStream*);
  72. bool preload(bool server, String &errorStr);
  73. virtual bool allowSubstitutions() const { return true; }
  74. F32 calcRotationAngle(F32 elapsed, F32 rate_factor=1.0f);
  75. static void initPersistFields();
  76. DECLARE_CONOBJECT(afxZodiacPlaneData);
  77. DECLARE_CATEGORY("AFX");
  78. };
  79. typedef afxZodiacPlaneData::BlendType afxZodiacPlane_BlendType;
  80. DefineEnumType( afxZodiacPlane_BlendType );
  81. typedef afxZodiacPlaneData::FacingType afxZodiacPlane_FacingType;
  82. DefineEnumType( afxZodiacPlane_FacingType );
  83. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  84. // afxZodiacPlane
  85. class afxZodiacPlane : public GameBase, public afxZodiacDefs
  86. {
  87. typedef GameBase Parent;
  88. private:
  89. afxZodiacPlaneData* mDataBlock;
  90. LinearColorF color;
  91. F32 radius;
  92. bool is_visible;
  93. void preDraw();
  94. void draw();
  95. void postDraw();
  96. GFXStateBlockRef normal_sb;
  97. GFXStateBlockRef reflected_sb;
  98. public:
  99. /*C*/ afxZodiacPlane();
  100. /*D*/ ~afxZodiacPlane();
  101. virtual bool onNewDataBlock(GameBaseData* dptr, bool reload);
  102. virtual bool onAdd();
  103. virtual void onRemove();
  104. void setRadius(F32 rad) { radius = rad; }
  105. void setColor(const LinearColorF& clr) { color = clr; }
  106. void setVisibility(bool flag) { is_visible = flag; }
  107. virtual void prepRenderImage(SceneRenderState*);
  108. void _renderZodiacPlane(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*);
  109. DECLARE_CONOBJECT(afxZodiacPlane);
  110. DECLARE_CATEGORY("AFX");
  111. };
  112. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  113. #endif // _AFX_ZODIAC_PLANE_H_