00001
00032 #ifndef LL_VOWLSKY_H
00033 #define LL_VOWLSKY_H
00034
00035 #include "llviewerobject.h"
00036
00037 class LLVOWLSky : public LLStaticViewerObject {
00038 private:
00039 static const F32 DISTANCE_TO_STARS;
00040
00041
00042 static const U32 MIN_SKY_DETAIL;
00043
00044 static const U32 MAX_SKY_DETAIL;
00045
00046 inline static U32 getNumStacks(void);
00047 inline static U32 getNumSlices(void);
00048 inline static U32 getFanNumVerts(void);
00049 inline static U32 getFanNumIndices(void);
00050 inline static U32 getStripsNumVerts(void);
00051 inline static U32 getStripsNumIndices(void);
00052 inline static U32 getStarsNumVerts(void);
00053 inline static U32 getStarsNumIndices(void);
00054
00055 public:
00056 LLVOWLSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
00057
00058 void initSunDirection(LLVector3 const & sun_direction,
00059 LLVector3 const & sun_angular_velocity);
00060
00061 BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
00062 BOOL isActive(void) const;
00063 LLDrawable * createDrawable(LLPipeline *pipeline);
00064 BOOL updateGeometry(LLDrawable *drawable);
00065
00066 void drawStars(void);
00067 void drawDome(void);
00068 void resetVertexBuffers(void);
00069
00070 void cleanupGL();
00071 void restoreGL();
00072
00073 private:
00074
00075 static F32 calcPhi(U32 i);
00076
00077
00078 void initStars();
00079
00080
00081 static void buildFanBuffer(LLStrider<LLVector3> & vertices,
00082 LLStrider<LLVector2> & texCoords,
00083 LLStrider<U16> & indices);
00084
00085
00086
00087
00088
00089 static void buildStripsBuffer(U32 begin_stack, U32 end_stack,
00090 LLStrider<LLVector3> & vertices,
00091 LLStrider<LLVector2> & texCoords,
00092 LLStrider<U16> & indices);
00093
00094
00095 void updateStarColors();
00096
00097
00098 BOOL updateStarGeometry(LLDrawable *drawable);
00099
00100 private:
00101 LLPointer<LLVertexBuffer> mFanVerts;
00102 std::vector< LLPointer<LLVertexBuffer> > mStripsVerts;
00103 LLPointer<LLVertexBuffer> mStarsVerts;
00104
00105 std::vector<LLVector3> mStarVertices;
00106 std::vector<LLColor4> mStarColors;
00107 std::vector<F32> mStarIntensities;
00108 };
00109
00110 #endif // LL_VOWLSKY_H