aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvovolume.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llvovolume.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llvovolume.h')
-rw-r--r--linden/indra/newview/llvovolume.h232
1 files changed, 232 insertions, 0 deletions
diff --git a/linden/indra/newview/llvovolume.h b/linden/indra/newview/llvovolume.h
new file mode 100644
index 0000000..2c12f12
--- /dev/null
+++ b/linden/indra/newview/llvovolume.h
@@ -0,0 +1,232 @@
1/**
2 * @file llvovolume.h
3 * @brief LLVOVolume class header file
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLVOVOLUME_H
29#define LL_LLVOVOLUME_H
30
31#include "llviewerobject.h"
32#include "llviewerimage.h"
33#include "llframetimer.h"
34#include "llapr.h"
35#include <map>
36
37class LLViewerTextureAnim;
38class LLDrawPool;
39class LLSelectNode;
40
41enum LLVolumeInterfaceType
42{
43 INTERFACE_FLEXIBLE = 1,
44};
45
46// Base class for implementations of the volume - Primitive, Flexible Object, etc.
47class LLVolumeInterface
48{
49public:
50 virtual ~LLVolumeInterface() { }
51 virtual LLVolumeInterfaceType getInterfaceType() const = 0;
52 virtual BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) = 0;
53 virtual BOOL doUpdateGeometry(LLDrawable *drawable) = 0;
54 virtual LLVector3 getPivotPosition() const = 0;
55 virtual void onSetVolume(const LLVolumeParams &volume_params, const S32 detail) = 0;
56 virtual void onSetScale(const LLVector3 &scale, BOOL damped) = 0;
57 virtual void onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin) = 0;
58 virtual void onShift(const LLVector3 &shift_vector) = 0;
59 virtual bool isVolumeUnique() const = 0; // Do we need a unique LLVolume instance?
60 virtual bool isVolumeGlobal() const = 0; // Are we in global space?
61 virtual bool isActive() const = 0; // Is this object currently active?
62 virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const = 0;
63 virtual void updateRelativeXform(BOOL global_volume = FALSE) = 0;
64};
65
66// Class which embodies all Volume objects (with pcode LL_PCODE_VOLUME)
67class LLVOVolume : public LLViewerObject
68{
69public:
70 static void initClass();
71 static void preUpdateGeom();
72 static F32 getTextureVirtualSize(const LLFace* face);
73
74 BOOL mWereAllTEsSame;
75
76public:
77 LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
78 virtual ~LLVOVolume();
79
80 /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
81
82 void deleteFaces(LLVOVolume* childp);
83
84 /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
85
86 /*virtual*/ BOOL isActive() const;
87 /*virtual*/ BOOL isAttachment() const;
88 /*virtual*/ BOOL isRootEdit() const; // overridden for sake of attachments treating themselves as a root object
89 /*virtual*/ BOOL isHUDAttachment() const;
90
91 void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point);
92
93 BOOL getAllTEsSame() const { return mAllTEsSame; }
94 F32 getIndividualRadius() { return mRadius; }
95 S32 getLOD() const { return mLOD; }
96 const LLVector3 getPivotPositionAgent() const;
97 const LLMatrix4& getRelativeXform() const { return mRelativeXform; }
98 const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; }
99 /*virtual*/ const LLMatrix4 getRenderMatrix() const;
100
101 /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, LLVector3& end) const;
102 LLVector3 agentPositionToVolume(const LLVector3& pos) const;
103 LLVector3 agentDirectionToVolume(const LLVector3& dir) const;
104 LLVector3 volumePositionToAgent(const LLVector3& dir) const;
105
106
107 BOOL getVolumeChanged() const { return mVolumeChanged; }
108 /*virtual*/ F32 getRadius() const { return mVObjRadius; };
109 const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const;
110
111 void markForUpdate(BOOL priority) { LLViewerObject::markForUpdate(priority); mVolumeChanged = TRUE; }
112
113 /*virtual*/ void onShift(const LLVector3 &shift_vector); // Called when the drawable shifts
114
115 /*virtual*/ void parameterChanged(U16 param_type, bool local_origin);
116 /*virtual*/ void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin);
117
118 /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
119 void **user_data,
120 U32 block_num, const EObjectUpdateType update_type,
121 LLDataPacker *dp);
122
123 /*virtual*/ BOOL setDrawableParent(LLDrawable* parentp);
124
125 /*virtual*/ void setScale(const LLVector3 &scale, BOOL damped);
126
127 /*virtual*/ void setTEImage(const U8 te, LLViewerImage *imagep);
128 /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid);
129 /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color);
130 /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump);
131 /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny);
132 /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright);
133 /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags);
134 /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t);
135 /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s);
136 /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t);
137 /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen);
138 /*virtual*/ BOOL setMaterial(const U8 material);
139
140 void setTexture(const S32 face);
141
142 /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false);
143 void updateRelativeXform(BOOL global_volume = FALSE);
144 /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
145 /*virtual*/ BOOL updateLOD();
146 void updateRadius();
147 /*virtual*/ void updateTextures(LLAgent &agent);
148 void updateTextures(S32 lod);
149
150 void updateFaceFlags();
151 void regenFaces();
152 BOOL genTriangles(BOOL force_global);
153 virtual void updateSpatialExtents(LLVector3& min, LLVector3& max);
154 virtual void writeCAL3D(apr_file_t* fp,
155 std::string& path,
156 std::string& file_base,
157 S32 joint_num,
158 LLVector3& pos,
159 LLQuaternion& rot,
160 S32& material_index,
161 S32& texture_index,
162 std::multimap<LLUUID, LLMaterialExportInfo*>& material_map);
163
164 // For Lights
165 void setIsLight(BOOL is_light);
166 void setLightColor(const LLColor3& color);
167 void setLightIntensity(F32 intensity);
168 void setLightRadius(F32 radius);
169 void setLightFalloff(F32 falloff);
170 void setLightCutoff(F32 cutoff);
171 BOOL getIsLight() const;
172 LLColor3 getLightBaseColor() const; // not scaled by intensity
173 LLColor3 getLightColor() const; // scaled by intensity
174 F32 getLightIntensity() const;
175 F32 getLightRadius() const;
176 F32 getLightFalloff() const;
177 F32 getLightCutoff() const;
178 F32 getLightDistance(const LLVector3& pos) const; // returns < 0 if inside radius
179
180 // Flexible Objects
181 virtual BOOL isFlexible() const;
182 BOOL isVolumeGlobal() const;
183 BOOL canBeFlexible() const;
184 BOOL setIsFlexible(BOOL is_flexible);
185
186 // Lighting
187 F32 calcLightAtPoint(const LLVector3& pos, const LLVector3& norm, LLColor4& result);
188 BOOL updateLighting(BOOL do_lighting);
189
190protected:
191 F32 computeLODProfilePathComplexityBias();
192 S32 computeLODDetail(F32 distance, F32 radius);
193 BOOL calcLOD();
194 void setupSingleFace(S32 face_offset); // Set up the face for combined volumes.
195 LLFace* addFace(S32 face_index);
196 void updateTEData();
197 BOOL calcAllTEsSame();
198
199public:
200 LLViewerTextureAnim *mTextureAnimp;
201
202protected:
203 friend class LLDrawable;
204
205 BOOL mAllTEsSame; // All TE's have the same pool/texture
206 BOOL mFaceMappingChanged;
207 BOOL mGlobalVolume;
208 BOOL mInited;
209 S32 mLOD;
210 BOOL mLODChanged;
211 F32 mRadius;
212 LLMatrix4 mRelativeXform;
213 LLMatrix3 mRelativeXformInvTrans;
214 BOOL mVolumeChanged;
215 F32 mVObjRadius;
216 LLVolumeInterface *mVolumeImpl;
217
218 // statics
219public:
220 static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop
221 static F32 sLODComplexityDistanceBias; // Changing this to zero makes all prims LOD at the same distance,
222 // regardless of complexity
223 static F32 sLODFactor; // LOD scale factor
224 static F32 sDistanceFactor; // LOD distance factor
225
226protected:
227 static S32 sNumLODChanges;
228
229 friend class LLVolumeImplFlexible;
230};
231
232#endif // LL_LLVOVOLUME_H