00001
00032 #ifndef LL_LLWORLD_H
00033 #define LL_LLWORLD_H
00034
00035 #include "llpatchvertexarray.h"
00036
00037 #include "llmath.h"
00038 #include "v3math.h"
00039 #include "llmemory.h"
00040 #include "llstring.h"
00041 #include "llviewerpartsim.h"
00042 #include "llviewerimage.h"
00043 #include "llvowater.h"
00044
00045 class LLViewerRegion;
00046 class LLVector3d;
00047 class LLMessageSystem;
00048 class LLNetMap;
00049 class LLHost;
00050
00051 class LLViewerObject;
00052 class LLSurfacePatch;
00053
00054 class LLCloudPuff;
00055 class LLCloudGroup;
00056 class LLVOAvatar;
00057
00058
00059
00060
00061
00062 class LLWorld : public LLSingleton<LLWorld>
00063 {
00064 public:
00065 LLWorld();
00066 void destroyClass();
00067
00068 LLViewerRegion* addRegion(const U64 ®ion_handle, const LLHost &host);
00069
00070
00071 void removeRegion(const LLHost &host);
00072
00073 void disconnectRegions();
00074
00075 LLViewerRegion* getRegion(const LLHost &host);
00076 LLViewerRegion* getRegionFromPosGlobal(const LLVector3d &pos);
00077 LLViewerRegion* getRegionFromPosAgent(const LLVector3 &pos);
00078 LLViewerRegion* getRegionFromHandle(const U64 &handle);
00079 BOOL positionRegionValidGlobal(const LLVector3d& pos);
00080 LLVector3d clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos);
00081
00082 void updateAgentOffset(const LLVector3d &offset);
00083
00084
00085 LLViewerRegion* resolveRegionGlobal(LLVector3 &localpos, const LLVector3d &position);
00086 LLViewerRegion* resolveRegionAgent(LLVector3 &localpos, const LLVector3 &position);
00087 F32 resolveLandHeightGlobal(const LLVector3d &position);
00088 F32 resolveLandHeightAgent(const LLVector3 &position);
00089
00090
00091
00092 F32 getMinAllowedZ(LLViewerObject* object);
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 F32 resolveStepHeightGlobal(const LLVOAvatar* avatarp, const LLVector3d &point_a, const LLVector3d &point_b,
00104 LLVector3d &intersection, LLVector3 &intersection_normal,
00105 LLViewerObject** viewerObjectPtr=NULL);
00106
00107 LLSurfacePatch * resolveLandPatchGlobal(const LLVector3d &position);
00108 LLVector3 resolveLandNormalGlobal(const LLVector3d &position);
00109
00110 U32 getRegionWidthInPoints() const { return mWidth; }
00111 F32 getRegionScale() const { return mScale; }
00112
00113
00114 F32 getRegionWidthInMeters() const { return mWidthInMeters; }
00115 F32 getRegionMinHeight() const { return -mWidthInMeters; }
00116 F32 getRegionMaxHeight() const { return MAX_OBJECT_Z; }
00117
00118 void updateRegions(F32 max_update_time);
00119 void updateVisibilities();
00120 void updateParticles();
00121 void updateClouds(const F32 dt);
00122 LLCloudGroup * findCloudGroup(const LLCloudPuff &puff);
00123
00124 void renderPropertyLines();
00125
00126 void resetStats();
00127 void updateNetStats();
00128
00129 void printPacketsLost();
00130 void requestCacheMisses();
00131
00132
00133 static void processCoarseUpdate(LLMessageSystem* msg, void** user_data);
00134
00135 F32 getLandFarClip() const;
00136 void setLandFarClip(const F32 far_clip);
00137
00138 LLViewerImage *getDefaultWaterTexture();
00139 void updateWaterObjects();
00140 void shiftRegions(const LLVector3& offset);
00141
00142 void setSpaceTimeUSec(const U64 space_time_usec);
00143 U64 getSpaceTimeUSec() const;
00144
00145 void getInfo(LLSD& info);
00146
00147 public:
00148 typedef std::list<LLViewerRegion*> region_list_t;
00149
00150 region_list_t mActiveRegionList;
00151
00152 region_list_t& getRegionList() { return mActiveRegionList; }
00153
00154 private:
00155 region_list_t mRegionList;
00156 region_list_t mVisibleRegionList;
00157 region_list_t mCulledRegionList;
00158
00159
00160 static const U32 mWidth;
00161
00162
00163 static const F32 mScale;
00164
00165 static const F32 mWidthInMeters;
00166
00167 F32 mLandFarClip;
00168 LLPatchVertexArray mLandPatch;
00169 S32 mLastPacketsIn;
00170 S32 mLastPacketsOut;
00171 S32 mLastPacketsLost;
00172
00174
00175
00176
00177
00178
00179 U32 mMinRegionX;
00180 U32 mMaxRegionX;
00181 U32 mMinRegionY;
00182 U32 mMaxRegionY;
00183
00184 std::list<LLVOWater*> mHoleWaterObjects;
00185 LLPointer<LLVOWater> mEdgeWaterObjects[8];
00186
00187 LLPointer<LLViewerImage> mDefaultWaterTexturep;
00188 U64 mSpaceTimeUSec;
00189 };
00190
00191
00192 void process_enable_simulator(LLMessageSystem *mesgsys, void **user_data);
00193 void process_disable_simulator(LLMessageSystem *mesgsys, void **user_data);
00194
00195 void process_region_handshake(LLMessageSystem* msg, void** user_data);
00196
00197 void send_agent_pause();
00198 void send_agent_resume();
00199
00200 #endif