This commit is contained in:
Siana Gearz
2011-10-22 01:17:59 +02:00
7 changed files with 153 additions and 89 deletions

View File

@@ -11,6 +11,6 @@ void main()
//transform vertex //transform vertex
gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1; gl_TexCoord[1] = gl_TextureMatrix[0] * gl_MultiTexCoord1;
gl_FrontColor = gl_Color; gl_FrontColor = gl_Color;
} }

View File

@@ -1373,12 +1373,17 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
glMatrixMode(GL_TEXTURE); glMatrixMode(GL_TEXTURE);
} }
else else
{
if (!gPipeline.canUseVertexShaders())
{ {
gGL.getTexUnit(1)->activate(); gGL.getTexUnit(1)->activate();
glMatrixMode(GL_TEXTURE); glMatrixMode(GL_TEXTURE);
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++; }
gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->activate();
glMatrixMode(GL_TEXTURE);
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
} }
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
@@ -1414,10 +1419,15 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->activate();
} }
else else
{
if (!gPipeline.canUseVertexShaders())
{ {
gGL.getTexUnit(1)->activate(); gGL.getTexUnit(1)->activate();
glMatrixMode(GL_TEXTURE);
glLoadIdentity(); glLoadIdentity();
}
gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->activate();
glMatrixMode(GL_TEXTURE);
} }
glLoadIdentity(); glLoadIdentity();
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);

View File

@@ -35,7 +35,7 @@
#include "v3math.h" #include "v3math.h"
#include "v3dmath.h" #include "v3dmath.h"
#include "llmemory.h" #include "llpointer.h"
class LLSurface; class LLSurface;
class LLVOSurfacePatch; class LLVOSurfacePatch;

View File

