PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llhudeffectlookat.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 95 lines | 55 code | 14 blank | 26 comment | 0 complexity | cfb0702eb18fcf43a94fb363b47848bb MD5 | raw file
 1/** 
 2 * @file llhudeffectlookat.h
 3 * @brief LLHUDEffectLookAt 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_LLHUDEFFECTLOOKAT_H
28#define LL_LLHUDEFFECTLOOKAT_H
29
30#include "llhudeffect.h"
31
32class LLViewerObject;
33class LLVOAvatar;
34class LLAttentionSet;
35
36typedef enum e_lookat_type
37{
38	LOOKAT_TARGET_NONE,
39	LOOKAT_TARGET_IDLE,
40	LOOKAT_TARGET_AUTO_LISTEN,
41	LOOKAT_TARGET_FREELOOK,
42	LOOKAT_TARGET_RESPOND,
43	LOOKAT_TARGET_HOVER,
44	LOOKAT_TARGET_CONVERSATION,
45	LOOKAT_TARGET_SELECT,
46	LOOKAT_TARGET_FOCUS,
47	LOOKAT_TARGET_MOUSELOOK,
48	LOOKAT_TARGET_CLEAR,
49	LOOKAT_NUM_TARGETS
50} ELookAtType;
51
52class LLHUDEffectLookAt : public LLHUDEffect
53{
54public:
55	friend class LLHUDObject;
56
57	/*virtual*/ void markDead();
58	/*virtual*/ void setSourceObject(LLViewerObject* objectp);
59
60	BOOL setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position);
61	void clearLookAtTarget();
62
63	ELookAtType getLookAtType() { return mTargetType; }
64	const LLVector3& getTargetPos() { return mTargetPos; }
65	const LLVector3d& getTargetOffset() { return mTargetOffsetGlobal; }
66	bool calcTargetPosition();
67
68protected:
69	LLHUDEffectLookAt(const U8 type);
70	~LLHUDEffectLookAt();
71
72	/*virtual*/ void update();
73	/*virtual*/ void render();
74	/*virtual*/ void packData(LLMessageSystem *mesgsys);
75	/*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum);
76	
77	// lookat behavior has either target position or target object with offset
78	void setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset);
79	void setTargetPosGlobal(const LLVector3d &target_pos_global);
80
81public:
82	static BOOL sDebugLookAt;
83
84private:
85	ELookAtType					mTargetType;
86	LLVector3d					mTargetOffsetGlobal;
87	LLVector3					mLastSentOffsetGlobal;
88	F32							mKillTime;
89	LLFrameTimer				mTimer;
90	LLVector3					mTargetPos;
91	F32							mLastSendTime;
92	LLAttentionSet*				mAttentions;
93};
94
95#endif // LL_LLHUDEFFECTLOOKAT_H