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
gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
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;
}

View File

@@ -1374,11 +1374,16 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
}
else
{
gGL.getTexUnit(1)->activate();
if (!gPipeline.canUseVertexShaders())
{
gGL.getTexUnit(1)->activate();
glMatrixMode(GL_TEXTURE);
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
}
gGL.getTexUnit(0)->activate();
glMatrixMode(GL_TEXTURE);
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
gGL.getTexUnit(0)->activate();
}
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
@@ -1415,9 +1420,14 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
}
else
{
gGL.getTexUnit(1)->activate();
glLoadIdentity();
if (!gPipeline.canUseVertexShaders())
{
gGL.getTexUnit(1)->activate();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
}
gGL.getTexUnit(0)->activate();
glMatrixMode(GL_TEXTURE);
}
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);

View File

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

View File

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

View File

@@ -289,37 +289,54 @@ void LLVOPartGroup::getGeometry(S32 idx,
U32 vert_offset = mDrawable->getFace(idx)->getGeomIndex();
LLVector3 part_pos_agent(part.mPosAgent);
LLVector3 camera_agent = getCameraPosition();
LLVector3 at = part_pos_agent - camera_agent;
LLVector3 up;
LLVector3 right;
LLVector4a part_pos_agent;
part_pos_agent.load3(part.mPosAgent.mV);
LLVector4a camera_agent;
camera_agent.load3(getCameraPosition().mV);
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.normalize();
up = right % at;
up.normalize();
right.setCross3(at, up);
right.normalize3fast();
up.setCross3(right, at);
up.normalize3fast();
if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)
{
LLVector3 normvel = part.mVelocity;
normvel.normalize();
LLVector4a normvel;
normvel.load3(part.mVelocity.mV);
normvel.normalize3fast();
LLVector2 up_fracs;
up_fracs.mV[0] = normvel*right;
up_fracs.mV[1] = normvel*up;
up_fracs.mV[0] = normvel.dot3(right).getF32();
up_fracs.mV[1] = normvel.dot3(up).getF32();
up_fracs.normalize();
LLVector3 new_up;
LLVector3 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;
LLVector4a new_up;
LLVector4a new_right;
//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;
right = new_right;
up.normalize();
right.normalize();
right = t;
up.normalize3fast();
right.normalize3fast();
}
right *= 0.5f*part.mScale.mV[0];
up *= 0.5f*part.mScale.mV[1];
right.mul(0.5f*part.mScale.mV[0]);
up.mul(0.5f*part.mScale.mV[1]);
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
// also, somebody please VECTORIZE THIS
*(verticesp->mV+3) = 0.f;
*verticesp++ = part_pos_agent + up - right;
*(verticesp->mV+3) = 0.f;
*verticesp++ = part_pos_agent - up - right;
*(verticesp->mV+3) = 0.f;
*verticesp++ = part_pos_agent + up + right;
*(verticesp->mV+3) = 0.f;
*verticesp++ = part_pos_agent - up + right;
LLVector4a ppapu;
LLVector4a ppamu;
ppapu.setAdd(part_pos_agent, up);
ppamu.setSub(part_pos_agent, up);
LLVector4a vtx[4];
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;

View File

@@ -136,6 +136,12 @@ void LLWorld::destroyClass()
LLVOCache::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 jindex = 0;
mWidth = region_size_x;
mWidthInMeters = mWidth * mScale;
mWidth = region_size_x; //MegaRegion
mWidthInMeters = mWidth * mScale; //MegaRegion
from_region_handle(region_handle, &iindex, &jindex);
S32 x = (S32)(iindex/256);
S32 y = (S32)(jindex/256);
S32 x = (S32)(iindex/256); //MegaRegion
S32 y = (S32)(jindex/256); //MegaRegion
llinfos << "Adding new region (" << x << ":" << y << ")" << 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;
}
//Classic clouds
regionp->mCloudLayer.create(regionp);
regionp->mCloudLayer.setWidth((F32)mWidth);
regionp->mCloudLayer.setWindPointer(&regionp->mWind);
@@ -597,25 +604,25 @@ void LLWorld::updateVisibilities()
{
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
for (region_list_t::iterator iter = mCulledRegionList.begin();
iter != mCulledRegionList.end(); )
iter != mCulledRegionList.end(); )
{
region_list_t::iterator curiter = iter++;
LLViewerRegion* regionp = *curiter;
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared);
if (!regionp->getLand().hasZData()
|| LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
if (part)
{
mCulledRegionList.erase(curiter);
mVisibleRegionList.push_back(regionp);
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
{
mCulledRegionList.erase(curiter);
mVisibleRegionList.push_back(regionp);
}
}
}
}
// Update all of the visible regions
for (region_list_t::iterator iter = mVisibleRegionList.begin();
iter != mVisibleRegionList.end(); )
@@ -627,20 +634,23 @@ void LLWorld::updateVisibilities()
continue;
}
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared);
if (LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
if (part)
{
regionp->calculateCameraDistance();
if (!gNoRender)
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
{
regionp->getLand().updatePatchVisibilities(gAgent);
regionp->calculateCameraDistance();
if (!gNoRender)
{
regionp->getLand().updatePatchVisibilities(gAgent);
}
}
else
{
mVisibleRegionList.erase(curiter);
mCulledRegionList.push_back(regionp);
}
}
else
{
mVisibleRegionList.erase(curiter);
mCulledRegionList.push_back(regionp);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B