Annotation of /trunk/linden/indra/newview/llvovolume.h
Parent Directory
|
Revision Log
Revision 58 -
(view)
(download)
Original Path: linden_release/linden/indra/newview/llvovolume.h
| 1 : | mjm | 57 | /** |
| 2 : | * @file llvovolume.h | ||
| 3 : | * @brief LLVOVolume class header file | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | * Copyright (c) 2001-2008, 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 http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 21 : | * | ||
| 22 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 23 : | * that you have read and understood your obligations described above, | ||
| 24 : | * and agree to abide by those obligations. | ||
| 25 : | * | ||
| 26 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 27 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 28 : | * COMPLETENESS OR PERFORMANCE. | ||
| 29 : | * $/LicenseInfo$ | ||
| 30 : | */ | ||
| 31 : | |||
| 32 : | #ifndef LL_LLVOVOLUME_H | ||
| 33 : | #define LL_LLVOVOLUME_H | ||
| 34 : | |||
| 35 : | #include "llviewerobject.h" | ||
| 36 : | #include "llviewerimage.h" | ||
| 37 : | #include "llframetimer.h" | ||
| 38 : | #include "llapr.h" | ||
| 39 : | #include <map> | ||
| 40 : | |||
| 41 : | class LLViewerTextureAnim; | ||
| 42 : | class LLDrawPool; | ||
| 43 : | class LLSelectNode; | ||
| 44 : | |||
| 45 : | enum LLVolumeInterfaceType | ||
| 46 : | { | ||
| 47 : | INTERFACE_FLEXIBLE = 1, | ||
| 48 : | }; | ||
| 49 : | |||
| 50 : | // Base class for implementations of the volume - Primitive, Flexible Object, etc. | ||
| 51 : | class LLVolumeInterface | ||
| 52 : | { | ||
| 53 : | public: | ||
| 54 : | virtual ~LLVolumeInterface() { } | ||
| 55 : | virtual LLVolumeInterfaceType getInterfaceType() const = 0; | ||
| 56 : | virtual BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) = 0; | ||
| 57 : | virtual BOOL doUpdateGeometry(LLDrawable *drawable) = 0; | ||
| 58 : | virtual LLVector3 getPivotPosition() const = 0; | ||
| 59 : | virtual void onSetVolume(const LLVolumeParams &volume_params, const S32 detail) = 0; | ||
| 60 : | virtual void onSetScale(const LLVector3 &scale, BOOL damped) = 0; | ||
| 61 : | virtual void onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin) = 0; | ||
| 62 : | virtual void onShift(const LLVector3 &shift_vector) = 0; | ||
| 63 : | virtual bool isVolumeUnique() const = 0; // Do we need a unique LLVolume instance? | ||
| 64 : | virtual bool isVolumeGlobal() const = 0; // Are we in global space? | ||
| 65 : | virtual bool isActive() const = 0; // Is this object currently active? | ||
| 66 : | virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const = 0; | ||
| 67 : | virtual void updateRelativeXform() = 0; | ||
| 68 : | virtual U32 getID() const = 0; | ||
| 69 : | virtual void preRebuild() = 0; | ||
| 70 : | }; | ||
| 71 : | |||
| 72 : | // Class which embodies all Volume objects (with pcode LL_PCODE_VOLUME) | ||
| 73 : | class LLVOVolume : public LLViewerObject | ||
| 74 : | { | ||
| 75 : | protected: | ||
| 76 : | virtual ~LLVOVolume(); | ||
| 77 : | |||
| 78 : | public: | ||
| 79 : | static void initClass(); | ||
| 80 : | static void preUpdateGeom(); | ||
| 81 : | |||
| 82 : | enum | ||
| 83 : | { | ||
| 84 : | VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) | | ||
| 85 : | (1 << LLVertexBuffer::TYPE_NORMAL) | | ||
| 86 : | (1 << LLVertexBuffer::TYPE_TEXCOORD) | | ||
| 87 : | (1 << LLVertexBuffer::TYPE_TEXCOORD2) | | ||
| 88 : | (1 << LLVertexBuffer::TYPE_COLOR) | ||
| 89 : | }; | ||
| 90 : | |||
| 91 : | public: | ||
| 92 : | LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); | ||
| 93 : | |||
| 94 : | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | ||
| 95 : | |||
| 96 : | void deleteFaces(); | ||
| 97 : | |||
| 98 : | void animateTextures(); | ||
| 99 : | /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); | ||
| 100 : | |||
| 101 : | /*virtual*/ BOOL isActive() const; | ||
| 102 : | /*virtual*/ BOOL isAttachment() const; | ||
| 103 : | /*virtual*/ BOOL isRootEdit() const; // overridden for sake of attachments treating themselves as a root object | ||
| 104 : | /*virtual*/ BOOL isHUDAttachment() const; | ||
| 105 : | |||
| 106 : | void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point); | ||
| 107 : | /*virtual*/ void setParent(LLViewerObject* parent); | ||
| 108 : | S32 getLOD() const { return mLOD; } | ||
| 109 : | const LLVector3 getPivotPositionAgent() const; | ||
| 110 : | const LLMatrix4& getRelativeXform() const { return mRelativeXform; } | ||
| 111 : | const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; } | ||
| 112 : | /*virtual*/ const LLMatrix4 getRenderMatrix() const; | ||
| 113 : | |||
| 114 : | |||
| 115 : | /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, | ||
| 116 : | S32 face = -1, // which face to check, -1 = ALL_SIDES | ||
| 117 : | S32* face_hit = NULL, // which face was hit | ||
| 118 : | LLVector3* intersection = NULL, // return the intersection point | ||
| 119 : | LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point | ||
| 120 : | LLVector3* normal = NULL, // return the surface normal at the intersection point | ||
| 121 : | LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point | ||
| 122 : | ); | ||
| 123 : | |||
| 124 : | LLVector3 agentPositionToVolume(const LLVector3& pos) const; | ||
| 125 : | LLVector3 agentDirectionToVolume(const LLVector3& dir) const; | ||
| 126 : | LLVector3 volumePositionToAgent(const LLVector3& dir) const; | ||
| 127 : | LLVector3 volumeDirectionToAgent(const LLVector3& dir) const; | ||
| 128 : | |||
| 129 : | |||
| 130 : | BOOL getVolumeChanged() const { return mVolumeChanged; } | ||
| 131 : | F32 getTextureVirtualSize(LLFace* face); | ||
| 132 : | /*virtual*/ F32 getRadius() const { return mVObjRadius; }; | ||
| 133 : | const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const; | ||
| 134 : | |||
| 135 : | void markForUpdate(BOOL priority) { LLViewerObject::markForUpdate(priority); mVolumeChanged = TRUE; } | ||
| 136 : | |||
| 137 : | /*virtual*/ void onShift(const LLVector3 &shift_vector); // Called when the drawable shifts | ||
| 138 : | |||
| 139 : | /*virtual*/ void parameterChanged(U16 param_type, bool local_origin); | ||
| 140 : | /*virtual*/ void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin); | ||
| 141 : | |||
| 142 : | /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys, | ||
| 143 : | void **user_data, | ||
| 144 : | U32 block_num, const EObjectUpdateType update_type, | ||
| 145 : | LLDataPacker *dp); | ||
| 146 : | |||
| 147 : | /*virtual*/ void setSelected(BOOL sel); | ||
| 148 : | /*virtual*/ BOOL setDrawableParent(LLDrawable* parentp); | ||
| 149 : | |||
| 150 : | /*virtual*/ void setScale(const LLVector3 &scale, BOOL damped); | ||
| 151 : | |||
| 152 : | /*virtual*/ void setTEImage(const U8 te, LLViewerImage *imagep); | ||
| 153 : | /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid); | ||
| 154 : | /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color); | ||
| 155 : | /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color); | ||
| 156 : | /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump); | ||
| 157 : | /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny); | ||
| 158 : | /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright); | ||
| 159 : | /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags); | ||
| 160 : | /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow); | ||
| 161 : | /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); | ||
| 162 : | /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s); | ||
| 163 : | /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t); | ||
| 164 : | /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen); | ||
| 165 : | /*virtual*/ BOOL setMaterial(const U8 material); | ||
| 166 : | |||
| 167 : | void setTexture(const S32 face); | ||
| 168 : | |||
| 169 : | /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); | ||
| 170 : | void sculpt(); | ||
| 171 : | void updateRelativeXform(); | ||
| 172 : | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | ||
| 173 : | /*virtual*/ void updateFaceSize(S32 idx); | ||
| 174 : | /*virtual*/ BOOL updateLOD(); | ||
| 175 : | void updateRadius(); | ||
| 176 : | /*virtual*/ void updateTextures(LLAgent &agent); | ||
| 177 : | void updateTextures(); | ||
| 178 : | |||
| 179 : | void updateFaceFlags(); | ||
| 180 : | void regenFaces(); | ||
| 181 : | BOOL genBBoxes(BOOL force_global); | ||
| 182 : | void preRebuild(); | ||
| 183 : | virtual void updateSpatialExtents(LLVector3& min, LLVector3& max); | ||
| 184 : | virtual F32 getBinRadius(); | ||
| 185 : | |||
| 186 : | virtual U32 getPartitionType() const; | ||
| 187 : | |||
| 188 : | // For Lights | ||
| 189 : | void setIsLight(BOOL is_light); | ||
| 190 : | void setLightColor(const LLColor3& color); | ||
| 191 : | void setLightIntensity(F32 intensity); | ||
| 192 : | void setLightRadius(F32 radius); | ||
| 193 : | void setLightFalloff(F32 falloff); | ||
| 194 : | void setLightCutoff(F32 cutoff); | ||
| 195 : | BOOL getIsLight() const; | ||
| 196 : | LLColor3 getLightBaseColor() const; // not scaled by intensity | ||
| 197 : | LLColor3 getLightColor() const; // scaled by intensity | ||
| 198 : | F32 getLightIntensity() const; | ||
| 199 : | F32 getLightRadius() const; | ||
| 200 : | F32 getLightFalloff() const; | ||
| 201 : | F32 getLightCutoff() const; | ||
| 202 : | |||
| 203 : | // Flexible Objects | ||
| 204 : | U32 getVolumeInterfaceID() const; | ||
| 205 : | virtual BOOL isFlexible() const; | ||
| 206 : | virtual BOOL isSculpted() const; | ||
| 207 : | BOOL isVolumeGlobal() const; | ||
| 208 : | BOOL canBeFlexible() const; | ||
| 209 : | BOOL setIsFlexible(BOOL is_flexible); | ||
| 210 : | |||
| 211 : | protected: | ||
| 212 : | S32 computeLODDetail(F32 distance, F32 radius); | ||
| 213 : | BOOL calcLOD(); | ||
| 214 : | LLFace* addFace(S32 face_index); | ||
| 215 : | void updateTEData(); | ||
| 216 : | |||
| 217 : | public: | ||
| 218 : | LLViewerTextureAnim *mTextureAnimp; | ||
| 219 : | U8 mTexAnimMode; | ||
| 220 : | private: | ||
| 221 : | friend class LLDrawable; | ||
| 222 : | |||
| 223 : | BOOL mFaceMappingChanged; | ||
| 224 : | LLFrameTimer mTextureUpdateTimer; | ||
| 225 : | S32 mLOD; | ||
| 226 : | BOOL mLODChanged; | ||
| 227 : | S32 mSculptLevel; | ||
| 228 : | BOOL mSculptChanged; | ||
| 229 : | LLMatrix4 mRelativeXform; | ||
| 230 : | LLMatrix3 mRelativeXformInvTrans; | ||
| 231 : | BOOL mVolumeChanged; | ||
| 232 : | F32 mVObjRadius; | ||
| 233 : | LLVolumeInterface *mVolumeImpl; | ||
| 234 : | LLPointer<LLViewerImage> mSculptTexture; | ||
| 235 : | |||
| 236 : | // statics | ||
| 237 : | public: | ||
| 238 : | static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop | ||
| 239 : | static F32 sLODFactor; // LOD scale factor | ||
| 240 : | static F32 sDistanceFactor; // LOD distance factor | ||
| 241 : | |||
| 242 : | protected: | ||
| 243 : | static S32 sNumLODChanges; | ||
| 244 : | |||
| 245 : | friend class LLVolumeImplFlexible; | ||
| 246 : | }; | ||
| 247 : | |||
| 248 : | #endif // LL_LLVOVOLUME_H |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

