PageRenderTime 350ms CodeModel.GetById 337ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llagentpilot.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 123 lines | 68 code | 29 blank | 26 comment | 0 complexity | 1b07e9f01e11c7c4ca7bb177da8498f4 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llagentpilot.h
  3. * @brief LLAgentPilot class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLAGENTPILOT_H
  27. #define LL_LLAGENTPILOT_H
  28. #include "stdtypes.h"
  29. #include "lltimer.h"
  30. #include "v3dmath.h"
  31. #include "lldarray.h"
  32. // Class that drives the agent around according to a "script".
  33. class LLAgentPilot
  34. {
  35. public:
  36. enum EActionType
  37. {
  38. STRAIGHT,
  39. TURN
  40. };
  41. LLAgentPilot();
  42. virtual ~LLAgentPilot();
  43. void load();
  44. void loadTxt(const std::string& filename);
  45. void loadXML(const std::string& filename);
  46. void save();
  47. void saveTxt(const std::string& filename);
  48. void saveXML(const std::string& filename);
  49. void startRecord();
  50. void stopRecord();
  51. void addAction(enum EActionType action);
  52. void startPlayback();
  53. void stopPlayback();
  54. bool isRecording() { return mRecording; }
  55. bool isPlaying() { return mPlaying; }
  56. bool getOverrideCamera() { return mOverrideCamera; }
  57. void updateTarget();
  58. void addWaypoint();
  59. void moveCamera();
  60. void setReplaySession(BOOL new_val) { mReplaySession = new_val; }
  61. BOOL getReplaySession() { return mReplaySession; }
  62. void setLoop(BOOL new_val) { mLoop = new_val; }
  63. BOOL getLoop() { return mLoop; }
  64. void setQuitAfterRuns(BOOL quit_val) { mQuitAfterRuns = quit_val; }
  65. void setNumRuns(S32 num_runs) { mNumRuns = num_runs; }
  66. private:
  67. BOOL mLoop;
  68. BOOL mReplaySession;
  69. S32 mNumRuns;
  70. BOOL mQuitAfterRuns;
  71. void setAutopilotTarget(const S32 id);
  72. BOOL mRecording;
  73. F32 mLastRecordTime;
  74. BOOL mStarted;
  75. BOOL mPlaying;
  76. S32 mCurrentAction;
  77. BOOL mOverrideCamera;
  78. class Action
  79. {
  80. public:
  81. EActionType mType;
  82. LLVector3d mTarget;
  83. F64 mTime;
  84. F32 mCameraView;
  85. LLVector3 mCameraOrigin;
  86. LLVector3 mCameraXAxis;
  87. LLVector3 mCameraYAxis;
  88. LLVector3 mCameraZAxis;
  89. };
  90. LLDynamicArray<Action> mActions;
  91. LLTimer mTimer;
  92. };
  93. extern LLAgentPilot gAgentPilot;
  94. #endif // LL_LLAGENTPILOT_H