PageRenderTime 13ms CodeModel.GetById 2ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llvograss.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 124 lines | 73 code | 25 blank | 26 comment | 0 complexity | 5d66b04e16ffad183091f009dd6acc99 MD5 | raw file
  1/** 
  2 * @file llvograss.h
  3 * @brief Description of LLVOGrass class
  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_LLVOGRASS_H
 28#define LL_LLVOGRASS_H
 29
 30#include "llviewerobject.h"
 31#include "lldarray.h"
 32#include <map>
 33
 34class LLSurfacePatch;
 35class LLViewerTexture;
 36
 37
 38class LLVOGrass : public LLAlphaObject
 39{
 40public:
 41	LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
 42
 43	// Initialize data that's only inited once per class.
 44	static void initClass();
 45	static void cleanupClass();
 46
 47	virtual U32 getPartitionType() const;
 48
 49	/*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
 50											void **user_data,
 51											U32 block_num, 
 52											const EObjectUpdateType update_type,
 53											LLDataPacker *dp);
 54	static void import(LLFILE *file, LLMessageSystem *mesgsys, const LLVector3 &pos);
 55	/*virtual*/ void exportFile(LLFILE *file, const LLVector3 &position);
 56
 57	void updateDrawable(BOOL force_damped);
 58
 59	/*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
 60	/*virtual*/ BOOL		updateGeometry(LLDrawable *drawable);
 61	/*virtual*/ void		getGeometry(S32 idx,
 62								LLStrider<LLVector4a>& verticesp,
 63								LLStrider<LLVector3>& normalsp, 
 64								LLStrider<LLVector2>& texcoordsp,
 65								LLStrider<LLColor4U>& colorsp, 
 66								LLStrider<U16>& indicesp);
 67
 68	void updateFaceSize(S32 idx) { }
 69	/*virtual*/ void updateTextures();											
 70	/*virtual*/ BOOL updateLOD();
 71	/*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
 72
 73	void plantBlades();
 74
 75	/*virtual*/ BOOL    isActive() const; // Whether this object needs to do an idleUpdate.
 76	BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
 77
 78	/*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, 
 79										  S32 face = -1,                        // which face to check, -1 = ALL_SIDES
 80										  BOOL pick_transparent = FALSE,
 81										  S32* face_hit = NULL,                 // which face was hit
 82										  LLVector3* intersection = NULL,       // return the intersection point
 83										  LLVector2* tex_coord = NULL,          // return the texture coordinates of the intersection point
 84										  LLVector3* normal = NULL,             // return the surface normal at the intersection point
 85										  LLVector3* bi_normal = NULL           // return the surface bi-normal at the intersection point
 86		);
 87
 88	static S32 sMaxGrassSpecies;
 89
 90	struct GrassSpeciesData
 91	{
 92		LLUUID	mTextureID;
 93		
 94		F32		mBladeSizeX;
 95		F32		mBladeSizeY;
 96	};
 97
 98	typedef std::map<U32, GrassSpeciesData*> SpeciesMap;
 99
100	U8				mSpecies;		// Species of grass
101	F32				mBladeSizeX;
102	F32				mBladeSizeY;
103	
104	LLSurfacePatch           *mPatch;			//  Stores the land patch where the grass is centered
105
106	U64 mLastPatchUpdateTime;
107
108	LLVector3		          mGrassBend;		// Accumulated wind (used for blowing trees)
109	LLVector3		          mGrassVel;		
110	LLVector3		          mWind;
111	F32				          mBladeWindAngle;
112	F32				          mBWAOverlap;
113
114protected:
115	~LLVOGrass();
116
117private:
118	void updateSpecies();
119	F32 mLastHeight;		// For cheap update hack
120	S32 mNumBlades;
121
122	static SpeciesMap sSpeciesTable;
123};
124#endif // LL_VO_GRASS_