summaryrefslogtreecommitdiff
path: root/indra/newview/llvowlsky.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvowlsky.cpp')
-rw-r--r--indra/newview/llvowlsky.cpp47
1 files changed, 37 insertions, 10 deletions
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index 8621e5e1d9..1749ccef94 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -49,12 +49,12 @@ const U32 LLVOWLSky::MAX_SKY_DETAIL = 180;
inline U32 LLVOWLSky::getNumStacks(void)
{
- return gSavedSettings.getU32("WLSkyDetail");
+ return llmin(MAX_SKY_DETAIL, llmax(MIN_SKY_DETAIL, gSavedSettings.getU32("WLSkyDetail")));
}
inline U32 LLVOWLSky::getNumSlices(void)
{
- return 2 * gSavedSettings.getU32("WLSkyDetail");
+ return 2 * llmin(MAX_SKY_DETAIL, llmax(MIN_SKY_DETAIL, gSavedSettings.getU32("WLSkyDetail")));
}
inline U32 LLVOWLSky::getFanNumVerts(void)
@@ -491,7 +491,7 @@ void LLVOWLSky::drawStars(void)
if (mStarsVerts.notNull())
{
mStarsVerts->setBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK);
- mStarsVerts->draw(LLRender::POINTS, getStarsNumIndices(), 0);
+ mStarsVerts->drawArrays(LLRender::QUADS, 0, getStarsNumVerts()*4);
}
}
@@ -519,7 +519,7 @@ void LLVOWLSky::drawDome(void)
LLRender::TRIANGLE_STRIP,
0, strips_segment->getRequestedVerts()-1, strips_segment->getRequestedIndices(),
0);
- gPipeline.addTrianglesDrawn(strips_segment->getRequestedIndices() - 2);
+ gPipeline.addTrianglesDrawn(strips_segment->getRequestedIndices(), LLRender::TRIANGLE_STRIP);
}
#else
@@ -546,6 +546,7 @@ void LLVOWLSky::initStars()
std::vector<F32>::iterator v_i = mStarIntensities.begin();
U32 i;
+
for (i = 0; i < getStarsNumVerts(); ++i)
{
v_p->mV[VX] = ll_frand() - 0.5f;
@@ -771,17 +772,17 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable)
{
LLStrider<LLVector3> verticesp;
LLStrider<LLColor4U> colorsp;
- LLStrider<U16> indicesp;
+ LLStrider<LLVector2> texcoordsp;
if (mStarsVerts.isNull())
{
mStarsVerts = new LLVertexBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK, GL_DYNAMIC_DRAW);
- mStarsVerts->allocateBuffer(getStarsNumVerts(), getStarsNumIndices(), TRUE);
+ mStarsVerts->allocateBuffer(getStarsNumVerts()*4, 0, TRUE);
}
-
+
BOOL success = mStarsVerts->getVertexStrider(verticesp)
- && mStarsVerts->getIndexStrider(indicesp)
- && mStarsVerts->getColorStrider(colorsp);
+ && mStarsVerts->getColorStrider(colorsp)
+ && mStarsVerts->getTexCoord0Strider(texcoordsp);
if(!success)
{
@@ -791,11 +792,37 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable)
// *TODO: fix LLStrider with a real prefix increment operator so it can be
// used as a model of OutputIterator. -Brad
// std::copy(mStarVertices.begin(), mStarVertices.end(), verticesp);
+
+ if (mStarVertices.size() < getStarsNumVerts())
+ {
+ llerrs << "Star reference geometry insufficient." << llendl;
+ }
+
for (U32 vtx = 0; vtx < getStarsNumVerts(); ++vtx)
{
+ LLVector3 at = mStarVertices[vtx];
+ at.normVec();
+ LLVector3 left = at%LLVector3(0,0,1);
+ LLVector3 up = at%left;
+
+ F32 sc = 0.5f+ll_frand()*1.25f;
+ left *= sc;
+ up *= sc;
+
*(verticesp++) = mStarVertices[vtx];
+ *(verticesp++) = mStarVertices[vtx]+left;
+ *(verticesp++) = mStarVertices[vtx]+left+up;
+ *(verticesp++) = mStarVertices[vtx]+up;
+
+ *(texcoordsp++) = LLVector2(0,0);
+ *(texcoordsp++) = LLVector2(0,1);
+ *(texcoordsp++) = LLVector2(1,1);
+ *(texcoordsp++) = LLVector2(1,0);
+
+ *(colorsp++) = LLColor4U(mStarColors[vtx]);
+ *(colorsp++) = LLColor4U(mStarColors[vtx]);
+ *(colorsp++) = LLColor4U(mStarColors[vtx]);
*(colorsp++) = LLColor4U(mStarColors[vtx]);
- *(indicesp++) = vtx;
}
mStarsVerts->setBuffer(0);