@@ -213,12 +213,13 @@ void LLVOClouds::getGeometry(S32 te,
color.setVec(float_color); color.setVec(float_color);
facep->setFaceColor(float_color); facep->setFaceColor(float_color);
LLVector4a puff_pos_agent;
puff_pos_agent.load3(facep->mCenterLocal.mV);
LLVector4a at;
at.load3(LLViewerCamera::getInstance()->getAtAxis().mV);
LLVector4a up(0, 0, 1);
LLVector4a right;
LLVector3 up;
LLVector3 right;
LLVector3 at;
const LLVector3& puff_pos_agent = facep->mCenterLocal;
LLVector2 uvs[4]; LLVector2 uvs[4];
uvs[0].setVec(0.f, 1.f); uvs[0].setVec(0.f, 1.f);
@@ -226,34 +227,43 @@ void LLVOClouds::getGeometry(S32 te,
uvs[2].setVec(1.f, 1.f); uvs[2].setVec(1.f, 1.f);
uvs[3].setVec(1.f, 0.f); uvs[3].setVec(1.f, 0.f);
LLVector3 vtx[4]; right.setCross3(at, up);
right.normalize3fast();
at = LLViewerCamera::getInstance()->getAtAxis(); up.setCross3(right, at);
right = at % LLVector3(0.f, 0.f, 1.f); up.normalize3fast();
right.normVec(); right.mul(0.5f*CLOUD_PUFF_WIDTH);
up = right % at; up.mul(0.5f*CLOUD_PUFF_HEIGHT);
up.normVec();
right *= 0.5f*CLOUD_PUFF_WIDTH;
up *= 0.5f*CLOUD_PUFF_HEIGHT;;
*colorsp++ = color; *colorsp++ = color;
*colorsp++ = color; *colorsp++ = color;
*colorsp++ = color; *colorsp++ = color;
*colorsp++ = color; *colorsp++ = color;
vtx[0] = puff_pos_agent - right + up; LLVector4a ppapu;
vtx[1] = puff_pos_agent - right - up; LLVector4a ppamu;
vtx[2] = puff_pos_agent + right + up;
vtx[3] = puff_pos_agent + right - up;
*(verticesp->mV+3) = 0.f; ppapu.setAdd(puff_pos_agent, up);
*verticesp++ = vtx[0]; ppamu.setSub(puff_pos_agent, up);
*(verticesp->mV+3) = 0.f;
*verticesp++ = vtx[1]; LLVector4a vtx[4];
*(verticesp->mV+3) = 0.f; vtx[0].setSub(ppapu, right);
*verticesp++ = vtx[2]; vtx[1].setSub(ppamu, right);
*(verticesp->mV+3) = 0.f; vtx[2].setAdd(ppapu, right);
*verticesp++ = vtx[3];; vtx[3].setAdd(ppamu, right);
verticesp->set(vtx[0].getF32ptr());
*((verticesp++)->mV+3) = 0.f;
verticesp->set(vtx[1].getF32ptr());
*((verticesp++)->mV+3) = 0.f;
verticesp->set(vtx[2].getF32ptr());
*((verticesp++)->mV+3) = 0.f;
verticesp->set(vtx[3].getF32ptr());
*((verticesp++)->mV+3) = 0.f;
//*verticesp++ = puff_pos_agent - right + up;
//*verticesp++ = puff_pos_agent - right - up;
//*verticesp++ = puff_pos_agent + right + up;
//*verticesp++ = puff_pos_agent + right - up;
*texcoordsp++ = uvs[0]; *texcoordsp++ = uvs[0];
*texcoordsp++ = uvs[1]; *texcoordsp++ = uvs[1];

View File

@@ -289,37 +289,54 @@ void LLVOPartGroup::getGeometry(S32 idx,
U32 vert_offset = mDrawable->getFace(idx)->getGeomIndex(); U32 vert_offset = mDrawable->getFace(idx)->getGeomIndex();
LLVector3 part_pos_agent(part.mPosAgent); LLVector4a part_pos_agent;
LLVector3 camera_agent = getCameraPosition(); part_pos_agent.load3(part.mPosAgent.mV);
LLVector3 at = part_pos_agent - camera_agent; LLVector4a camera_agent;
LLVector3 up; camera_agent.load3(getCameraPosition().mV);
LLVector3 right; LLVector4a at;
at.setSub(part_pos_agent, camera_agent);
LLVector4a up(0, 0, 1);
LLVector4a right;
right = at % LLVector3(0.f, 0.f, 1.f); right.setCross3(at, up);
right.normalize(); right.normalize3fast();
up = right % at; up.setCross3(right, at);
up.normalize(); up.normalize3fast();
if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK) if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)
{ {
LLVector3 normvel = part.mVelocity; LLVector4a normvel;
normvel.normalize(); normvel.load3(part.mVelocity.mV);
normvel.normalize3fast();
LLVector2 up_fracs; LLVector2 up_fracs;
up_fracs.mV[0] = normvel*right; up_fracs.mV[0] = normvel.dot3(right).getF32();
up_fracs.mV[1] = normvel*up; up_fracs.mV[1] = normvel.dot3(up).getF32();
up_fracs.normalize(); up_fracs.normalize();
LLVector3 new_up; LLVector4a new_up;
LLVector3 new_right; LLVector4a new_right;
new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up;
new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up; //new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up;
LLVector4a t = right;
t.mul(up_fracs.mV[0]);
new_up = up;
new_up.mul(up_fracs.mV[1]);
new_up.add(t);
//new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up;
t = right;
t.mul(up_fracs.mV[1]);
new_right = up;
new_right.mul(up_fracs.mV[0]);
t.sub(new_right);
up = new_up; up = new_up;
right = new_right; right = t;
up.normalize(); up.normalize3fast();
right.normalize(); right.normalize3fast();
} }
right *= 0.5f*part.mScale.mV[0]; right.mul(0.5f*part.mScale.mV[0]);
up *= 0.5f*part.mScale.mV[1]; up.mul(0.5f*part.mScale.mV[1]);
LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis(); LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis();
@@ -328,14 +345,31 @@ void LLVOPartGroup::getGeometry(S32 idx,
// this works because there is actually a 4th float stored after the vertex position which is used as a texture index // this works because there is actually a 4th float stored after the vertex position which is used as a texture index
// also, somebody please VECTORIZE THIS // also, somebody please VECTORIZE THIS
*(verticesp->mV+3) = 0.f; LLVector4a ppapu;
*verticesp++ = part_pos_agent + up - right; LLVector4a ppamu;
*(verticesp->mV+3) = 0.f;
*verticesp++ = part_pos_agent - up - right; ppapu.setAdd(part_pos_agent, up);
*(verticesp->mV+3) = 0.f; ppamu.setSub(part_pos_agent, up);
*verticesp++ = part_pos_agent + up + right;
*(verticesp->mV+3) = 0.f; LLVector4a vtx[4];
*verticesp++ = part_pos_agent - up + right; vtx[0].setSub(ppapu, right);
vtx[1].setSub(ppamu, right);
vtx[2].setAdd(ppapu, right);
vtx[3].setAdd(ppamu, right);
verticesp->set(vtx[0].getF32ptr());
*((verticesp++)->mV+3) = 0.f;
verticesp->set(vtx[1].getF32ptr());
*((verticesp++)->mV+3) = 0.f;
verticesp->set(vtx[2].getF32ptr());
*((verticesp++)->mV+3) = 0.f;
verticesp->set(vtx[3].getF32ptr());
*((verticesp++)->mV+3) = 0.f;
//*verticesp++ = part_pos_agent + up - right;
//*verticesp++ = part_pos_agent - up - right;
//*verticesp++ = part_pos_agent + up + right;
//*verticesp++ = part_pos_agent - up + right;
*colorsp++ = part.mColor; *colorsp++ = part.mColor;
*colorsp++ = part.mColor; *colorsp++ = part.mColor;

View File

@@ -136,6 +136,12 @@ void LLWorld::destroyClass()
LLVOCache::getInstance()->destroyClass() ; LLVOCache::getInstance()->destroyClass() ;
} }
LLViewerPartSim::getInstance()->destroyClass(); LLViewerPartSim::getInstance()->destroyClass();
mDefaultWaterTexturep = NULL ;
for (S32 i = 0; i < 8; i++)
{
mEdgeWaterObjects[i] = NULL;
}
} }
@@ -172,11 +178,11 @@ LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host,
U32 iindex = 0; U32 iindex = 0;
U32 jindex = 0; U32 jindex = 0;
mWidth = region_size_x; mWidth = region_size_x; //MegaRegion
mWidthInMeters = mWidth * mScale; mWidthInMeters = mWidth * mScale; //MegaRegion
from_region_handle(region_handle, &iindex, &jindex); from_region_handle(region_handle, &iindex, &jindex);
S32 x = (S32)(iindex/256); S32 x = (S32)(iindex/256); //MegaRegion
S32 y = (S32)(jindex/256); S32 y = (S32)(jindex/256); //MegaRegion
llinfos << "Adding new region (" << x << ":" << y << ")" << llendl; llinfos << "Adding new region (" << x << ":" << y << ")" << llendl;
llinfos << "Host: " << host << llendl; llinfos << "Host: " << host << llendl;
@@ -194,6 +200,7 @@ LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host,
llerrs << "Unable to create new region!" << llendl; llerrs << "Unable to create new region!" << llendl;
} }
//Classic clouds
regionp->mCloudLayer.create(regionp); regionp->mCloudLayer.create(regionp);
regionp->mCloudLayer.setWidth((F32)mWidth); regionp->mCloudLayer.setWidth((F32)mWidth);
regionp->mCloudLayer.setWindPointer(&regionp->mWind); regionp->mCloudLayer.setWindPointer(&regionp->mWind);
@@ -597,24 +604,24 @@ void LLWorld::updateVisibilities()
{ {
F32 cur_far_clip = LLViewerCamera::getInstance()->getFar(); F32 cur_far_clip = LLViewerCamera::getInstance()->getFar();
LLViewerCamera::getInstance()->setFar(mLandFarClip);
F32 diagonal_squared = F_SQRT2 * F_SQRT2 * mWidth * mWidth;
// Go through the culled list and check for visible regions // Go through the culled list and check for visible regions
for (region_list_t::iterator iter = mCulledRegionList.begin(); for (region_list_t::iterator iter = mCulledRegionList.begin();
iter != mCulledRegionList.end(); ) iter != mCulledRegionList.end(); )
{ {
region_list_t::iterator curiter = iter++; region_list_t::iterator curiter = iter++;
LLViewerRegion* regionp = *curiter; LLViewerRegion* regionp = *curiter;
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared); LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
if (!regionp->getLand().hasZData() if (part)
|| LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius)) {
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
{ {
mCulledRegionList.erase(curiter); mCulledRegionList.erase(curiter);
mVisibleRegionList.push_back(regionp); mVisibleRegionList.push_back(regionp);
} }
} }
}
// Update all of the visible regions // Update all of the visible regions
for (region_list_t::iterator iter = mVisibleRegionList.begin(); for (region_list_t::iterator iter = mVisibleRegionList.begin();
@@ -627,9 +634,11 @@ void LLWorld::updateVisibilities()
continue; continue;
} }
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ(); LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared); if (part)
if (LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius)) {
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
{ {
regionp->calculateCameraDistance(); regionp->calculateCameraDistance();
if (!gNoRender) if (!gNoRender)
@@ -643,6 +652,7 @@ void LLWorld::updateVisibilities()
mCulledRegionList.push_back(regionp); mCulledRegionList.push_back(regionp);
} }
} }
}
// Sort visible regions // Sort visible regions
mVisibleRegionList.sort(LLViewerRegion::CompareDistance()); mVisibleRegionList.sort(LLViewerRegion::CompareDistance());

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B