afxZodiacPlane.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. public:
  53. DECLARE_IMAGEASSET(afxZodiacPlaneData, Texture, AFX_GFXZodiacTextureProfile)
  54. F32 radius_xy;
  55. F32 start_ang;
  56. F32 ang_per_sec;
  57. F32 grow_in_time;
  58. F32 shrink_out_time;
  59. F32 growth_rate;
  60. LinearColorF color;
  61. U32 blend_flags;
  62. bool respect_ori_cons;
  63. bool use_full_xfm;
  64. U32 zflags;
  65. U32 face_dir;
  66. bool double_sided;
  67. void expand_zflags();
  68. void merge_zflags();
  69. public:
  70. /*C*/ afxZodiacPlaneData();
  71. /*C*/ afxZodiacPlaneData(const afxZodiacPlaneData&, bool = false);
  72. void packData(BitStream*) override;
  73. void unpackData(BitStream*) override;
  74. bool preload(bool server, String &errorStr) override;
  75. bool allowSubstitutions() const override { return true; }
  76. F32 calcRotationAngle(F32 elapsed, F32 rate_factor=1.0f);
  77. static void initPersistFields();
  78. DECLARE_CONOBJECT(afxZodiacPlaneData);
  79. };
  80. typedef afxZodiacPlaneData::BlendType afxZodiacPlane_BlendType;
  81. DefineEnumType( afxZodiacPlane_BlendType );
  82. typedef afxZodiacPlaneData::FacingType afxZodiacPlane_FacingType;
  83. DefineEnumType( afxZodiacPlane_FacingType );
  84. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  85. // afxZodiacPlane
  86. class afxZodiacPlane : public GameBase, public afxZodiacDefs
  87. {
  88. typedef GameBase Parent;
  89. private:
  90. afxZodiacPlaneData* mDataBlock;
  91. LinearColorF color;
  92. F32 radius;
  93. bool is_visible;
  94. void preDraw();
  95. void draw();
  96. void postDraw();
  97. GFXStateBlockRef normal_sb;
  98. GFXStateBlockRef reflected_sb;
  99. public:
  100. /*C*/ afxZodiacPlane();
  101. /*D*/ ~afxZodiacPlane();
  102. bool onNewDataBlock(GameBaseData* dptr, bool reload) override;
  103. bool onAdd() override;
  104. void onRemove() override;
  105. void setRadius(F32 rad) { radius = rad; }
  106. void setColor(const LinearColorF& clr) { color = clr; }
  107. void setVisibility(bool flag) { is_visible = flag; }
  108. void prepRenderImage(SceneRenderState*) override;
  109. void _renderZodiacPlane(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*);
  110. DECLARE_CONOBJECT(afxZodiacPlane);
  111. DECLARE_CATEGORY("UNLISTED");
  112. };
  113. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  114. #endif // _AFX_ZODIAC_PLANE_H_