diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llflexibleobject.h | |
parent | README.txt (diff) | |
download | meta-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 '')
-rw-r--r-- | linden/indra/newview/llflexibleobject.h | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/linden/indra/newview/llflexibleobject.h b/linden/indra/newview/llflexibleobject.h new file mode 100644 index 0000000..c028adb --- /dev/null +++ b/linden/indra/newview/llflexibleobject.h | |||
@@ -0,0 +1,173 @@ | |||
1 | /** | ||
2 | * @file llflexibleobject.h | ||
3 | * @author JJ Ventrella, Andrew Meadows, Tom Yedwab | ||
4 | * @brief Flexible object definition | ||
5 | * | ||
6 | * Copyright (c) 2006-2007, Linden Research, Inc. | ||
7 | * | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | /** | ||
30 | * This is for specifying objects in the world that are animated and | ||
31 | * rendered locally - on the viewer. Flexible Objects are linear arrays | ||
32 | * of positions, which stay at a fixed distance from each other. One | ||
33 | * position is fixed as an "anchor" and is attached to some other object | ||
34 | * in the world, determined by the server. All the other positions are | ||
35 | * updated according to local physics. | ||
36 | */ | ||
37 | |||
38 | #ifndef LL_LLFLEXIBLEOBJECT_H | ||
39 | #define LL_LLFLEXIBLEOBJECT_H | ||
40 | |||
41 | #include "llmemory.h" | ||
42 | #include "llprimitive.h" | ||
43 | #include "llvovolume.h" | ||
44 | #include "llwind.h" | ||
45 | |||
46 | // 10 ms for the whole thing! | ||
47 | const F32 FLEXIBLE_OBJECT_TIMESLICE = 0.003f; | ||
48 | const U32 FLEXIBLE_OBJECT_MAX_LOD = 10; | ||
49 | |||
50 | // See llprimitive.h for LLFlexibleObjectData and DEFAULT/MIN/MAX values | ||
51 | |||
52 | //------------------------------------------------------------------- | ||
53 | |||
54 | struct LLFlexibleObjectSection | ||
55 | { | ||
56 | // Input parameters | ||
57 | LLVector2 mScale; | ||
58 | LLQuaternion mAxisRotation; | ||
59 | // Simulated state | ||
60 | LLVector3 mPosition; | ||
61 | LLVector3 mVelocity; | ||
62 | LLVector3 mDirection; | ||
63 | LLQuaternion mRotation; | ||
64 | // Derivatives (Not all currently used, will come back with LLVolume changes to automagically generate normals) | ||
65 | LLVector3 mdPosition; | ||
66 | //LLMatrix4 mRotScale; | ||
67 | //LLMatrix4 mdRotScale; | ||
68 | }; | ||
69 | |||
70 | //--------------------------------------------------------- | ||
71 | // The LLVolumeImplFlexible class | ||
72 | //--------------------------------------------------------- | ||
73 | class LLVolumeImplFlexible : public LLVolumeInterface | ||
74 | { | ||
75 | public: | ||
76 | LLVolumeImplFlexible(LLViewerObject* volume, LLFlexibleObjectData* attributes); | ||
77 | |||
78 | // Implements LLVolumeInterface | ||
79 | LLVector3 getFramePosition() const; | ||
80 | LLQuaternion getFrameRotation() const; | ||
81 | LLVolumeInterfaceType getInterfaceType() const { return INTERFACE_FLEXIBLE; } | ||
82 | BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); | ||
83 | BOOL doUpdateGeometry(LLDrawable *drawable); | ||
84 | LLVector3 getPivotPosition() const; | ||
85 | void onSetVolume(const LLVolumeParams &volume_params, const S32 detail); | ||
86 | void onSetScale(const LLVector3 &scale, BOOL damped); | ||
87 | void onParameterChanged(U16 param_type, LLNetworkData *data, BOOL in_use, bool local_origin); | ||
88 | void onShift(const LLVector3 &shift_vector); | ||
89 | bool isVolumeUnique() const { return true; } | ||
90 | bool isVolumeGlobal() const { return true; } | ||
91 | bool isActive() const { return true; } | ||
92 | const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const; | ||
93 | void updateRelativeXform(BOOL global_volume = FALSE); | ||
94 | void doFlexibleUpdate(); // Called to update the simulation | ||
95 | void doFlexibleRebuild(); // Called to rebuild the geometry | ||
96 | static void resetUpdateBins(); | ||
97 | static void doFlexibleUpdateBins(); | ||
98 | |||
99 | //void setAttributes( LLFlexibleObjectData ); | ||
100 | void setParentPositionAndRotationDirectly( LLVector3 p, LLQuaternion r ); | ||
101 | void setUsingCollisionSphere( bool u ); | ||
102 | void setCollisionSphere( LLVector3 position, F32 radius ); | ||
103 | void setRenderingCollisionSphere( bool r); | ||
104 | |||
105 | LLVector3 getEndPosition(); | ||
106 | LLQuaternion getEndRotation(); | ||
107 | LLVector3 getNodePosition( int nodeIndex ); | ||
108 | LLVector3 getAnchorPosition() const; | ||
109 | |||
110 | private: | ||
111 | //-------------------------------------- | ||
112 | // private members | ||
113 | //-------------------------------------- | ||
114 | LLViewerObject* mVO; | ||
115 | LLTimer mTimer; | ||
116 | LLVector3 mAnchorPosition; | ||
117 | LLVector3 mParentPosition; | ||
118 | LLQuaternion mParentRotation; | ||
119 | LLQuaternion mInitialAxisRotation; | ||
120 | LLQuaternion mLastSegmentRotation; | ||
121 | BOOL mInitialized; | ||
122 | BOOL mUpdated; | ||
123 | LLFlexibleObjectData* mAttributes; | ||
124 | LLFlexibleObjectSection mSection [ (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1 ]; | ||
125 | S32 mInitializedRes; | ||
126 | S32 mSimulateRes; | ||
127 | S32 mRenderRes; | ||
128 | U32 mFrameNum; | ||
129 | LLVector3 mCollisionSpherePosition; | ||
130 | F32 mCollisionSphereRadius; | ||
131 | |||
132 | U64 mLastUpdate; | ||
133 | |||
134 | BOOL mJustShifted; | ||
135 | |||
136 | //-------------------------------------- | ||
137 | // private methods | ||
138 | //-------------------------------------- | ||
139 | void setAttributesOfAllSections (); | ||
140 | |||
141 | void remapSections(LLFlexibleObjectSection *source, S32 source_sections, | ||
142 | LLFlexibleObjectSection *dest, S32 dest_sections); | ||
143 | |||
144 | U64 getLastUpdate() const { return mLastUpdate; } | ||
145 | |||
146 | // LOD Bins | ||
147 | struct FlexCompare | ||
148 | { | ||
149 | bool operator()(LLVolumeImplFlexible* a, LLVolumeImplFlexible* b) const | ||
150 | { | ||
151 | U64 a_update = a->getLastUpdate(); | ||
152 | U64 b_update = b->getLastUpdate(); | ||
153 | if (a_update == b_update) | ||
154 | { | ||
155 | return a < b; // compare pointers | ||
156 | } | ||
157 | return a_update < b_update; | ||
158 | } | ||
159 | }; | ||
160 | typedef std::set<LLVolumeImplFlexible*, FlexCompare> lodset_t; | ||
161 | static lodset_t sLODBins[ FLEXIBLE_OBJECT_MAX_LOD ]; | ||
162 | static U64 sCurrentUpdateFrame; | ||
163 | static U32 sDebugInserted; | ||
164 | static U32 sDebugVisible; | ||
165 | |||
166 | public: | ||
167 | // Global setting for update rate | ||
168 | static F32 sUpdateFactor; | ||
169 | |||
170 | };// end of class definition | ||
171 | |||
172 | |||
173 | #endif // LL_LLFLEXIBLEOBJECT_H | ||