Torque3D Documentation / _generateds / afxXM_BoxHeightOffset.cpp

afxXM_BoxHeightOffset.cpp

Engine/source/afx/xm/afxXM_BoxHeightOffset.cpp

More...

Classes:

Public Functions

ConsoleDocClass(afxXM_BoxHeightOffsetData , "@brief An xmod <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.\n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxXMods\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">AFX\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )

Detailed Description

Public Functions

ConsoleDocClass(afxXM_BoxHeightOffsetData , "@brief An xmod <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">datablock.\n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxXMods\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">AFX\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )

IMPLEMENT_CO_DATABLOCK_V1(afxXM_BoxHeightOffsetData )

  1
  2
  3//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  4// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
  5// Copyright (C) 2015 Faust Logic, Inc.
  6//
  7// Permission is hereby granted, free of charge, to any person obtaining a copy
  8// of this software and associated documentation files (the "Software"), to
  9// deal in the Software without restriction, including without limitation the
 10// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 11// sell copies of the Software, and to permit persons to whom the Software is
 12// furnished to do so, subject to the following conditions:
 13//
 14// The above copyright notice and this permission notice shall be included in
 15// all copies or substantial portions of the Software.
 16//
 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 23// IN THE SOFTWARE.
 24//
 25//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 26
 27#include "afx/arcaneFX.h"
 28
 29#include "math/mathIO.h"
 30
 31#include "afx/afxEffectWrapper.h"
 32#include "afx/xm/afxXfmMod.h"
 33
 34//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 35// BOX HEIGHT OFFSET
 36
 37class afxXM_BoxHeightOffsetData : public afxXM_BaseData
 38{
 39  typedef afxXM_BaseData Parent;
 40  
 41public:
 42  Point3F       offset;
 43  
 44public:
 45  /*C*/         afxXM_BoxHeightOffsetData();
 46  /*C*/         afxXM_BoxHeightOffsetData(const afxXM_BoxHeightOffsetData&, bool = false);
 47  
 48  void          packData(BitStream* stream);
 49  void          unpackData(BitStream* stream);
 50  static void   initPersistFields();
 51  
 52#if defined(AFX_VERSION)
 53  afxXM_Base*   create(afxEffectWrapper* fx, bool on_server);
 54#else
 55  afxXM_Base*   create(afxEffectWrapper* fx);
 56#endif
 57  
 58  DECLARE_CONOBJECT(afxXM_BoxHeightOffsetData);
 59  DECLARE_CATEGORY("AFX");
 60};
 61
 62//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//
 63
 64class afxXM_BoxHeightOffset : public afxXM_Base
 65{
 66  typedef afxXM_Base Parent;
 67  Point3F       offset;
 68  
 69public:
 70  /*C*/         afxXM_BoxHeightOffset(afxXM_BoxHeightOffsetData*, afxEffectWrapper*);
 71
 72  virtual void  updateParams(F32 dt, F32 elapsed, afxXM_Params& params);
 73};
 74
 75//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 76// BOX HEIGHT OFFSET
 77
 78IMPLEMENT_CO_DATABLOCK_V1(afxXM_BoxHeightOffsetData);
 79
 80ConsoleDocClass( afxXM_BoxHeightOffsetData,
 81   "@brief An xmod datablock.\n\n"
 82
 83   "@ingroup afxXMods\n"
 84   "@ingroup AFX\n"
 85   "@ingroup Datablocks\n"
 86);
 87
 88afxXM_BoxHeightOffsetData::afxXM_BoxHeightOffsetData()
 89{
 90  offset.zero();
 91}
 92
 93afxXM_BoxHeightOffsetData::afxXM_BoxHeightOffsetData(const afxXM_BoxHeightOffsetData& other, bool temp_clone) 
 94  : afxXM_BaseData(other, temp_clone)
 95{
 96  offset = other.offset;
 97}
 98
 99void afxXM_BoxHeightOffsetData::initPersistFields()
100{
101  addField("offset",   TypePoint3F,  Offset(offset, afxXM_BoxHeightOffsetData));
102
103  Parent::initPersistFields();
104}
105
106void afxXM_BoxHeightOffsetData::packData(BitStream* stream)
107{
108  Parent::packData(stream);
109  mathWrite(*stream, offset);
110}
111
112void afxXM_BoxHeightOffsetData::unpackData(BitStream* stream)
113{
114  Parent::unpackData(stream);
115  mathRead(*stream, &offset);
116}
117
118#if defined(AFX_VERSION)
119afxXM_Base* afxXM_BoxHeightOffsetData::create(afxEffectWrapper* fx, bool on_server)
120#else
121afxXM_Base* afxXM_BoxHeightOffsetData::create(afxEffectWrapper* fx)
122#endif
123{
124  return new afxXM_BoxHeightOffset(this, fx);
125}
126
127//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//
128
129afxXM_BoxHeightOffset::afxXM_BoxHeightOffset(afxXM_BoxHeightOffsetData* db, afxEffectWrapper* fxw) 
130: afxXM_Base(db, fxw) 
131{ 
132  offset = db->offset;
133}
134
135void afxXM_BoxHeightOffset::updateParams(F32 dt, F32 elapsed, afxXM_Params& params)
136{
137  afxConstraint* pos_cons = fx_wrapper->getPosConstraint();
138  SceneObject* scn_obj = (pos_cons) ? pos_cons->getSceneObject() : 0;
139
140  if (scn_obj)
141    params.pos.z += scn_obj->getWorldBox().maxExtents.z - scn_obj->getWorldBox().minExtents.z;
142
143  params.pos += offset;
144}
145
146//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
147