Skip to content

Commit

Permalink
Remove a few unused lines of code
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 17, 2017
1 parent 2677cf0 commit 1b93ed5
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 40 deletions.
26 changes: 0 additions & 26 deletions libs/pivot.h
Expand Up @@ -157,32 +157,6 @@ inline Matrix4 getPerspectiveScale(const Matrix4& pivot2screen)
return Matrix4::getScale(Vector3(tw, tw, tw));
}

/**
* Returns a transform that is converting device coordinates to local object space (manipulator space)
*
* Not entirely sure what the algorithm is, but it's starting with the device2object matrix,
* multiplying it by the scale taken from the object2screen transform, and adding the perspective
* division on top of that:
*
* device2manip = ScaleByInverseW * Scale(object2screen) * device2Object
*
* DEPRECATED
*/
inline Matrix4 constructDevice2Manip(const Matrix4& object2world, const Matrix4& world2view, const Matrix4& view2device, const Matrix4& device2screen)
{
Matrix4 pivot2screen = constructObject2Screen(object2world, world2view, view2device, device2screen);

Matrix4 device2manip = constructObject2Device(object2world, world2view, view2device);

Matrix4 scale = getInverseScale(pivot2screen);
device2manip.multiplyBy(scale);

scale = getPerspectiveScale(pivot2screen);
device2manip.multiplyBy(scale);

return device2manip.getFullInverse();
}

/**
* greebo: Replacement for the above constructDevice2Manip. This produces a matrix
* that is converting pivot space coordinates into normalised device coords.
Expand Down
12 changes: 1 addition & 11 deletions radiant/selection/ManipulateMouseTool.cpp
Expand Up @@ -132,14 +132,6 @@ bool ManipulateMouseTool::selectManipulator(const render::View& view, const Vect
// is a manipulator selected / the pivot moving?
if (_manipulationActive)
{
selection::Pivot2World pivot;
pivot.update(pivot2World, view.GetModelview(), view.GetProjection(), view.GetViewport());

_manip2pivotStart = _pivot2worldStart.getFullInverse().getMultipliedBy(pivot._worldSpace);

//Matrix4 device2pivot = constructDevice2Pivot(_pivot2worldStart, view);
//Matrix4 device2manip = constructDevice2Manip(_pivot2worldStart, view.GetModelview(), view.GetProjection(), view.GetViewport());

activeManipulator->getActiveComponent()->beginTransformation(_pivot2worldStart, view, devicePoint);

_deviceStart = devicePoint;
Expand All @@ -166,10 +158,10 @@ void ManipulateMouseTool::handleMouseMove(const render::View& view, const Vector
GlobalUndoSystem().start();
}

#if _DEBUG
Matrix4 device2pivot = constructDevice2Pivot(_pivot2worldStart, view);
Matrix4 pivot2device = constructPivot2Device(_pivot2worldStart, view);

#if _DEBUG
Vector4 pivotDev = pivot2device.transform(Vector4(0,0,0,1));

_debugText = (boost::format("\nPivotDevice x,y,z,w = (%5.3lf %5.3lf %5.3lf %5.3lf)") % pivotDev.x() % pivotDev.y() % pivotDev.z() % pivotDev.w()).str();
Expand All @@ -187,8 +179,6 @@ void ManipulateMouseTool::handleMouseMove(const render::View& view, const Vector
_debugText += (boost::format("\nTest reversal x,y,z = (%5.3lf %5.3lf %5.3lf)") % worldPosH.x() % worldPosH.y() % worldPosH.z()).str();
#endif

Matrix4 device2manip = constructDevice2Manip(_pivot2worldStart, view.GetModelview(), view.GetProjection(), view.GetViewport());

Vector2 constrainedDevicePoint(devicePoint);

// Constrain the movement to the axes, if the modifier is held
Expand Down
2 changes: 0 additions & 2 deletions radiant/selection/ManipulateMouseTool.h
Expand Up @@ -27,8 +27,6 @@ class ManipulateMouseTool :
Matrix4 _pivot2worldStart;
bool _manipulationActive;

Matrix4 _manip2pivotStart;

Vector2 _deviceStart;
bool _undoBegun;

Expand Down
2 changes: 1 addition & 1 deletion radiant/selection/manipulators/ManipulatorComponents.cpp
Expand Up @@ -24,7 +24,7 @@ Vector3 ManipulatorComponentBase::getPlaneProjectedPoint(const Matrix4& pivot2wo

// greebo: We need to know the z-distance (or depth) of the pivot plane in device coordinates.
// x and y are defined by the mouse clicks, but we need the third depth component to pass into the
// device2pivot matrix. Lucky, this value can be extracted from the pivot2device matrix itself,
// device2pivot matrix. Luckily, this value can be extracted from the pivot2device matrix itself,
// because the distance of that plane in device space is stored in the tz matrix component.
// The trick is to invert the device2pivot matrix to get the tz value, to get a complete 4D point
// to transform back into pivot space.
Expand Down

0 comments on commit 1b93ed5

Please sign in to comment.