PageRenderTime 32ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/lldrawpoolground.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 87 lines | 45 code | 17 blank | 25 comment | 2 complexity | b374c7f88ca582e6b760057f8a2c846b MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lldrawpoolground.cpp
  3. * @brief LLDrawPoolGround 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 "lldrawpoolground.h"
  28. #include "llviewercontrol.h"
  29. #include "lldrawable.h"
  30. #include "llface.h"
  31. #include "llsky.h"
  32. #include "llviewercamera.h"
  33. #include "llviewerwindow.h"
  34. #include "llworld.h"
  35. #include "pipeline.h"
  36. #include "llagent.h"
  37. #include "llviewerregion.h"
  38. #include "llviewershadermgr.h"
  39. LLDrawPoolGround::LLDrawPoolGround() :
  40. LLFacePool(POOL_GROUND)
  41. {
  42. }
  43. LLDrawPool *LLDrawPoolGround::instancePool()
  44. {
  45. return new LLDrawPoolGround();
  46. }
  47. void LLDrawPoolGround::prerender()
  48. {
  49. mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT);
  50. }
  51. void LLDrawPoolGround::render(S32 pass)
  52. {
  53. if (mDrawFace.empty() || !gSavedSettings.getBOOL("RenderGround"))
  54. {
  55. return;
  56. }
  57. LLGLSPipelineSkyBox gls_skybox;
  58. gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
  59. LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
  60. LLGLSquashToFarClip far_clip(glh_get_current_projection());
  61. F32 water_height = gAgent.getRegion()->getWaterHeight();
  62. gGL.pushMatrix();
  63. LLVector3 origin = LLViewerCamera::getInstance()->getOrigin();
  64. gGL.translatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height));
  65. LLFace *facep = mDrawFace[0];
  66. gPipeline.disableLights();
  67. LLOverrideFaceColor col(this, gSky.mVOSkyp->getGLFogColor());
  68. facep->renderIndexed();
  69. gGL.popMatrix();
  70. }