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.cpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index d3238f16a8..0272a2ab34 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -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);
}
}
@@ -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);