PageRenderTime 233ms CodeModel.GetById 100ms app.highlight 6ms RepoModel.GetById 125ms 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
 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
27#include "llviewerprecompiledheaders.h"
28
29#include "lldrawpoolground.h"
30
31#include "llviewercontrol.h"
32
33#include "lldrawable.h"
34#include "llface.h"
35#include "llsky.h"
36#include "llviewercamera.h"
37#include "llviewerwindow.h"
38#include "llworld.h"
39#include "pipeline.h"
40#include "llagent.h"
41#include "llviewerregion.h"
42#include "llviewershadermgr.h"
43
44LLDrawPoolGround::LLDrawPoolGround() :
45	LLFacePool(POOL_GROUND)
46{
47}
48
49LLDrawPool *LLDrawPoolGround::instancePool()
50{
51	return new LLDrawPoolGround();
52}
53
54void LLDrawPoolGround::prerender()
55{
56	mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT);
57}
58
59void LLDrawPoolGround::render(S32 pass)
60{
61	if (mDrawFace.empty() || !gSavedSettings.getBOOL("RenderGround"))
62	{
63		return;
64	}	
65	
66	LLGLSPipelineSkyBox gls_skybox;
67	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
68
69	LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
70
71	LLGLSquashToFarClip far_clip(glh_get_current_projection());
72
73	F32 water_height = gAgent.getRegion()->getWaterHeight();
74	gGL.pushMatrix();
75	LLVector3 origin = LLViewerCamera::getInstance()->getOrigin();
76	gGL.translatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height));
77
78	LLFace *facep = mDrawFace[0];
79
80	gPipeline.disableLights();
81
82	LLOverrideFaceColor col(this, gSky.mVOSkyp->getGLFogColor());
83	facep->renderIndexed();
84	
85	gGL.popMatrix();
86}
87