summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llvertexbuffer.cpp42
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp21
-rw-r--r--indra/newview/lldrawpoolwlsky.h2
-rw-r--r--indra/newview/llvowlsky.cpp41
4 files changed, 69 insertions, 37 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index db4189dfea..572ae13909 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -1061,17 +1061,20 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
}
}
- glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
- if ((GLuint)buff != mGLIndices)
+ if (mGLIndices)
{
- if (gDebugSession)
- {
- error = TRUE;
- gFailLog << "Invalid GL index buffer bound: " << buff << std::endl;
- }
- else
+ glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
+ if ((GLuint)buff != mGLIndices)
{
- llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+ if (gDebugSession)
+ {
+ error = TRUE;
+ gFailLog << "Invalid GL index buffer bound: " << buff << std::endl;
+ }
+ else
+ {
+ llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+ }
}
}
}
@@ -1095,17 +1098,20 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
}
}
- glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
- if ((GLuint)buff != mGLIndices)
+ if (mGLIndices != 0)
{
- if (gDebugSession)
- {
- error = TRUE;
- gFailLog << "Invalid GL index buffer bound: "<< std::endl;
- }
- else
+ glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
+ if ((GLuint)buff != mGLIndices)
{
- llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+ if (gDebugSession)
+ {
+ error = TRUE;
+ gFailLog << "Invalid GL index buffer bound: "<< std::endl;
+ }
+ else
+ {
+ llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+ }
}
}
}
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index c14ca2473b..c7cd77cb65 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -159,15 +159,10 @@ void LLDrawPoolWLSky::renderStars(void) const
// *NOTE: have to have bound the cloud noise texture already since register
// combiners blending below requires something to be bound
// and we might as well only bind once.
- //gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
gPipeline.disableLights();
-
- if (!LLPipeline::sReflectionRender)
- {
- glPointSize(2.f);
- }
-
+
// *NOTE: we divide by two here and GL_ALPHA_SCALE by two below to avoid
// clamping and allow the star_alpha param to brighten the stars.
bool error;
@@ -175,16 +170,20 @@ void LLDrawPoolWLSky::renderStars(void) const
star_alpha.mV[3] = LLWLParamManager::instance()->mCurParams.getFloat("star_brightness", error) / 2.f;
llassert_always(!error);
+ gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getBloomTex());
+
+ gGL.pushMatrix();
+ glRotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
// gl_FragColor.rgb = gl_Color.rgb;
// gl_FragColor.a = gl_Color.a * star_alpha.a;
- gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
- gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT_X2, LLTexUnit::TBS_PREV_ALPHA, LLTexUnit::TBS_CONST_ALPHA);
+ gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
+ gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT_X2, LLTexUnit::TBS_CONST_ALPHA, LLTexUnit::TBS_TEX_ALPHA);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, star_alpha.mV);
gSky.mVOWLSkyp->drawStars();
- glPointSize(1.f);
-
+ gGL.popMatrix();
+
// and disable the combiner states
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h
index 7ff760ac39..9059f6382f 100644
--- a/indra/newview/lldrawpoolwlsky.h
+++ b/indra/newview/lldrawpoolwlsky.h
@@ -43,7 +43,7 @@ public:
static const U32 SKY_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0;
static const U32 STAR_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
- LLVertexBuffer::MAP_COLOR;
+ LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD0;
LLDrawPoolWLSky(void);
/*virtual*/ ~LLDrawPoolWLSky();
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);