afxZodiacPlane.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. void packData(BitStream*) override;
  75. void unpackData(BitStream*) override;
  76. bool preload(bool server, String &errorStr) override;
  77. bool allowSubstitutions() const override { return true; }
  78. F32 calcRotationAngle(F32 elapsed, F32 rate_factor=1.0f);
  79. static void initPersistFields();
  80. DECLARE_CONOBJECT(afxZodiacPlaneData);
  81. };
  82. typedef afxZodiacPlaneData::BlendType afxZodiacPlane_BlendType;
  83. DefineEnumType( afxZodiacPlane_BlendType );
  84. typedef afxZodiacPlaneData::FacingType afxZodiacPlane_FacingType;
  85. DefineEnumType( afxZodiacPlane_FacingType );
  86. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  87. // afxZodiacPlane
  88. class afxZodiacPlane : public GameBase, public afxZodiacDefs
  89. {
  90. typedef GameBase Parent;
  91. private:
  92. afxZodiacPlaneData* mDataBlock;
  93. LinearColorF color;
  94. F32 radius;
  95. bool is_visible;
  96. void preDraw();
  97. void draw();
  98. void postDraw();
  99. GFXStateBlockRef normal_sb;
  100. GFXStateBlockRef reflected_sb;
  101. public:
  102. /*C*/ afxZodiacPlane();
  103. /*D*/ ~afxZodiacPlane();
  104. bool onNewDataBlock(GameBaseData* dptr, bool reload) override;
  105. bool onAdd() override;
  106. void onRemove() override;
  107. void setRadius(F32 rad) { radius = rad; }
  108. void setColor(const LinearColorF& clr) { color = clr; }
  109. void setVisibility(bool flag) { is_visible = flag; }
  110. void prepRenderImage(SceneRenderState*) override;
  111. void _renderZodiacPlane(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*);
  112. DECLARE_CONOBJECT(afxZodiacPlane);
  113. DECLARE_CATEGORY("UNLISTED");
  114. };
  115. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  116. #endif // _AFX_ZODIAC_PLANE_H_