lldrawpoolclouds.cpp
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:3k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. /** 
  2.  * @file lldrawpoolclouds.cpp
  3.  * @brief LLDrawPoolClouds class implementation
  4.  *
  5.  * $LicenseInfo:firstyear=2006&license=viewergpl$
  6.  * 
  7.  * Copyright (c) 2006-2010, Linden Research, Inc.
  8.  * 
  9.  * Second Life Viewer Source Code
  10.  * The source code in this file ("Source Code") is provided by Linden Lab
  11.  * to you under the terms of the GNU General Public License, version 2.0
  12.  * ("GPL"), unless you have obtained a separate licensing agreement
  13.  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  14.  * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15.  * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16.  * 
  17.  * There are special exceptions to the terms and conditions of the GPL as
  18.  * it is applied to this Source Code. View the full text of the exception
  19.  * in the file doc/FLOSS-exception.txt in this software distribution, or
  20.  * online at
  21.  * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22.  * 
  23.  * By copying, modifying or distributing this software, you acknowledge
  24.  * that you have read and understood your obligations described above,
  25.  * and agree to abide by those obligations.
  26.  * 
  27.  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28.  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29.  * COMPLETENESS OR PERFORMANCE.
  30.  * $/LicenseInfo$
  31.  */
  32. #include "llviewerprecompiledheaders.h"
  33. #include "lldrawpoolclouds.h"
  34. #include "llface.h"
  35. #include "llsky.h"
  36. #include "llviewercamera.h"
  37. #include "llvoclouds.h"
  38. #include "pipeline.h"
  39. LLDrawPoolClouds::LLDrawPoolClouds() :
  40. LLDrawPool(POOL_CLOUDS)
  41. {
  42. }
  43. LLDrawPool *LLDrawPoolClouds::instancePool()
  44. {
  45. return new LLDrawPoolClouds();
  46. }
  47. BOOL LLDrawPoolClouds::addFace(LLFace* face)
  48. {
  49. llerrs << "WTF?" << llendl;
  50. return FALSE;
  51. }
  52. void LLDrawPoolClouds::enqueue(LLFace *facep)
  53. {
  54. mDrawFace.push_back(facep);
  55. facep->mDistance = (facep->mCenterAgent - gCamera->getOrigin()) * gCamera->getAtAxis();
  56. }
  57. void LLDrawPoolClouds::beginRenderPass(S32 pass)
  58. {
  59. glEnableClientState(GL_VERTEX_ARRAY);
  60. glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  61. glEnableClientState(GL_NORMAL_ARRAY);
  62. }
  63. void LLDrawPoolClouds::prerender()
  64. {
  65. mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT);
  66. }
  67. void LLDrawPoolClouds::render(S32 pass)
  68. {
  69. LLFastTimer ftm(LLFastTimer::FTM_RENDER_CLOUDS);
  70.   if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS)))
  71. {
  72. return;
  73. }
  74. if (mDrawFace.empty())
  75. {
  76. return;
  77. }
  78. LLGLSPipelineAlpha gls_pipeline_alpha;
  79. LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
  80. glAlphaFunc(GL_GREATER,0.01f);
  81. gPipeline.enableLightsFullbright(LLColor4(1.f,1.f,1.f));
  82. mDrawFace[0]->bindTexture();
  83. std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater());
  84. drawLoop();
  85. }
  86. void LLDrawPoolClouds::renderForSelect()
  87. {
  88. }