Fix linux build.
This commit is contained in:
parent
a6d92e142f
commit
9e1d951520
50 changed files with 1586 additions and 1192 deletions
|
@ -1,43 +1,92 @@
|
|||
#include "Transform.h"
|
||||
|
||||
Transform::Transform(const Point& location, double scaleX, double scaleY, double scaleZ)
|
||||
: mLocation(location),
|
||||
mScaleX(scaleX),
|
||||
mScaleY(scaleY),
|
||||
mScaleZ(scaleZ)
|
||||
Scale::Scale(double x, double y, double z)
|
||||
: mX(x),
|
||||
mY(y),
|
||||
mZ(z)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Scale::isIdentity() const
|
||||
{
|
||||
return mX == 1.0 && mY == 1.0 && mZ == 1.0;
|
||||
}
|
||||
|
||||
bool Scale::isEqual(const Scale& scale) const
|
||||
{
|
||||
return mX == scale.mX && mY == scale.mY && mZ == scale.mZ;
|
||||
}
|
||||
|
||||
Transform::Transform(const Point& location, const Scale& scale, const Rotation& rotation)
|
||||
: mLocation(location),
|
||||
mScale(scale),
|
||||
mRotation(rotation),
|
||||
mMatrix(4, 4)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Transform::applyPre(const Transform& transform)
|
||||
{
|
||||
mLocation.move(transform.getLocation().getX(), transform.getLocation().getY(), transform.getLocation().getZ());
|
||||
mScale *= transform.getScale();
|
||||
}
|
||||
|
||||
const Point& Transform::getLocation() const
|
||||
{
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
double Transform::getScaleX() const
|
||||
const Scale& Transform::getScale() const
|
||||
{
|
||||
return mScaleX;
|
||||
return mScale;
|
||||
}
|
||||
|
||||
double Transform::getScaleY() const
|
||||
const Rotation& Transform::getRotation() const
|
||||
{
|
||||
return mScaleY;
|
||||
return mRotation;
|
||||
}
|
||||
|
||||
double Transform::getScaleZ() const
|
||||
bool Transform::isEqual(const Transform& transform) const
|
||||
{
|
||||
return mScaleZ;
|
||||
return (mLocation == transform.mLocation) && (mScale == transform.mScale) && (mRotation == transform.mRotation);
|
||||
}
|
||||
|
||||
bool Transform::isIdentityTransform() const
|
||||
{
|
||||
return mLocation.isAtOrigin() && mScale.isIdentity();
|
||||
}
|
||||
|
||||
void Transform::setLocation(const Point& loc)
|
||||
{
|
||||
mLocation = loc;
|
||||
if (mLocation != loc)
|
||||
{
|
||||
mLocation = loc;
|
||||
updateMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
void Transform::setScale(double scaleX, double scaleY, double scaleZ)
|
||||
void Transform::setScale(const Scale& scale)
|
||||
{
|
||||
mScaleX = scaleX;
|
||||
mScaleY = scaleY;
|
||||
mScaleZ = scaleZ;
|
||||
if (mScale != scale)
|
||||
{
|
||||
mScale = scale;
|
||||
updateMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
void Transform::setRotation(const Rotation& rotation)
|
||||
{
|
||||
if (mRotation != rotation)
|
||||
{
|
||||
mRotation = rotation;
|
||||
updateMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
void Transform::updateMatrix()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue