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

/indra/newview/llhudicon.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 97 lines | 53 code | 18 blank | 26 comment | 0 complexity | 1dbf8945a108b13ae33a767dfb68bc68 MD5 | raw file
 1/** 
 2 * @file llhudicon.h
 3 * @brief LLHUDIcon class definition
 4 *
 5 * $LicenseInfo:firstyear=2006&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_LLHUDICON_H
28#define LL_LLHUDICON_H
29
30#include "llpointer.h"
31#include "lldarrayptr.h"
32
33#include "llhudobject.h"
34#include "v4color.h"
35#include "v4coloru.h"
36#include "v2math.h"
37#include "llrect.h"
38#include "llframetimer.h"
39#include "llfontgl.h"
40#include <set>
41#include <vector>
42#include "lldarray.h"
43
44// Renders a 2D icon billboard floating at the location specified.
45class LLDrawable;
46class LLViewerObject;
47class LLViewerTexture;
48
49class LLHUDIcon : public LLHUDObject
50{
51friend class LLHUDObject;
52
53public:
54	/*virtual*/ void render();
55	/*virtual*/ void markDead();
56	/*virtual*/ F32 getDistance() const { return mDistance; }
57
58	void setImage(LLViewerTexture* imagep);
59	void setScale(F32 fraction_of_fov);
60
61	void restartLifeTimer() { mLifeTimer.reset(); }
62
63	static S32 generatePickIDs(S32 start_id, S32 step_size);
64	static LLHUDIcon* handlePick(S32 pick_id);
65	static LLHUDIcon* lineSegmentIntersectAll(const LLVector3& start, const LLVector3& end, LLVector3* intersection);
66
67	static void updateAll();
68	static void cleanupDeadIcons();
69	static S32 getNumInstances();
70
71	static BOOL iconsNearby();
72
73	BOOL getHidden() const { return mHidden; }
74	void setHidden( BOOL hide ) { mHidden = hide; }
75
76	BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, LLVector3* intersection);
77
78protected:
79	LLHUDIcon(const U8 type);
80	~LLHUDIcon();
81
82	void renderIcon(BOOL for_select); // common render code
83
84private:
85	LLPointer<LLViewerTexture> mImagep;
86	LLFrameTimer	mAnimTimer;
87	LLFrameTimer	mLifeTimer;
88	F32				mDistance;
89	S32				mPickID;
90	F32				mScale;
91	BOOL			mHidden;
92
93	typedef std::vector<LLPointer<LLHUDIcon> > icon_instance_t;
94	static icon_instance_t sIconInstances;
95};
96
97#endif // LL_LLHUDICON_H