Torque3D Documentation / _generateds / afxSpotLight_T3D.cpp

afxSpotLight_T3D.cpp

Engine/source/afx/ce/afxSpotLight_T3D.cpp

More...

Public Functions

ConsoleDocClass(afxT3DSpotLightData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> dynamic Spot <a href="/coding/file/shapebase_8h/#shapebase_8h_1a5dd6c7d5f77e2fb9e790a22a8677b5f3">Light</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "A Spot <a href="/coding/file/shapebase_8h/#shapebase_8h_1a5dd6c7d5f77e2fb9e790a22a8677b5f3">Light</a> effect that uses the T3D <a href="/coding/class/classspotlight/">SpotLight</a> object. <a href="/coding/class/classafxt3dspotlightdata/">afxT3DSpotLightData</a> has the same fields found in <a href="/coding/class/classspotlight/">SpotLight</a> but in " "<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> datablock structure." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxEffects\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(afxT3DSpotLightData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> dynamic Spot <a href="/coding/file/shapebase_8h/#shapebase_8h_1a5dd6c7d5f77e2fb9e790a22a8677b5f3">Light</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "A Spot <a href="/coding/file/shapebase_8h/#shapebase_8h_1a5dd6c7d5f77e2fb9e790a22a8677b5f3">Light</a> effect that uses the T3D <a href="/coding/class/classspotlight/">SpotLight</a> object. <a href="/coding/class/classafxt3dspotlightdata/">afxT3DSpotLightData</a> has the same fields found in <a href="/coding/class/classspotlight/">SpotLight</a> but in " "<a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> datablock structure." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxEffects\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(afxT3DSpotLightData )

  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 "console/consoleTypes.h"
 30#include "core/stream/bitStream.h"
 31
 32#include "afx/ce/afxSpotLight_T3D.h"
 33
 34//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 35// afxT3DSpotLightData
 36
 37IMPLEMENT_CO_DATABLOCK_V1(afxT3DSpotLightData);
 38
 39ConsoleDocClass( afxT3DSpotLightData,
 40   "@brief A datablock that specifies a dynamic Spot Light effect.\n\n"
 41
 42   "A Spot Light effect that uses the T3D SpotLight object. afxT3DSpotLightData has the same fields found in SpotLight but in "
 43   "a datablock structure."
 44   "\n\n"
 45
 46   "@ingroup afxEffects\n"
 47   "@ingroup AFX\n"
 48   "@ingroup Datablocks\n"
 49);
 50
 51afxT3DSpotLightData::afxT3DSpotLightData()
 52   :  mRange( 10.0f ),
 53      mInnerConeAngle( 40.0f ),
 54      mOuterConeAngle( 45.0f )
 55{
 56}
 57
 58afxT3DSpotLightData::afxT3DSpotLightData(const afxT3DSpotLightData& other, bool temp_clone) : afxT3DLightBaseData(other, temp_clone)
 59{
 60  mRange = other.mRange;
 61  mInnerConeAngle = other.mInnerConeAngle;
 62  mOuterConeAngle = other.mOuterConeAngle;
 63}
 64
 65//
 66// NOTE: keep this as consistent as possible with PointLight::initPersistFields()
 67//
 68void afxT3DSpotLightData::initPersistFields()
 69{
 70   addGroup( "Light" );
 71      
 72      addField( "range", TypeF32, Offset( mRange, afxT3DSpotLightData ),
 73        "...");
 74      addField( "innerAngle", TypeF32, Offset( mInnerConeAngle, afxT3DSpotLightData ),
 75        "...");
 76      addField( "outerAngle", TypeF32, Offset( mOuterConeAngle, afxT3DSpotLightData ),
 77        "...");
 78
 79   endGroup( "Light" );
 80
 81   // We do the parent fields at the end so that
 82   // they show up that way in the inspector.
 83   Parent::initPersistFields();
 84}
 85
 86bool afxT3DSpotLightData::onAdd()
 87{
 88  if (Parent::onAdd() == false)
 89    return false;
 90
 91  return true;
 92}
 93
 94void afxT3DSpotLightData::packData(BitStream* stream)
 95{
 96   Parent::packData(stream);
 97
 98  stream->write( mRange );
 99  stream->write( mInnerConeAngle );
100  stream->write( mOuterConeAngle );
101}
102
103void afxT3DSpotLightData::unpackData(BitStream* stream)
104{
105  Parent::unpackData(stream);
106
107  stream->read( &mRange );
108  stream->read( &mInnerConeAngle );
109  stream->read( &mOuterConeAngle );
110}
111
112
113//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
114