Torque3D Documentation / _generateds / afxCameraPuppet.cpp

afxCameraPuppet.cpp

Engine/source/afx/ce/afxCameraPuppet.cpp

More...

Public Defines

define
myOffset(field) (field, )

Public Functions

ConsoleDocClass(afxCameraPuppetData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classcamera/">Camera</a> Puppet <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "A <a href="/coding/class/classcamera/">Camera</a> Puppet effect is used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> the position and orientation of the camera using the AFX constraint system. " "<a href="/coding/class/classcamera/">Camera</a> Puppet effects are useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> creating small cut-scenes and can add <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> lot of visual drama <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> spell or effectron " "effect." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Effective use of <a href="/coding/class/classcamera/">Camera</a> Puppet effects require <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> fairly advanced understanding of how Torque cameras work in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> " "server-client context. Care must be taken <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> prevent client cameras from drifting too far out of sync from the server camera. " " Otherwise, obvious discontinuities in the motion will result when the <a href="/coding/class/classcamera/">Camera</a> Puppet ends and <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is restored <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the " "server camera. Scoping problems can also result <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> client camera is moved <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> location that is inconsistent with the " "scene scoping done by the server camera." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Often it is useful <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> manage camera controlling in an isolated effectron rather than directly incorporated into <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> magic-spell. " "This way the camera controlling effectron can target the specific client associated with the spellcaster. The spellcasting " "player observes the spell in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> dramatic cut-scene-like fashion <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> other players continue <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> observe from their own " "viewing locations." "\<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(afxCameraPuppetData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classcamera/">Camera</a> Puppet <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "A <a href="/coding/class/classcamera/">Camera</a> Puppet effect is used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> the position and orientation of the camera using the AFX constraint system. " "<a href="/coding/class/classcamera/">Camera</a> Puppet effects are useful <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> creating small cut-scenes and can add <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> lot of visual drama <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> spell or effectron " "effect." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Effective use of <a href="/coding/class/classcamera/">Camera</a> Puppet effects require <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> fairly advanced understanding of how Torque cameras work in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> " "server-client context. Care must be taken <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> prevent client cameras from drifting too far out of sync from the server camera. " " Otherwise, obvious discontinuities in the motion will result when the <a href="/coding/class/classcamera/">Camera</a> Puppet ends and <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> is restored <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the " "server camera. Scoping problems can also result <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> client camera is moved <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> location that is inconsistent with the " "scene scoping done by the server camera." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Often it is useful <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> manage camera controlling in an isolated effectron rather than directly incorporated into <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> magic-spell. " "This way the camera controlling effectron can target the specific client associated with the spellcaster. The spellcasting " "player observes the spell in <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> dramatic cut-scene-like fashion <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> other players continue <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> observe from their own " "viewing locations." "\<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(afxCameraPuppetData )

  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#include "scene/sceneRenderState.h"
 32#include "math/mathIO.h"
 33
 34#include "afx/afxChoreographer.h"
 35#include "afx/ce/afxCameraPuppet.h"
 36
 37//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 38// afxCameraPuppetData
 39
 40IMPLEMENT_CO_DATABLOCK_V1(afxCameraPuppetData);
 41
 42ConsoleDocClass( afxCameraPuppetData,
 43   "@brief A datablock that specifies a Camera Puppet effect.\n\n"
 44
 45   "A Camera Puppet effect is used to control the position and orientation of the camera using the AFX constraint system. "
 46   "Camera Puppet effects are useful for creating small cut-scenes and can add a lot of visual drama to a spell or effectron "
 47   "effect."
 48   "\n\n"
 49
 50   "Effective use of Camera Puppet effects require a fairly advanced understanding of how Torque cameras work in a "
 51   "server-client context. Care must be taken to prevent client cameras from drifting too far out of sync from the server camera. "
 52   "Otherwise, obvious discontinuities in the motion will result when the Camera Puppet ends and control is restored to the "
 53   "server camera. Scoping problems can also result if a client camera is moved to a location that is inconsistent with the "
 54   "scene scoping done by the server camera."
 55   "\n\n"
 56
 57   "Often it is useful to manage camera controlling in an isolated effectron rather than directly incorporated into a magic-spell. "
 58   "This way the camera controlling effectron can target the specific client associated with the spellcaster. The spellcasting "
 59   "player observes the spell in a dramatic cut-scene-like fashion while other players continue to observe from their own "
 60   "viewing locations."
 61   "\n\n"
 62
 63   "@ingroup afxEffects\n"
 64   "@ingroup AFX\n"
 65   "@ingroup Datablocks\n"
 66);
 67
 68afxCameraPuppetData::afxCameraPuppetData()
 69{
 70  cam_spec = ST_NULLSTRING;
 71  networking = SERVER_AND_CLIENT;
 72}
 73
 74afxCameraPuppetData::afxCameraPuppetData(const afxCameraPuppetData& other, bool temp_clone) : GameBaseData(other, temp_clone)
 75{
 76  cam_spec = other.cam_spec;
 77  networking = other.networking;
 78}
 79
 80#define myOffset(field) Offset(field, afxCameraPuppetData)
 81
 82void afxCameraPuppetData::initPersistFields()
 83{
 84  addField("cameraSpec",          TypeString,   myOffset(cam_spec),
 85    "This field is like the effect-wrapper fields for specifying constraint sources, "
 86    "but here it specifies a target for the camera-puppet effect.");
 87  addField("networking",          TypeS8,       myOffset(networking),
 88    "Specifies the networking model used for the camerapuppet effect. The effect can "
 89    "puppet just the server camera, just the client camera, or both.\n"
 90    "Possible values: $AFX::SERVER_ONLY, $AFX::CLIENT_ONLY, or $AFX::SERVER_AND_CLIENT.");
 91
 92  // disallow some field substitutions
 93  disableFieldSubstitutions("cameraSpec");
 94  disableFieldSubstitutions("networking");
 95
 96  Parent::initPersistFields();
 97}
 98
 99bool afxCameraPuppetData::onAdd()
100{
101  if (Parent::onAdd() == false)
102    return false;
103
104  bool runs_on_s = ((networking & (SERVER_ONLY | SERVER_AND_CLIENT)) != 0);
105  bool runs_on_c = ((networking & (CLIENT_ONLY | SERVER_AND_CLIENT)) != 0);
106  cam_def.parseSpec(cam_spec, runs_on_s, runs_on_c);
107
108  return true;
109}
110
111void afxCameraPuppetData::packData(BitStream* stream)
112{
113   Parent::packData(stream);
114
115  stream->writeString(cam_spec);
116  stream->write(networking);
117}
118
119void afxCameraPuppetData::unpackData(BitStream* stream)
120{
121  Parent::unpackData(stream);
122
123  cam_spec = stream->readSTString();
124  stream->read(&networking);
125}
126
127void afxCameraPuppetData::gather_cons_defs(Vector<afxConstraintDef>& defs)
128{ 
129  if (cam_def.isDefined())
130    defs.push_back(cam_def);
131};
132
133//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
134