afxCameraShake.cpp
Engine/source/afx/ce/afxCameraShake.cpp
Public Defines
define
myOffset(field) (field, )
Public Functions
ConsoleDocClass(afxCameraShakeData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classcamera/">Camera</a> Shake <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "<a href="/coding/class/classcamera/">Camera</a> Shake internally utilizes the standard Torque <a href="/coding/class/classcamerashake/">CameraShake</a> class <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> implement <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> shaken camera effect." "\<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 Defines
myOffset(field) (field, )
Public Functions
ConsoleDocClass(afxCameraShakeData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classcamera/">Camera</a> Shake <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "<a href="/coding/class/classcamera/">Camera</a> Shake internally utilizes the standard Torque <a href="/coding/class/classcamerashake/">CameraShake</a> class <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> implement <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> shaken camera effect." "\<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(afxCameraShakeData )
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/afxCameraShake.h" 33 34//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 35// afxCameraShakeData 36 37IMPLEMENT_CO_DATABLOCK_V1(afxCameraShakeData); 38 39ConsoleDocClass( afxCameraShakeData, 40 "@brief A datablock that specifies a Camera Shake effect.\n\n" 41 42 "Camera Shake internally utilizes the standard Torque CameraShake class to implement a shaken camera effect." 43 "\n\n" 44 45 "@ingroup afxEffects\n" 46 "@ingroup AFX\n" 47 "@ingroup Datablocks\n" 48); 49 50afxCameraShakeData::afxCameraShakeData() 51{ 52 camShakeFreq.set( 10.0, 10.0, 10.0 ); 53 camShakeAmp.set( 1.0, 1.0, 1.0 ); 54 camShakeRadius = 10.0; 55 camShakeFalloff = 10.0; 56} 57 58afxCameraShakeData::afxCameraShakeData(const afxCameraShakeData& other, bool temp_clone) : GameBaseData(other, temp_clone) 59{ 60 camShakeFreq = other.camShakeFreq; 61 camShakeAmp = other.camShakeAmp; 62 camShakeRadius = other.camShakeRadius; 63 camShakeFalloff = other.camShakeFalloff; 64} 65 66#define myOffset(field) Offset(field, afxCameraShakeData) 67 68void afxCameraShakeData::initPersistFields() 69{ 70 addField("frequency", TypePoint3F, Offset(camShakeFreq, afxCameraShakeData), 71 "The camera shake frequencies for all three axes: X, Y, Z."); 72 addField("amplitude", TypePoint3F, Offset(camShakeAmp, afxCameraShakeData), 73 "The camera shake amplitudes for all three axes: X, Y, Z."); 74 addField("radius", TypeF32, Offset(camShakeRadius, afxCameraShakeData), 75 "Radius about the effect position in which shaking will be applied."); 76 addField("falloff", TypeF32, Offset(camShakeFalloff, afxCameraShakeData), 77 "Magnitude by which shaking decreases over distance to radius."); 78 79 Parent::initPersistFields(); 80} 81 82bool afxCameraShakeData::onAdd() 83{ 84 if (Parent::onAdd() == false) 85 return false; 86 87 return true; 88} 89 90void afxCameraShakeData::packData(BitStream* stream) 91{ 92 Parent::packData(stream); 93 94 stream->write(camShakeFreq.x); 95 stream->write(camShakeFreq.y); 96 stream->write(camShakeFreq.z); 97 stream->write(camShakeAmp.x); 98 stream->write(camShakeAmp.y); 99 stream->write(camShakeAmp.z); 100 stream->write(camShakeRadius); 101 stream->write(camShakeFalloff); 102} 103 104void afxCameraShakeData::unpackData(BitStream* stream) 105{ 106 Parent::unpackData(stream); 107 108 stream->read(&camShakeFreq.x); 109 stream->read(&camShakeFreq.y); 110 stream->read(&camShakeFreq.z); 111 stream->read(&camShakeAmp.x); 112 stream->read(&camShakeAmp.y); 113 stream->read(&camShakeAmp.z); 114 stream->read(&camShakeRadius); 115 stream->read(&camShakeFalloff); 116} 117 118 119//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 120