PageRenderTime 344ms CodeModel.GetById 181ms app.highlight 7ms RepoModel.GetById 154ms app.codeStats 0ms

/indra/newview/llsky.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 118 lines | 64 code | 27 blank | 27 comment | 0 complexity | a7507dc8487d82499fbee6352c443a34 MD5 | raw file
  1/** 
  2 * @file llsky.h
  3 * @brief It's, uh, the sky!
  4 *
  5 * $LicenseInfo:firstyear=2001&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#ifndef LL_LLSKY_H
 28#define LL_LLSKY_H
 29
 30#include "llmath.h"
 31//#include "vmath.h"
 32#include "v3math.h"
 33#include "v4math.h"
 34#include "v4color.h"
 35#include "v4coloru.h"
 36#include "llvosky.h"
 37#include "llvoground.h"
 38
 39class LLViewerCamera;
 40
 41class LLVOWLSky;
 42class LLVOWLClouds;
 43
 44
 45class LLSky  
 46{
 47public:
 48	LLSky();
 49	~LLSky();
 50
 51	void init(const LLVector3 &sun_direction);
 52
 53	void cleanup();
 54
 55	void setOverrideSun(BOOL override);
 56	BOOL getOverrideSun() { return mOverrideSimSunPosition; }
 57	void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity);
 58	void setSunTargetDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity);
 59
 60	LLColor4 getFogColor() const;
 61
 62	void setCloudDensityAtAgent(F32 cloud_density);
 63	void setWind(const LLVector3& wind);
 64
 65	void updateFog(const F32 distance);
 66	void updateCull();
 67	void updateSky();
 68
 69	void propagateHeavenlyBodies(F32 dt);					// dt = seconds
 70
 71	S32  mLightingGeneration;
 72	BOOL mUpdatedThisFrame;
 73
 74	void setFogRatio(const F32 fog_ratio);		// Fog distance as fraction of cull distance.
 75	F32 getFogRatio() const;
 76	LLColor4U getFadeColor() const;
 77
 78	LLVector3 getSunDirection() const;
 79	LLVector3 getMoonDirection() const;
 80	LLColor4 getSunDiffuseColor() const;
 81	LLColor4 getMoonDiffuseColor() const;
 82	LLColor4 getSunAmbientColor() const;
 83	LLColor4 getMoonAmbientColor() const;
 84	LLColor4 getTotalAmbientColor() const;
 85	BOOL sunUp() const;
 86
 87	F32 getSunPhase() const;
 88	void setSunPhase(const F32 phase);
 89
 90	void destroyGL();
 91	void restoreGL();
 92	void resetVertexBuffers();
 93
 94public:
 95	LLPointer<LLVOSky>		mVOSkyp;	// Pointer to the LLVOSky object (only one, ever!)
 96	LLPointer<LLVOGround>	mVOGroundp;
 97
 98	LLPointer<LLVOWLSky>	mVOWLSkyp;
 99
100	LLVector3 mSunTargDir;
101
102	// Legacy stuff
103	LLVector3 mSunDefaultPosition;
104
105	static const F32 NIGHTTIME_ELEVATION;	// degrees
106	static const F32 NIGHTTIME_ELEVATION_COS;
107
108protected:
109	BOOL			mOverrideSimSunPosition;
110
111	F32				mSunPhase;
112	LLColor4		mFogColor;				// Color to use for fog and haze
113
114	LLVector3		mLastSunDirection;
115};
116
117extern LLSky    gSky;
118#endif