afxZodiacPlane.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. #ifndef _AFX_ZODIAC_H_
  28. #include "afx/ce/afxZodiac.h"
  29. #endif
  30. class afxZodiacPlaneData : public GameBaseData, public afxZodiacDefs
  31. {
  32. typedef GameBaseData Parent;
  33. public:
  34. enum BlendType
  35. {
  36. BLEND_NORMAL = 0x0,
  37. BLEND_ADDITIVE = 0x1,
  38. BLEND_SUBTRACTIVE = 0x2,
  39. BLEND_RESERVED = 0x3,
  40. BLEND_MASK = 0x3
  41. };
  42. enum FacingType
  43. {
  44. FACES_UP = 0,
  45. FACES_DOWN,
  46. FACES_FORWARD,
  47. FACES_BACK,
  48. FACES_RIGHT,
  49. FACES_LEFT,
  50. FACES_BITS = 3
  51. };
  52. void onImageChanged() {}
  53. public:
  54. DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, onImageChanged, AFX_GFXZodiacTextureProfile);
  55. DECLARE_ASSET_SETGET(afxZodiacPlaneData, Texture);
  56. F32 radius_xy;
  57. F32 start_ang;
  58. F32 ang_per_sec;
  59. F32 grow_in_time;
  60. F32 shrink_out_time;
  61. F32 growth_rate;
  62. LinearColorF color;
  63. U32 blend_flags;
  64. bool respect_ori_cons;
  65. bool use_full_xfm;
  66. U32 zflags;
  67. U32 face_dir;
  68. bool double_sided;
  69. void expand_zflags();
  70. void merge_zflags();
  71. public:
  72. /*C*/ afxZodiacPlaneData();
  73. /*C*/ afxZodiacPlaneData(const afxZodiacPlaneData&, bool = false);
  74. virtual void packData(BitStream*);
  75. virtual void unpackData(BitStream*);
  76. bool preload(bool server, String &errorStr);
  77. virtual bool allowSubstitutions() const { return true; }
  78. F32 calcRotationAngle(F32 elapsed, F32 rate_factor=1.0f);
  79. static void initPersistFields();
  80. DECLARE_CONOBJECT(afxZodiacPlaneData);
  81. DECLARE_CATEGORY("AFX");
  82. };
  83. typedef afxZodiacPlaneData::BlendType afxZodiacPlane_BlendType;
  84. DefineEnumType( afxZodiacPlane_BlendType );
  85. typedef afxZodiacPlaneData::FacingType afxZodiacPlane_FacingType;
  86. DefineEnumType( afxZodiacPlane_FacingType );
  87. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  88. // afxZodiacPlane
  89. class afxZodiacPlane : public GameBase, public afxZodiacDefs
  90. {
  91. typedef GameBase Parent;
  92. private:
  93. afxZodiacPlaneData* mDataBlock;
  94. LinearColorF color;
  95. F32 radius;
  96. bool is_visible;
  97. void preDraw();
  98. void draw();
  99. void postDraw();
  100. GFXStateBlockRef normal_sb;
  101. GFXStateBlockRef reflected_sb;
  102. public:
  103. /*C*/ afxZodiacPlane();
  104. /*D*/ ~afxZodiacPlane();
  105. virtual bool onNewDataBlock(GameBaseData* dptr, bool reload);
  106. virtual bool onAdd();
  107. virtual void onRemove();
  108. void setRadius(F32 rad) { radius = rad; }
  109. void setColor(const LinearColorF& clr) { color = clr; }
  110. void setVisibility(bool flag) { is_visible = flag; }
  111. virtual void prepRenderImage(SceneRenderState*);
  112. void _renderZodiacPlane(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*);
  113. DECLARE_CONOBJECT(afxZodiacPlane);
  114. DECLARE_CATEGORY("AFX");
  115. };
  116. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  117. #endif // _AFX_ZODIAC_PLANE_H_