PageRenderTime 351ms CodeModel.GetById 167ms app.highlight 8ms RepoModel.GetById 123ms app.codeStats 0ms

/indra/newview/llhudeffectblob.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 98 lines | 55 code | 18 blank | 25 comment | 1 complexity | 8352b84d644a6c53dc96ab19a2620d3c MD5 | raw file
 1/** 
 2 * @file llhudeffecttrail.cpp
 3 * @brief LLHUDEffectSpiral class implementation
 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#include "llviewerprecompiledheaders.h"
28
29#include "llhudeffectblob.h"
30
31#include "llagent.h"
32#include "llviewercamera.h"
33#include "llui.h"
34
35LLHUDEffectBlob::LLHUDEffectBlob(const U8 type) 
36:	LLHUDEffect(type), 
37	mPixelSize(10)
38{
39	mTimer.start();
40	mImage = LLUI::getUIImage("Camera_Drag_Dot");
41}
42
43LLHUDEffectBlob::~LLHUDEffectBlob()
44{
45}
46
47void LLHUDEffectBlob::markDead()
48{
49	mImage = NULL;
50
51	LLHUDEffect::markDead();
52}
53
54void LLHUDEffectBlob::render()
55{
56	F32 time = mTimer.getElapsedTimeF32();
57	if (mDuration < time)
58	{
59		markDead();
60		return;
61	}
62
63	LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(mPositionGlobal);
64
65	LLVector3 pixel_up, pixel_right;
66
67	LLViewerCamera::instance().getPixelVectors(pos_agent, pixel_up, pixel_right);
68
69	LLGLSPipelineAlpha gls_pipeline_alpha;
70	gGL.getTexUnit(0)->bind(mImage->getImage());
71
72	LLColor4U color = mColor;
73	color.mV[VALPHA] = (U8)clamp_rescale(time, 0.f, mDuration, 255.f, 0.f);
74	gGL.color4ubv(color.mV);
75
76	{ gGL.pushMatrix();
77		gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
78		LLVector3 u_scale = pixel_right * (F32)mPixelSize;
79		LLVector3 v_scale = pixel_up * (F32)mPixelSize;
80		
81		{ gGL.begin(LLRender::QUADS);
82			gGL.texCoord2f(0.f, 1.f);
83			gGL.vertex3fv((v_scale - u_scale).mV);
84			gGL.texCoord2f(0.f, 0.f);
85			gGL.vertex3fv((-v_scale - u_scale).mV);
86			gGL.texCoord2f(1.f, 0.f);
87			gGL.vertex3fv((-v_scale + u_scale).mV);
88			gGL.texCoord2f(1.f, 1.f);
89			gGL.vertex3fv((v_scale + u_scale).mV);
90		} gGL.end();
91
92	} gGL.popMatrix();
93}
94
95void LLHUDEffectBlob::renderForTimer()
96{
97}
98