summaryrefslogtreecommitdiff
path: root/indra/newview/llvopartgroup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvopartgroup.cpp')
-rw-r--r--indra/newview/llvopartgroup.cpp96
1 files changed, 62 insertions, 34 deletions
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index a4b0910c92..5c10a80b07 100644
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -274,7 +274,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable)
}
void LLVOPartGroup::getGeometry(S32 idx,
- LLStrider<LLVector3>& verticesp,
+ LLStrider<LLVector4a>& verticesp,
LLStrider<LLVector3>& normalsp,
LLStrider<LLVector2>& texcoordsp,
LLStrider<LLColor4U>& colorsp,
@@ -290,37 +290,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;
-
- right = at % LLVector3(0.f, 0.f, 1.f);
- right.normalize();
- up = right % at;
- up.normalize();
+ 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.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();
@@ -329,14 +346,25 @@ 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);
+
+ verticesp->setSub(ppapu, right);
+ (*verticesp++).getF32ptr()[3] = 0.f;
+ verticesp->setSub(ppamu, right);
+ (*verticesp++).getF32ptr()[3] = 0.f;
+ verticesp->setAdd(ppapu, right);
+ (*verticesp++).getF32ptr()[3] = 0.f;
+ verticesp->setAdd(ppamu, right);
+ (*verticesp++).getF32ptr()[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;
@@ -453,7 +481,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
LLVertexBuffer* buffer = group->mVertexBuffer;
LLStrider<U16> indicesp;
- LLStrider<LLVector3> verticesp;
+ LLStrider<LLVector4a> verticesp;
LLStrider<LLVector3> normalsp;
LLStrider<LLVector2> texcoordsp;
LLStrider<LLColor4U> colorsp;
@@ -513,7 +541,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
}
}
- buffer->setBuffer(0);
+ buffer->flush();
mFaceList.clear();
}