summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-04-26 22:35:26 +0100
committerGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-04-26 22:35:26 +0100
commit21ddbd64af44672e4b20dc4cdf99fd1fbc5c07c2 (patch)
tree826990df06b16c98d59f8930161ef11897c0da58 /indra
parent6dfa720e75cd61e6b502c30d15511d2b447f7eb4 (diff)
Mods to make adv atmo WL sky render using 2 tris instead of dome.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/lldrawpool.h20
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp100
-rw-r--r--indra/newview/lldrawpoolwlsky.h20
-rw-r--r--indra/newview/llvowlsky.cpp311
-rw-r--r--indra/newview/llvowlsky.h3
5 files changed, 146 insertions, 308 deletions
diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h
index bc299cc89f..11d8dd2e1c 100644
--- a/indra/newview/lldrawpool.h
+++ b/indra/newview/lldrawpool.h
@@ -46,22 +46,22 @@ public:
enum
{
// Correspond to LLPipeline render type
- POOL_SIMPLE = 1,
+ POOL_SKY = 1,
+ POOL_WL_SKY,
+ POOL_TERRAIN,
POOL_GROUND,
+ POOL_GRASS,
+ POOL_VOIDWATER,
+ POOL_WATER,
+ POOL_SIMPLE,
POOL_FULLBRIGHT,
POOL_BUMP,
- POOL_MATERIALS,
- POOL_TERRAIN,
- POOL_SKY,
- POOL_WL_SKY,
+ POOL_MATERIALS,
POOL_TREE,
POOL_ALPHA_MASK,
- POOL_FULLBRIGHT_ALPHA_MASK,
- POOL_GRASS,
+ POOL_FULLBRIGHT_ALPHA_MASK,
POOL_INVISIBLE, // see below *
- POOL_AVATAR,
- POOL_VOIDWATER,
- POOL_WATER,
+ POOL_AVATAR,
POOL_GLOW,
POOL_ALPHA,
NUM_POOL_TYPES,
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index a28041034b..01d10502a1 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -44,6 +44,8 @@
#include "llenvironment.h"
#include "llatmosphere.h"
+static LLStaticHashedString sCamPosLocal("camPosLocal");
+
LLPointer<LLViewerTexture> LLDrawPoolWLSky::sCloudNoiseTexture = NULL;
LLPointer<LLImageRaw> LLDrawPoolWLSky::sCloudNoiseRawImage = NULL;
@@ -124,56 +126,55 @@ void LLDrawPoolWLSky::endDeferredPass(S32 pass)
}
-void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) const
+void LLDrawPoolWLSky::renderFsSky(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const
{
- llassert_always(NULL != shader);
+ gGL.pushMatrix();
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.loadIdentity();
- static LLStaticHashedString sCamPosLocal("camPosLocal");
-
- LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
+ // Draw WL Sky w/ normal cam pos (where you are) for adv atmo sky
+ sky_shader->uniform3f(sCamPosLocal, camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
+ gSky.mVOWLSkyp->drawFsSky();
- if (gPipeline.useAdvancedAtmospherics())
- {
- // Draw WL Sky w/ normal cam pos (where you are) for adv atmo sky
- sky_shader->uniform3f(sCamPosLocal, origin.mV[0], origin.mV[1], origin.mV[2]);
+ gGL.popMatrix();
+}
-// TBD replace this with a FS tri pass, there's little point to the tess when you have fragment shaders...
+void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const
+{
+ llassert_always(NULL != shader);
- gSky.mVOWLSkyp->drawDome();
- }
- else
- {
- gGL.pushMatrix();
+ gGL.pushMatrix();
- //chop off translation
- if (LLPipeline::sReflectionRender && origin.mV[2] > 256.f)
- {
- gGL.translatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f);
- }
- else
- {
- gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
- }
+ //chop off translation
+ if (LLPipeline::sReflectionRender && camPosLocal.mV[2] > 256.f)
+ {
+ gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], 256.f-camPosLocal.mV[2]*0.5f);
+ }
+ else
+ {
+ gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
+ }
- // the windlight sky dome works most conveniently in a coordinate system
- // where Y is up, so permute our basis vectors accordingly.
- gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3);
+ // the windlight sky dome works most conveniently in a coordinate system
+ // where Y is up, so permute our basis vectors accordingly.
+ gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3);
- gGL.scalef(0.333f, 0.333f, 0.333f);
+ gGL.scalef(0.333f, 0.333f, 0.333f);
- gGL.translatef(0.f,-camHeightLocal, 0.f);
+ gGL.translatef(0.f,-camHeightLocal, 0.f);
- // Draw WL Sky
- shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f);
+ // Draw WL Sky
+ shader->uniform3f(sCamPosLocal, 0.f, camHeightLocal, 0.f);
- gSky.mVOWLSkyp->drawDome();
+ gSky.mVOWLSkyp->drawDome();
- gGL.popMatrix();
- }
+ gGL.popMatrix();
}
-void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const
+void LLDrawPoolWLSky::renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightLocal) const
{
if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))
{
@@ -181,6 +182,8 @@ void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const
sky_shader->bind();
+ LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
+
if (gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders() && gAtmosphere)
{
// bind precomputed textures necessary for calculating sun and sky luminance
@@ -206,10 +209,14 @@ void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const
{
sky_shader->bindTexture(LLShaderMgr::CLOUD_NOISE_MAP, sCloudNoiseTexture);
}
- }
- /// Render the skydome
- renderDome(camHeightLocal, sky_shader);
+ renderFsSky(origin, camHeightLocal, sky_shader);
+ }
+ else
+ {
+ /// Render the skydome
+ renderDome(origin, camHeightLocal, sky_shader);
+ }
sky_shader->unbind();
}
@@ -274,7 +281,7 @@ void LLDrawPoolWLSky::renderStars(void) const
}
}
-void LLDrawPoolWLSky::renderSkyClouds(F32 camHeightLocal) const
+void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal) const
{
if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && sCloudNoiseTexture.notNull())
{
@@ -286,7 +293,7 @@ void LLDrawPoolWLSky::renderSkyClouds(F32 camHeightLocal) const
cloud_shader->bind();
/// Render the skydome
- renderDome(camHeightLocal, cloud_shader);
+ renderDome(camPosLocal, camHeightLocal, cloud_shader);
cloud_shader->unbind();
}
@@ -362,7 +369,9 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
LLGLSquashToFarClip far_clip(glh_get_current_projection());
- renderSkyHaze(camHeightLocal);
+ LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
+
+ renderSkyHaze(origin, camHeightLocal);
if (!gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders())
{
@@ -387,7 +396,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
gGL.popMatrix();
}
- renderSkyClouds(camHeightLocal);
+ renderSkyClouds(origin, camHeightLocal);
gGL.setColorMask(true, true);
}
@@ -408,11 +417,12 @@ void LLDrawPoolWLSky::render(S32 pass)
LLGLSquashToFarClip far_clip(glh_get_current_projection());
- renderSkyHaze(camHeightLocal);
+ LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
+
+ renderSkyHaze(origin, camHeightLocal);
if (!gPipeline.useAdvancedAtmospherics() && gPipeline.canUseWindLightShaders())
{
- LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
gGL.pushMatrix();
gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
@@ -429,7 +439,7 @@ void LLDrawPoolWLSky::render(S32 pass)
gGL.popMatrix();
}
- renderSkyClouds(camHeightLocal);
+ renderSkyClouds(origin, camHeightLocal);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h
index 586219e4bc..8d4a749a9c 100644
--- a/indra/newview/lldrawpoolwlsky.h
+++ b/indra/newview/lldrawpoolwlsky.h
@@ -34,12 +34,13 @@ class LLGLSLShader;
class LLDrawPoolWLSky : public LLDrawPool {
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_TEXCOORD0;
-
- static const U32 ADV_ATMO_SKY_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX;
+ 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_TEXCOORD0;
+ static const U32 ADV_ATMO_SKY_VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX
+ | LLVertexBuffer::MAP_TEXCOORD0;
LLDrawPoolWLSky(void);
/*virtual*/ ~LLDrawPoolWLSky();
@@ -72,10 +73,11 @@ public:
static void cleanupGL();
static void restoreGL();
private:
- void renderDome(F32 camHeightLocal, LLGLSLShader * shader) const;
- void renderSkyHaze(F32 camHeightLocal) const;
+ void renderFsSky(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const;
+ void renderDome(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const;
+ void renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightLocal) const;
void renderStars(void) const;
- void renderSkyClouds(F32 camHeightLocal) const;
+ void renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal) const;
void renderHeavenlyBodies();
private:
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index 0062eb5edd..3ab149fef0 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -36,7 +36,6 @@
#include "llenvironment.h"
#include "llsettingssky.h"
-#define DOME_SLICES 1
const F32 LLVOWLSky::DISTANCE_TO_STARS = (HORIZON_DIST - 10.f)*0.25f;
const U32 LLVOWLSky::MIN_SKY_DETAIL = 3;
@@ -131,167 +130,22 @@ inline F32 LLVOWLSky::calcPhi(U32 i)
return (F_PI / 8.f) * t;
}
-#if !DOME_SLICES
-static const F32 Q = (1.f + sqrtf(5.f))/2.f; //golden ratio
-
-//icosahedron verts (based on asset b0c7b76e-28c6-1f87-a1de-752d5e3cd264, contact Runitai Linden for a copy)
-static const LLVector3 icosahedron_vert[] =
-{
- LLVector3(0,1.f,Q),
- LLVector3(0,-1.f,Q),
- LLVector3(0,-1.f,-Q),
- LLVector3(0,1.f,-Q),
-
- LLVector3(Q,0,1.f),
- LLVector3(-Q,0,1.f),
- LLVector3(-Q,0,-1.f),
- LLVector3(Q,0,-1.f),
-
- LLVector3(1,-Q,0.f),
- LLVector3(-1,-Q,0.f),
- LLVector3(-1,Q,0.f),
- LLVector3(1,Q,0.f),
-};
-
-//indices
-static const U32 icosahedron_ind[] =
-{
- 5,0,1,
- 10,0,5,
- 5,1,9,
- 10,5,6,
- 6,5,9,
- 11,0,10,
- 3,11,10,
- 3,10,6,
- 3,6,2,
- 7,3,2,
- 8,7,2,
- 4,7,8,
- 1,4,8,
- 9,8,2,
- 9,2,6,
- 11,3,7,
- 4,0,11,
- 4,11,7,
- 1,0,4,
- 1,8,9,
-};
-
-
-//split every triangle in LLVertexBuffer into even fourths (assumes index triangle lists)
-void subdivide(LLVertexBuffer& in, LLVertexBuffer* ret)
-{
- S32 tri_in = in.getNumIndices()/3;
-
- ret->allocateBuffer(tri_in*4*3, tri_in*4*3, TRUE);
-
- LLStrider<LLVector3> vin, vout;
- LLStrider<U16> indin, indout;
-
- ret->getVertexStrider(vout);
- in.getVertexStrider(vin);
-
- ret->getIndexStrider(indout);
- in.getIndexStrider(indin);
-
-
- for (S32 i = 0; i < tri_in; i++)
- {
- LLVector3 v0 = vin[*indin++];
- LLVector3 v1 = vin[*indin++];
- LLVector3 v2 = vin[*indin++];
-
- LLVector3 v3 = (v0 + v1) * 0.5f;
- LLVector3 v4 = (v1 + v2) * 0.5f;
- LLVector3 v5 = (v2 + v0) * 0.5f;
-
- *vout++ = v0;
- *vout++ = v3;
- *vout++ = v5;
-
- *vout++ = v3;
- *vout++ = v4;
- *vout++ = v5;
-
- *vout++ = v3;
- *vout++ = v1;
- *vout++ = v4;
-
- *vout++ = v5;
- *vout++ = v4;
- *vout++ = v2;
- }
-
- for (S32 i = 0; i < ret->getNumIndices(); i++)
- {
- *indout++ = i;
- }
-
-}
-
-void chop(LLVertexBuffer& in, LLVertexBuffer* out)
-{
- //chop off all triangles below horizon
- F32 d = LLEnvironment::instance().getCamHeight();
-
- std::vector<LLVector3> vert;
-
- LLStrider<LLVector3> vin;
- LLStrider<U16> index;
-
- in.getVertexStrider(vin);
- in.getIndexStrider(index);
-
- U32 tri_count = in.getNumIndices()/3;
- for (U32 i = 0; i < tri_count; i++)
- {
- LLVector3 &v1 = vin[index[i*3+0]];
- LLVector3 &v2 = vin[index[i*3+1]];
- LLVector3 &v3 = vin[index[i*3+2]];
-
- if (v1.mV[1] > d ||
- v2.mV[1] > d ||
- v3.mV[1] > d)
- {
- v1.mV[1] = llmax(v1.mV[1], d);
- v2.mV[1] = llmax(v1.mV[1], d);
- v3.mV[1] = llmax(v1.mV[1], d);
-
- vert.push_back(v1);
- vert.push_back(v2);
- vert.push_back(v3);
- }
- }
-
- out->allocateBuffer(vert.size(), vert.size(), TRUE);
-
- LLStrider<LLVector3> vout;
- out->getVertexStrider(vout);
- out->getIndexStrider(index);
-
- for (U32 i = 0; i < vert.size(); i++)
- {
- *vout++ = vert[i];
- *index++ = i;
- }
-}
-#endif // !DOME_SLICES
-
void LLVOWLSky::resetVertexBuffers()
{
- mFanVerts = NULL;
+ mFanVerts = nullptr;
mStripsVerts.clear();
- mStarsVerts = NULL;
+ mStarsVerts = nullptr;
+ mFsSkyVerts = nullptr;
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE);
}
void LLVOWLSky::cleanupGL()
{
- mFanVerts = NULL;
+ mFanVerts = nullptr;
mStripsVerts.clear();
- mStarsVerts = NULL;
+ mStarsVerts = nullptr;
+ mFsSkyVerts = nullptr;
LLDrawPoolWLSky::cleanupGL();
}
@@ -306,12 +160,54 @@ static LLTrace::BlockTimerStatHandle FTM_GEO_SKY("Windlight Sky Geometry");
BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
{
- LL_RECORD_BLOCK_TIME(FTM_GEO_SKY);
+ LL_RECORD_BLOCK_TIME(FTM_GEO_SKY);
LLStrider<LLVector3> vertices;
LLStrider<LLVector2> texCoords;
LLStrider<U16> indices;
-#if DOME_SLICES
+ if (gPipeline.useAdvancedAtmospherics())
+ {
+ if (mFsSkyVerts.isNull())
+ {
+ mFsSkyVerts = new LLVertexBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
+
+ if (!mFsSkyVerts->allocateBuffer(4, 6, TRUE))
+ {
+ LL_WARNS() << "Failed to allocate Vertex Buffer on full screen sky update" << LL_ENDL;
+ }
+
+ BOOL success = mFsSkyVerts->getVertexStrider(vertices)
+ && mFsSkyVerts->getTexCoord0Strider(texCoords)
+ && mFsSkyVerts->getIndexStrider(indices);
+
+ if(!success)
+ {
+ LL_ERRS() << "Failed updating WindLight fullscreen sky geometry." << LL_ENDL;
+ }
+
+ *vertices++ = LLVector3(-1.0f, -1.0f, 0.0f);
+ *vertices++ = LLVector3( 1.0f, -1.0f, 0.0f);
+ *vertices++ = LLVector3(-1.0f, 1.0f, 0.0f);
+ *vertices++ = LLVector3( 1.0f, 1.0f, 0.0f);
+
+ *texCoords++ = LLVector2(0.0f, 0.0f);
+ *texCoords++ = LLVector2(1.0f, 0.0f);
+ *texCoords++ = LLVector2(0.0f, 1.0f);
+ *texCoords++ = LLVector2(1.0f, 1.0f);
+
+ *indices++ = 0;
+ *indices++ = 1;
+ *indices++ = 2;
+ *indices++ = 1;
+ *indices++ = 3;
+ *indices++ = 2;
+
+ mFsSkyVerts->flush();
+ }
+
+ return TRUE;
+ }
+
{
mFanVerts = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
if (!mFanVerts->allocateBuffer(getFanNumVerts(), getFanNumIndices(), TRUE))
@@ -407,85 +303,6 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
LL_INFOS() << "completed in " << llformat("%.2f", timer.getElapsedTimeF32().value()) << "seconds" << LL_ENDL;
}
-#else
- mStripsVerts = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
-
- const F32 RADIUS = LLEnvironment::getCurrentSky()->getDomeRadius();
-
- LLPointer<LLVertexBuffer> temp = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, 0);
- temp->allocateBuffer(12, 60, TRUE);
-
- BOOL success = temp->getVertexStrider(vertices)
- && temp->getIndexStrider(indices);
-
- if (success)
- {
- for (U32 i = 0; i < 12; i++)
- {
- *vertices++ = icosahedron_vert[i];
- }
-
- for (U32 i = 0; i < 60; i++)
- {
- *indices++ = icosahedron_ind[i];
- }
- }
-
-
- LLPointer<LLVertexBuffer> temp2;
-
- for (U32 i = 0; i < 8; i++)
- {
- temp2 = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, 0);
- subdivide(*temp, temp2);
- temp = temp2;
- }
-
- temp->getVertexStrider(vertices);
- for (S32 i = 0; i < temp->getNumVerts(); i++)
- {
- LLVector3 v = vertices[i];
- v.normVec();
- vertices[i] = v*RADIUS;
- }
-
- temp2 = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, 0);
- chop(*temp, temp2);
-
- mStripsVerts->allocateBuffer(temp2->getNumVerts(), temp2->getNumIndices(), TRUE);
-
- success = mStripsVerts->getVertexStrider(vertices)
- && mStripsVerts->getTexCoordStrider(texCoords)
- && mStripsVerts->getIndexStrider(indices);
-
- LLStrider<LLVector3> v;
- temp2->getVertexStrider(v);
- LLStrider<U16> ind;
- temp2->getIndexStrider(ind);
-
- if (success)
- {
- for (S32 i = 0; i < temp2->getNumVerts(); ++i)
- {
- LLVector3 vert = *v++;
- vert.normVec();
- F32 z0 = vert.mV[2];
- F32 x0 = vert.mV[0];
-
- vert *= RADIUS;
-
- *vertices++ = vert;
- *texCoords++ = LLVector2((-z0 + 1.f) / 2.f, (-x0 + 1.f) / 2.f);
- }
-
- for (S32 i = 0; i < temp2->getNumIndices(); ++i)
- {
- *indices++ = *ind++;
- }
- }
-
- mStripsVerts->flush();
-#endif
updateStarColors();
updateStarGeometry(drawable);
@@ -505,6 +322,23 @@ void LLVOWLSky::drawStars(void)
}
}
+void LLVOWLSky::drawFsSky(void)
+{
+ if (mFsSkyVerts.isNull())
+ {
+ updateGeometry(mDrawable);
+ }
+
+ //LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL);
+ LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE, GL_ALWAYS);
+ LLGLDisable disable_blend(GL_BLEND);
+
+ mFsSkyVerts->setBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK);
+ mFsSkyVerts->drawRange(LLRender::TRIANGLES, 0, mFsSkyVerts->getNumVerts() - 1, mFsSkyVerts->getNumIndices(), 0);
+ gPipeline.addTrianglesDrawn(mFsSkyVerts->getNumIndices(), LLRender::TRIANGLES);
+ LLVertexBuffer::unbind();
+}
+
void LLVOWLSky::drawDome(void)
{
if (mStripsVerts.empty())
@@ -516,7 +350,6 @@ void LLVOWLSky::drawDome(void)
const U32 data_mask = LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK;
-#if DOME_SLICES
std::vector< LLPointer<LLVertexBuffer> >::const_iterator strips_vbo_iter, end_strips;
end_strips = mStripsVerts.end();
for(strips_vbo_iter = mStripsVerts.begin(); strips_vbo_iter != end_strips; ++strips_vbo_iter)
@@ -532,16 +365,6 @@ void LLVOWLSky::drawDome(void)
gPipeline.addTrianglesDrawn(strips_segment->getNumIndices(), LLRender::TRIANGLE_STRIP);
}
-#else
- mStripsVerts->setBuffer(data_mask);
- gGL.syncMatrices();
- glDrawRangeElements(
- GL_TRIANGLES,
- 0, mStripsVerts->getNumVerts()-1, mStripsVerts->getNumIndices(),
- GL_UNSIGNED_SHORT,
- mStripsVerts->getIndicesPointer());
-#endif
-
LLVertexBuffer::unbind();
}
diff --git a/indra/newview/llvowlsky.h b/indra/newview/llvowlsky.h
index 1d419b5fea..8bc6afba1b 100644
--- a/indra/newview/llvowlsky.h
+++ b/indra/newview/llvowlsky.h
@@ -60,6 +60,7 @@ public:
void drawStars(void);
void drawDome(void);
+ void drawFsSky(void); // fullscreen sky for advanced atmo
void resetVertexBuffers(void);
void cleanupGL();
@@ -93,6 +94,8 @@ private:
BOOL updateStarGeometry(LLDrawable *drawable);
private:
+ LLPointer<LLVertexBuffer> mFsSkyVerts;
+
LLPointer<LLVertexBuffer> mFanVerts;
std::vector< LLPointer<LLVertexBuffer> > mStripsVerts;
LLPointer<LLVertexBuffer> mStarsVerts;