A majority of vectorization done. Note that it's INCOMPLETE. LLVolumeFace and LLVertexBuffer haven't been updated, so it's very dirty(and buggy) at those transitions. Compiles on windoze.
This commit is contained in:
@@ -1566,6 +1566,31 @@ F32 LLPipeline::calcPixelArea(LLVector3 center, LLVector3 size, LLCamera &camera
|
||||
return radius*radius * F_PI;
|
||||
}
|
||||
|
||||
//static
|
||||
F32 LLPipeline::calcPixelArea(const LLVector4a& center, const LLVector4a& size, LLCamera &camera)
|
||||
{
|
||||
LLVector4a origin;
|
||||
origin.load3(camera.getOrigin().mV);
|
||||
|
||||
LLVector4a lookAt;
|
||||
lookAt.setSub(center, origin);
|
||||
F32 dist = lookAt.getLength3().getF32();
|
||||
|
||||
//ramp down distance for nearby objects
|
||||
//shrink dist by dist/16.
|
||||
if (dist < 16.f)
|
||||
{
|
||||
dist /= 16.f;
|
||||
dist *= dist;
|
||||
dist *= 16.f;
|
||||
}
|
||||
|
||||
//get area of circle around node
|
||||
F32 app_angle = atanf(size.getLength3().getF32()/dist);
|
||||
F32 radius = app_angle*LLDrawable::sCurPixelAngle;
|
||||
return radius*radius * F_PI;
|
||||
}
|
||||
|
||||
void LLPipeline::grabReferences(LLCullResult& result)
|
||||
{
|
||||
sCull = &result;
|
||||
@@ -1980,7 +2005,7 @@ void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera)
|
||||
}
|
||||
|
||||
if (sMinRenderSize > 0.f &&
|
||||
llmax(llmax(group->mBounds[1].mV[0], group->mBounds[1].mV[1]), group->mBounds[1].mV[2]) < sMinRenderSize)
|
||||
llmax(llmax(group->mBounds[1][0], group->mBounds[1][1]), group->mBounds[1][2]) < sMinRenderSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2364,6 +2389,9 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
gDepthDirty = TRUE;
|
||||
|
||||
LLVector4a offseta;
|
||||
offseta.load3(offset.mV);
|
||||
|
||||
for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin();
|
||||
iter != mShiftList.end(); iter++)
|
||||
{
|
||||
@@ -2372,7 +2400,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
drawablep->shiftPos(offset);
|
||||
drawablep->shiftPos(offseta);
|
||||
drawablep->clearState(LLDrawable::ON_SHIFT_LIST);
|
||||
}
|
||||
mShiftList.resize(0);
|
||||
@@ -2386,7 +2414,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)
|
||||
LLSpatialPartition* part = region->getSpatialPartition(i);
|
||||
if (part)
|
||||
{
|
||||
part->shift(offset);
|
||||
part->shift(offseta);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2417,7 +2445,7 @@ void LLPipeline::markGLRebuild(LLGLUpdate* glu)
|
||||
void LLPipeline::markPartitionMove(LLDrawable* drawable)
|
||||
{
|
||||
if (!drawable->isState(LLDrawable::PARTITION_MOVE) &&
|
||||
!drawable->getPositionGroup().isExactlyZero())
|
||||
!drawable->getPositionGroup().equals3(LLVector4a::getZero()))
|
||||
{
|
||||
drawable->setState(LLDrawable::PARTITION_MOVE);
|
||||
mPartitionQ.push_back(drawable);
|
||||
@@ -2985,8 +3013,10 @@ void LLPipeline::postSort(LLCamera& camera)
|
||||
{
|
||||
if (sMinRenderSize > 0.f)
|
||||
{
|
||||
LLVector3 bounds = (*k)->mExtents[1]-(*k)->mExtents[0];
|
||||
if (llmax(llmax(bounds.mV[0], bounds.mV[1]), bounds.mV[2]) > sMinRenderSize)
|
||||
LLVector4a bounds;
|
||||
bounds.setSub((*k)->mExtents[1],(*k)->mExtents[0]);
|
||||
|
||||
if (llmax(llmax(bounds[0], bounds[1]), bounds[2]) > sMinRenderSize)
|
||||
{
|
||||
sCull->pushDrawInfo(j->first, *k);
|
||||
}
|
||||
@@ -7247,8 +7277,9 @@ void LLPipeline::renderDeferredLighting()
|
||||
}
|
||||
|
||||
|
||||
LLVector3 center = drawablep->getPositionAgent();
|
||||
F32* c = center.mV;
|
||||
LLVector4a center;
|
||||
center.load3(drawablep->getPositionAgent().mV);
|
||||
const F32* c = center.getF32ptr();
|
||||
F32 s = volume->getLightRadius()*1.5f;
|
||||
|
||||
LLColor3 col = volume->getLightColor();
|
||||
@@ -7264,7 +7295,9 @@ void LLPipeline::renderDeferredLighting()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (camera->AABBInFrustumNoFarClip(center, LLVector3(s,s,s)) == 0)
|
||||
LLVector4a sa;
|
||||
sa.splat(s);
|
||||
if (camera->AABBInFrustumNoFarClip(center, sa) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -7341,8 +7374,9 @@ void LLPipeline::renderDeferredLighting()
|
||||
|
||||
LLVOVolume* volume = drawablep->getVOVolume();
|
||||
|
||||
LLVector3 center = drawablep->getPositionAgent();
|
||||
F32* c = center.mV;
|
||||
LLVector4a center;
|
||||
center.load3(drawablep->getPositionAgent().mV);
|
||||
const F32* c = center.getF32ptr();
|
||||
F32 s = volume->getLightRadius()*1.5f;
|
||||
|
||||
sVisibleLightCount++;
|
||||
@@ -8244,7 +8278,8 @@ BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector
|
||||
const LLPlane& cp = camera.getAgentPlane(j);
|
||||
const LLVector3& v1 = pp[bs[i*2+0]];
|
||||
const LLVector3& v2 = pp[bs[i*2+1]];
|
||||
const LLVector3 n(cp.mV);
|
||||
LLVector3 n;
|
||||
cp.getVector3(n);
|
||||
|
||||
LLVector3 line = v1-v2;
|
||||
|
||||
@@ -8258,8 +8293,8 @@ BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector
|
||||
LLVector3 intersect = v2+line*t;
|
||||
pp.push_back(intersect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//camera frustum line segments
|
||||
const U32 fs[] =
|
||||
@@ -8290,7 +8325,8 @@ BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector
|
||||
const LLVector3& v1 = pp[fs[i*2+0]+8];
|
||||
const LLVector3& v2 = pp[fs[i*2+1]+8];
|
||||
const LLPlane& cp = bp[j];
|
||||
const LLVector3 n(cp.mV);
|
||||
LLVector3 n;
|
||||
cp.getVector3(n);
|
||||
|
||||
LLVector3 line = v1-v2;
|
||||
|
||||
@@ -8305,7 +8341,7 @@ BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector
|
||||
pp.push_back(intersect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLVector3 ext[] = { min-LLVector3(0.05f,0.05f,0.05f),
|
||||
max+LLVector3(0.05f,0.05f,0.05f) };
|
||||
@@ -9339,7 +9375,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
|
||||
|
||||
stateSort(*LLViewerCamera::getInstance(), result);
|
||||
|
||||
const LLVector3* ext = avatar->mDrawable->getSpatialExtents();
|
||||
const LLVector4a* ext = avatar->mDrawable->getSpatialExtents();
|
||||
LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset());
|
||||
|
||||
LLCamera camera = *viewer_camera;
|
||||
@@ -9348,25 +9384,30 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
|
||||
|
||||
LLVector2 tdim;
|
||||
|
||||
LLVector3 half_height = (ext[1]-ext[0])*0.5f;
|
||||
|
||||
LLVector3 left = camera.getLeftAxis();
|
||||
left *= left;
|
||||
left.normalize();
|
||||
LLVector4a half_height;
|
||||
half_height.setSub(ext[1], ext[0]);
|
||||
half_height.mul(0.5f);
|
||||
|
||||
LLVector3 up = camera.getUpAxis();
|
||||
up *= up;
|
||||
up.normalize();
|
||||
LLVector4a left;
|
||||
left.load3(camera.getLeftAxis().mV);
|
||||
left.mul(left);
|
||||
left.normalize3fast();
|
||||
|
||||
tdim.mV[0] = fabsf(half_height * left);
|
||||
tdim.mV[1] = fabsf(half_height * up);
|
||||
LLVector4a up;
|
||||
up.load3(camera.getUpAxis().mV);
|
||||
up.mul(up);
|
||||
up.normalize3fast();
|
||||
|
||||
tdim.mV[0] = fabsf(half_height.dot3(left).getF32());
|
||||
tdim.mV[1] = fabsf(half_height.dot3(up).getF32());
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
//glh::matrix4f ortho = gl_ortho(-tdim.mV[0], tdim.mV[0], -tdim.mV[1], tdim.mV[1], 1.0, 256.0);
|
||||
|
||||
F32 distance = (pos-camera.getOrigin()).length();
|
||||
F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG;
|
||||
F32 aspect = tdim.mV[0]/tdim.mV[1]; //128.f/256.f;
|
||||
F32 aspect = tdim.mV[0]/tdim.mV[1];
|
||||
glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f);
|
||||
glh_set_current_projection(persp);
|
||||
glLoadMatrixf(persp.m);
|
||||
|
||||
Reference in New Issue
Block a user