/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. #include "llviewerprecompiledheaders.h"
  27. #include "llhudeffectblob.h"
  28. #include "llagent.h"
  29. #include "llviewercamera.h"
  30. #include "llui.h"
  31. LLHUDEffectBlob::LLHUDEffectBlob(const U8 type)
  32. : LLHUDEffect(type),
  33. mPixelSize(10)
  34. {
  35. mTimer.start();
  36. mImage = LLUI::getUIImage("Camera_Drag_Dot");
  37. }
  38. LLHUDEffectBlob::~LLHUDEffectBlob()
  39. {
  40. }
  41. void LLHUDEffectBlob::markDead()
  42. {
  43. mImage = NULL;
  44. LLHUDEffect::markDead();
  45. }
  46. void LLHUDEffectBlob::render()
  47. {
  48. F32 time = mTimer.getElapsedTimeF32();
  49. if (mDuration < time)
  50. {
  51. markDead();
  52. return;
  53. }
  54. LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(mPositionGlobal);
  55. LLVector3 pixel_up, pixel_right;
  56. LLViewerCamera::instance().getPixelVectors(pos_agent, pixel_up, pixel_right);
  57. LLGLSPipelineAlpha gls_pipeline_alpha;
  58. gGL.getTexUnit(0)->bind(mImage->getImage());
  59. LLColor4U color = mColor;
  60. color.mV[VALPHA] = (U8)clamp_rescale(time, 0.f, mDuration, 255.f, 0.f);
  61. gGL.color4ubv(color.mV);
  62. { gGL.pushMatrix();
  63. gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]);
  64. LLVector3 u_scale = pixel_right * (F32)mPixelSize;
  65. LLVector3 v_scale = pixel_up * (F32)mPixelSize;
  66. { gGL.begin(LLRender::QUADS);
  67. gGL.texCoord2f(0.f, 1.f);
  68. gGL.vertex3fv((v_scale - u_scale).mV);
  69. gGL.texCoord2f(0.f, 0.f);
  70. gGL.vertex3fv((-v_scale - u_scale).mV);
  71. gGL.texCoord2f(1.f, 0.f);
  72. gGL.vertex3fv((-v_scale + u_scale).mV);
  73. gGL.texCoord2f(1.f, 1.f);
  74. gGL.vertex3fv((v_scale + u_scale).mV);
  75. } gGL.end();
  76. } gGL.popMatrix();
  77. }
  78. void LLHUDEffectBlob::renderForTimer()
  79. {
  80. }