aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvostars.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llvostars.cpp')
-rw-r--r--linden/indra/newview/llvostars.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/linden/indra/newview/llvostars.cpp b/linden/indra/newview/llvostars.cpp
index 3fd3b91..a4568ce 100644
--- a/linden/indra/newview/llvostars.cpp
+++ b/linden/indra/newview/llvostars.cpp
@@ -37,11 +37,11 @@
37#include "pipeline.h" 37#include "pipeline.h"
38 38
39const U32 NUMBER_OF_STARS = 1000; 39const U32 NUMBER_OF_STARS = 1000;
40const F32 DISTANCE_TO_STARS = HORIZON_DIST - 10.f; 40const F32 DISTANCE_TO_STARS = (HORIZON_DIST - 10.f)*0.25f;
41 41
42 42
43LLVOStars::LLVOStars(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) 43LLVOStars::LLVOStars(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
44 : LLViewerObject(id, pcode, regionp) 44 : LLStaticViewerObject(id, pcode, regionp)
45{ 45{
46 initStars(); 46 initStars();
47} 47}
@@ -64,7 +64,7 @@ LLDrawable *LLVOStars::createDrawable(LLPipeline *pipeline)
64 LLDrawPoolStars *poolp = (LLDrawPoolStars*) gPipeline.getPool(LLDrawPool::POOL_STARS); 64 LLDrawPoolStars *poolp = (LLDrawPoolStars*) gPipeline.getPool(LLDrawPool::POOL_STARS);
65 65
66 mFace = mDrawable->addFace(poolp, NULL); 66 mFace = mDrawable->addFace(poolp, NULL);
67 mFace->setPrimType(GL_POINTS); 67 mDrawable->setRenderType(LLPipeline::RENDER_TYPE_STARS);
68 mFace->setSize(NUMBER_OF_STARS, NUMBER_OF_STARS); 68 mFace->setSize(NUMBER_OF_STARS, NUMBER_OF_STARS);
69 69
70 return mDrawable; 70 return mDrawable;
@@ -90,19 +90,27 @@ BOOL LLVOStars::updateStarGeometry(LLDrawable *drawable)
90 LLStrider<LLVector3> normalsp; 90 LLStrider<LLVector3> normalsp;
91 LLStrider<LLVector2> texCoordsp; 91 LLStrider<LLVector2> texCoordsp;
92 LLStrider<LLColor4U> colorsp; 92 LLStrider<LLColor4U> colorsp;
93 U32 *indicesp; 93 LLStrider<U32> indicesp;
94 S32 index_offset; 94 S32 index_offset;
95 95
96 if (mFace->mVertexBuffer.isNull())
97 {
98 mFace->mVertexBuffer = new LLVertexBuffer(LLDrawPoolStars::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);
99 mFace->mVertexBuffer->allocateBuffer(mFace->getGeomCount(), mFace->getIndicesCount(), TRUE);
100 mFace->setGeomIndex(0);
101 mFace->setIndicesIndex(0);
102 }
103
96 index_offset = mFace->getGeometryColors(verticesp,normalsp,texCoordsp,colorsp, indicesp); 104 index_offset = mFace->getGeometryColors(verticesp,normalsp,texCoordsp,colorsp, indicesp);
97 105
98 if (-1 == index_offset) 106 if (-1 == index_offset)
99 { 107 {
100 return TRUE; 108 return TRUE;
101 } 109 }
102 LLVector3 cam_pos = gSky.mVOSkyp ? gSky.mVOSkyp->getPositionAgent() : drawable->getPositionAgent(); 110
103 for (U32 vtx = 0; vtx < NUMBER_OF_STARS; ++vtx) 111 for (U32 vtx = 0; vtx < NUMBER_OF_STARS; ++vtx)
104 { 112 {
105 *(verticesp++) = mStarVertices[vtx] + cam_pos; 113 *(verticesp++) = mStarVertices[vtx];
106 *(colorsp++) = LLColor4U(mStarColors[vtx]); 114 *(colorsp++) = LLColor4U(mStarColors[vtx]);
107 *(indicesp++) = index_offset + vtx; 115 *(indicesp++) = index_offset + vtx;
108 } 116 }
@@ -173,7 +181,7 @@ void LLVOStars::updateStarColors()
173 F32 sundir_factor = 1; 181 F32 sundir_factor = 1;
174 LLVector3 tostar = *v_p; 182 LLVector3 tostar = *v_p;
175 tostar.normVec(); 183 tostar.normVec();
176 const F32 how_close_to_sun = tostar * gSky.mVOSkyp->getToSun(); 184 const F32 how_close_to_sun = tostar * gSky.mVOSkyp->getToSunLast();
177 if (how_close_to_sun > sunclose_max) 185 if (how_close_to_sun > sunclose_max)
178 { 186 {
179 sundir_factor = (1 - how_close_to_sun) / sunclose_range; 187 sundir_factor = (1 - how_close_to_sun) / sunclose_range;