PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 4ms RepoModel.GetById 1ms 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
  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
 27#ifndef LL_LLAGENTPILOT_H
 28#define LL_LLAGENTPILOT_H
 29
 30#include "stdtypes.h"
 31#include "lltimer.h"
 32#include "v3dmath.h"
 33#include "lldarray.h"
 34
 35// Class that drives the agent around according to a "script".
 36
 37class LLAgentPilot
 38{
 39public:
 40	enum EActionType
 41	{
 42		STRAIGHT,
 43		TURN
 44	};
 45
 46	LLAgentPilot();
 47	virtual ~LLAgentPilot();
 48
 49	void load();
 50	void loadTxt(const std::string& filename);
 51	void loadXML(const std::string& filename);
 52	void save();
 53	void saveTxt(const std::string& filename);
 54	void saveXML(const std::string& filename);
 55
 56	void startRecord();
 57	void stopRecord();
 58	void addAction(enum EActionType action);
 59
 60	void startPlayback();
 61	void stopPlayback();
 62
 63	bool isRecording() { return mRecording; }
 64	bool isPlaying() { return mPlaying; }
 65	bool getOverrideCamera() { return mOverrideCamera; }
 66	
 67	void updateTarget();
 68
 69	void addWaypoint();
 70	void moveCamera();
 71
 72	void setReplaySession(BOOL new_val) { mReplaySession = new_val; }
 73	BOOL getReplaySession() { return mReplaySession; }
 74
 75	void setLoop(BOOL new_val) { mLoop = new_val; }
 76	BOOL getLoop() { return mLoop; }
 77
 78	void setQuitAfterRuns(BOOL quit_val) { mQuitAfterRuns = quit_val; }
 79	void setNumRuns(S32 num_runs) { mNumRuns = num_runs; }
 80	
 81private:
 82
 83
 84
 85	BOOL	mLoop;
 86	BOOL 	mReplaySession;
 87
 88	S32		mNumRuns;
 89	BOOL	mQuitAfterRuns;
 90
 91	void setAutopilotTarget(const S32 id);
 92
 93	BOOL	mRecording;
 94	F32		mLastRecordTime;
 95
 96	BOOL	mStarted;
 97	BOOL	mPlaying;
 98	S32		mCurrentAction;
 99
100	BOOL	mOverrideCamera;
101
102	class Action
103	{
104	public:
105
106		EActionType		mType;
107		LLVector3d		mTarget;
108		F64				mTime;
109		F32				mCameraView;
110		LLVector3		mCameraOrigin;
111		LLVector3		mCameraXAxis;
112		LLVector3		mCameraYAxis;
113		LLVector3		mCameraZAxis;
114	};
115
116	LLDynamicArray<Action>	mActions;
117	LLTimer					mTimer;
118
119};
120
121extern LLAgentPilot gAgentPilot;
122
123#endif // LL_LLAGENTPILOT_H