PageRenderTime 31ms CodeModel.GetById 13ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/llvosurfacepatch.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 137 lines | 90 code | 21 blank | 26 comment | 0 complexity | 401cc0af5fb7efb1ab2d636b9b13450c MD5 | raw file
  1/** 
  2 * @file llvosurfacepatch.h
  3 * @brief Description of LLVOSurfacePatch 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_VOSURFACEPATCH_H
 28#define LL_VOSURFACEPATCH_H
 29
 30#include "llviewerobject.h"
 31#include "llstrider.h"
 32
 33class LLSurfacePatch;
 34class LLDrawPool;
 35class LLVector2;
 36
 37class LLVOSurfacePatch : public LLStaticViewerObject
 38{
 39public:
 40	static F32 sLODFactor;
 41
 42	enum
 43	{
 44		VERTEX_DATA_MASK =	(1 << LLVertexBuffer::TYPE_VERTEX) |
 45							(1 << LLVertexBuffer::TYPE_NORMAL) |
 46							(1 << LLVertexBuffer::TYPE_TEXCOORD0) |
 47							(1 << LLVertexBuffer::TYPE_TEXCOORD1)
 48	};
 49
 50	LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
 51
 52	/*virtual*/ void markDead();
 53
 54	// Initialize data that's only inited once per class.
 55	static void initClass();
 56
 57	virtual U32 getPartitionType() const;
 58
 59	/*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
 60	/*virtual*/ void		updateGL();
 61	/*virtual*/ BOOL        updateGeometry(LLDrawable *drawable);
 62	/*virtual*/ BOOL		updateLOD();
 63	/*virtual*/ void		updateFaceSize(S32 idx);
 64	void getGeometry(LLStrider<LLVector3> &verticesp,
 65								LLStrider<LLVector3> &normalsp,
 66								LLStrider<LLVector2> &texCoords0p,
 67								LLStrider<LLVector2> &texCoords1p,
 68								LLStrider<U16> &indicesp);
 69
 70	/*virtual*/ void updateTextures();
 71	/*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
 72
 73	/*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
 74	/*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
 75
 76	void setPatch(LLSurfacePatch *patchp);
 77	LLSurfacePatch	*getPatch() const		{ return mPatchp; }
 78
 79	void dirtyPatch();
 80	void dirtyGeom();
 81
 82	/*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, 
 83										  S32 face = -1,                        // which face to check, -1 = ALL_SIDES
 84										  BOOL pick_transparent = FALSE,
 85										  S32* face_hit = NULL,                 // which face was hit
 86										  LLVector3* intersection = NULL,       // return the intersection point
 87										  LLVector2* tex_coord = NULL,          // return the texture coordinates of the intersection point
 88										  LLVector3* normal = NULL,             // return the surface normal at the intersection point
 89										  LLVector3* bi_normal = NULL           // return the surface bi-normal at the intersection point
 90		);
 91
 92	BOOL			mDirtiedPatch;
 93protected:
 94	~LLVOSurfacePatch();
 95
 96	LLFacePool		*mPool;
 97	LLFacePool		*getPool();
 98	S32				mBaseComp;
 99	LLSurfacePatch	*mPatchp;
100	BOOL			mDirtyTexture;
101	BOOL			mDirtyTerrain;
102
103	S32				mLastNorthStride;
104	S32				mLastEastStride;
105	S32				mLastStride;
106	S32				mLastLength;
107
108	void getGeomSizesMain(const S32 stride, S32 &num_vertices, S32 &num_indices);
109	void getGeomSizesNorth(const S32 stride, const S32 north_stride,
110								  S32 &num_vertices, S32 &num_indices);
111	void getGeomSizesEast(const S32 stride, const S32 east_stride,
112								 S32 &num_vertices, S32 &num_indices);
113
114	void updateMainGeometry(LLFace *facep,
115					   LLStrider<LLVector3> &verticesp,
116					   LLStrider<LLVector3> &normalsp,
117					   LLStrider<LLVector2> &texCoords0p,
118					   LLStrider<LLVector2> &texCoords1p,
119					   LLStrider<U16> &indicesp,
120					   U32 &index_offset);
121	void updateNorthGeometry(LLFace *facep,
122					   LLStrider<LLVector3> &verticesp,
123					   LLStrider<LLVector3> &normalsp,
124					   LLStrider<LLVector2> &texCoords0p,
125					   LLStrider<LLVector2> &texCoords1p,
126					   LLStrider<U16> &indicesp,
127					   U32 &index_offset);
128	void updateEastGeometry(LLFace *facep,
129					   LLStrider<LLVector3> &verticesp,
130					   LLStrider<LLVector3> &normalsp,
131					   LLStrider<LLVector2> &texCoords0p,
132					   LLStrider<LLVector2> &texCoords1p,
133					   LLStrider<U16> &indicesp,
134					   U32 &index_offset);
135};
136
137#endif // LL_VOSURFACEPATCH_H