summaryrefslogtreecommitdiff
path: root/indra/newview/llmaniprotate.cpp
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2011-12-05 09:36:41 -0800
committerLeslie Linden <leslie@lindenlab.com>2011-12-05 09:36:41 -0800
commit837e4e5165cc3e6595577e90bae240e676be8ffe (patch)
tree85c8e8a8cb6adf8abc87fe3a70d4513a1ab625e5 /indra/newview/llmaniprotate.cpp
parent570d02dc7e41c3e08477e7f759d632db78690eb4 (diff)
parent71974461114d81f818f69a4344ce4071c20f331f (diff)
Merge with viewer-experience
Diffstat (limited to 'indra/newview/llmaniprotate.cpp')
-rw-r--r--indra/newview/llmaniprotate.cpp120
1 files changed, 74 insertions, 46 deletions
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 6ee095475f..a8da94f75e 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -53,6 +53,7 @@
#include "llviewercamera.h"
#include "llviewerobject.h"
#include "llviewerobject.h"
+#include "llviewershadermgr.h"
#include "llviewerwindow.h"
#include "llworld.h"
#include "pipeline.h"
@@ -113,7 +114,7 @@ void LLManipRotate::handleSelect()
void LLManipRotate::render()
{
LLGLSUIDefault gls_ui;
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
LLGLDepthTest gls_depth(GL_TRUE);
LLGLEnable gl_blend(GL_BLEND);
LLGLEnable gls_alpha_test(GL_ALPHA_TEST);
@@ -130,12 +131,12 @@ void LLManipRotate::render()
return;
}
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.pushMatrix();
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom = gAgentCamera.mHUDCurZoom;
- glScalef(zoom, zoom, zoom);
+ gGL.scalef(zoom, zoom, zoom);
}
@@ -145,8 +146,9 @@ void LLManipRotate::render()
LLColor4 highlight_inside( 0.7f, 0.7f, 0.f, 0.5f );
F32 width_meters = WIDTH_PIXELS * mRadiusMeters / RADIUS_PIXELS;
- glPushMatrix();
+ gGL.pushMatrix();
{
+
// are we in the middle of a constrained drag?
if (mManipPart >= LL_ROT_X && mManipPart <= LL_ROT_Z)
{
@@ -154,13 +156,18 @@ void LLManipRotate::render()
}
else
{
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gDebugProgram.bind();
+ }
+
LLGLEnable cull_face(GL_CULL_FACE);
LLGLDepthTest gls_depth(GL_FALSE);
- glPushMatrix();
+ gGL.pushMatrix();
{
// Draw "sphere" (intersection of sphere with tangent cone that has apex at camera)
- glTranslatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] );
- glTranslatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
+ gGL.translatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] );
+ gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
// Inverse change of basis vectors
LLVector3 forward = mCenterToCamNorm;
@@ -177,35 +184,41 @@ void LLManipRotate::render()
LLMatrix4 mat;
mat.initRows(a, b, c, LLVector4(0.f, 0.f, 0.f, 1.f));
- glMultMatrixf( &mat.mMatrix[0][0] );
+ gGL.multMatrix( &mat.mMatrix[0][0] );
- glRotatef( -90, 0.f, 1.f, 0.f);
+ gGL.rotatef( -90, 0.f, 1.f, 0.f);
LLColor4 color;
if (mManipPart == LL_ROT_ROLL || mHighlightedPart == LL_ROT_ROLL)
{
color.setVec(0.8f, 0.8f, 0.8f, 0.8f);
- glScalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]);
+ gGL.scalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]);
}
else
{
color.setVec( 0.7f, 0.7f, 0.7f, 0.6f );
}
+ gGL.diffuseColor4fv(color.mV);
gl_washer_2d(mRadiusMeters + width_meters, mRadiusMeters, CIRCLE_STEPS, color, color);
if (mManipPart == LL_NO_PART)
{
gGL.color4f( 0.7f, 0.7f, 0.7f, 0.3f );
+ gGL.diffuseColor4f(0.7f, 0.7f, 0.7f, 0.3f);
gl_circle_2d( 0, 0, mRadiusMeters, CIRCLE_STEPS, TRUE );
}
- GLdouble plane_eqn[] = { 0, 0, 1, 0 };
- glClipPlane( GL_CLIP_PLANE0, plane_eqn );
+ gGL.flush();
}
- glPopMatrix();
- }
+ gGL.popMatrix();
- glTranslatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
+ }
+
+ gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
LLQuaternion rot;
F32 angle_radians, x, y, z;
@@ -217,41 +230,46 @@ void LLManipRotate::render()
LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale);
grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z);
- glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gDebugProgram.bind();
+ }
+
if (mManipPart == LL_ROT_Z)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glPushMatrix();
+ gGL.pushMatrix();
{
// selected part
- glScalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
+ gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f) , LLColor4( 0.f, 0.f, 1.f, 0.3f ));
}
- glPopMatrix();
+ gGL.popMatrix();
}
else if (mManipPart == LL_ROT_Y)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glPushMatrix();
+ gGL.pushMatrix();
{
- glRotatef( 90.f, 1.f, 0.f, 0.f );
- glScalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
+ gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
+ gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f), LLColor4( 0.f, 1.f, 0.f, 0.3f));
}
- glPopMatrix();
+ gGL.popMatrix();
}
else if (mManipPart == LL_ROT_X)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glPushMatrix();
+ gGL.pushMatrix();
{
- glRotatef( 90.f, 0.f, 1.f, 0.f );
- glScalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
+ gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
+ gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
renderActiveRing( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f), LLColor4( 1.f, 0.f, 0.f, 0.3f));
}
- glPopMatrix();
+ gGL.popMatrix();
}
else if (mManipPart == LL_ROT_ROLL)
{
@@ -271,12 +289,13 @@ void LLManipRotate::render()
// First pass: centers. Second pass: sides.
for( S32 i=0; i<2; i++ )
{
- glPushMatrix();
+
+ gGL.pushMatrix();
{
if (mHighlightedPart == LL_ROT_Z)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glScalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
+ gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
// hovering over part
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f ), LLColor4( 0.f, 0.f, 1.f, 0.5f ), CIRCLE_STEPS, i);
}
@@ -286,15 +305,15 @@ void LLManipRotate::render()
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 0.8f, 0.8f ), LLColor4( 0.f, 0.f, 0.8f, 0.4f ), CIRCLE_STEPS, i);
}
}
- glPopMatrix();
-
- glPushMatrix();
+ gGL.popMatrix();
+
+ gGL.pushMatrix();
{
- glRotatef( 90.f, 1.f, 0.f, 0.f );
+ gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
if (mHighlightedPart == LL_ROT_Y)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glScalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
+ gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
// hovering over part
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f ), LLColor4( 0.f, 1.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
}
@@ -304,15 +323,15 @@ void LLManipRotate::render()
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.8f, 0.f, 0.8f ), LLColor4( 0.f, 0.8f, 0.f, 0.4f ), CIRCLE_STEPS, i);
}
}
- glPopMatrix();
+ gGL.popMatrix();
- glPushMatrix();
+ gGL.pushMatrix();
{
- glRotatef( 90.f, 0.f, 1.f, 0.f );
+ gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
if (mHighlightedPart == LL_ROT_X)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
- glScalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
+ gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
// hovering over part
gl_ring( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f ), LLColor4( 1.f, 0.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
@@ -323,17 +342,26 @@ void LLManipRotate::render()
gl_ring( mRadiusMeters, width_meters, LLColor4( 0.8f, 0.f, 0.f, 0.8f ), LLColor4( 0.8f, 0.f, 0.f, 0.4f ), CIRCLE_STEPS, i);
}
}
- glPopMatrix();
+ gGL.popMatrix();
if (mHighlightedPart == LL_ROT_ROLL)
{
mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
}
+
}
+
}
+
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gUIProgram.bind();
+ }
+
}
- glPopMatrix();
- glPopMatrix();
+ gGL.popMatrix();
+ gGL.popMatrix();
+
LLVector3 euler_angles;
LLQuaternion object_rot = first_object->getRotationEdit();
@@ -796,14 +824,14 @@ void LLManipRotate::renderSnapGuides()
for (S32 pass = 0; pass < 3; pass++)
{
// render snap guide ring
- glPushMatrix();
+ gGL.pushMatrix();
LLQuaternion snap_guide_rot;
F32 angle_radians, x, y, z;
snap_guide_rot.shortestArc(LLVector3::z_axis, getConstraintAxis());
snap_guide_rot.getAngleAxis(&angle_radians, &x, &y, &z);
- glTranslatef(center.mV[VX], center.mV[VY], center.mV[VZ]);
- glRotatef(angle_radians * RAD_TO_DEG, x, y, z);
+ gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]);
+ gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
LLColor4 line_color = setupSnapGuideRenderPass(pass);
@@ -826,7 +854,7 @@ void LLManipRotate::renderSnapGuides()
{
gl_circle_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE);
}
- glPopMatrix();
+ gGL.popMatrix();
for (S32 i = 0; i < 64; i++)
{