mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Merge branch 'development' into EngineAPI-Refactor
This commit is contained in:
commit
3a71c75596
1937 changed files with 102332 additions and 70549 deletions
|
|
@ -6,158 +6,158 @@
|
|||
|
||||
EaseF::EaseF()
|
||||
{
|
||||
dir = 0;
|
||||
type = 0;
|
||||
param[0] = param[1] = -1.0f;
|
||||
mDir = 0;
|
||||
mType = 0;
|
||||
mParam[0] = mParam[1] = -1.0f;
|
||||
}
|
||||
|
||||
EaseF::EaseF(const EaseF &ease)
|
||||
{
|
||||
this->dir = ease.dir;
|
||||
this->type = ease.type;
|
||||
this->param[0] = ease.param[0];
|
||||
this->param[1] = ease.param[1];
|
||||
this->mDir = ease.mDir;
|
||||
this->mType = ease.mType;
|
||||
this->mParam[0] = ease.mParam[0];
|
||||
this->mParam[1] = ease.mParam[1];
|
||||
}
|
||||
|
||||
EaseF::EaseF(const S32 dir, const S32 type)
|
||||
{
|
||||
this->dir = dir;
|
||||
this->type = type;
|
||||
this->param[0] = this->param[1] = -1.0f;
|
||||
this->mDir = dir;
|
||||
this->mType = type;
|
||||
this->mParam[0] = this->mParam[1] = -1.0f;
|
||||
}
|
||||
|
||||
EaseF::EaseF(const S32 dir, const S32 type, F32 param[2])
|
||||
{
|
||||
this->dir = dir;
|
||||
this->type = type;
|
||||
this->param[0] = param[0];
|
||||
this->param[1] = param[1];
|
||||
this->mDir = dir;
|
||||
this->mType = type;
|
||||
this->mParam[0] = param[0];
|
||||
this->mParam[1] = param[1];
|
||||
}
|
||||
|
||||
void EaseF::set(const S32 dir, const S32 type)
|
||||
{
|
||||
this->dir = dir;
|
||||
this->type = type;
|
||||
this->param[0] = this->param[1] = -1.0f;
|
||||
this->mDir = dir;
|
||||
this->mType = type;
|
||||
this->mParam[0] = this->mParam[1] = -1.0f;
|
||||
}
|
||||
|
||||
void EaseF::set(const S32 dir, const S32 type, F32 param[2])
|
||||
{
|
||||
this->dir = dir;
|
||||
this->type = type;
|
||||
this->param[0] = param[0];
|
||||
this->param[1] = param[1];
|
||||
this->mDir = dir;
|
||||
this->mType = type;
|
||||
this->mParam[0] = param[0];
|
||||
this->mParam[1] = param[1];
|
||||
}
|
||||
|
||||
void EaseF::set(const S32 dir, const S32 type, F32 param0, F32 param1)
|
||||
{
|
||||
this->dir = dir;
|
||||
this->type = type;
|
||||
this->param[0] = param0;
|
||||
this->param[1] = param1;
|
||||
this->mDir = dir;
|
||||
this->mType = type;
|
||||
this->mParam[0] = param0;
|
||||
this->mParam[1] = param1;
|
||||
}
|
||||
|
||||
void EaseF::set(const char *s)
|
||||
{
|
||||
dSscanf(s,"%d %d %f %f",&dir,&type,¶m[0],¶m[1]);
|
||||
dSscanf(s,"%d %d %f %f",&mDir,&mType,&mParam[0],&mParam[1]);
|
||||
}
|
||||
|
||||
F32 EaseF::getValue(F32 t, F32 b, F32 c, F32 d) const
|
||||
{
|
||||
F32 value = 0;
|
||||
|
||||
if (type == Ease::Linear)
|
||||
if (mType == Ease::Linear)
|
||||
{
|
||||
value = mLinearTween(t,b, c, d);
|
||||
}
|
||||
else if (type == Ease::Quadratic)
|
||||
else if (mType == Ease::Quadratic)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInQuad(t,b, c, d);
|
||||
else if (dir == Ease::Out)
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutQuad(t,b, c, d);
|
||||
else if (dir == Ease::InOut)
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutQuad(t,b, c, d);
|
||||
}
|
||||
else if (type == Ease::Cubic)
|
||||
else if (mType == Ease::Cubic)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInCubic(t,b, c, d);
|
||||
else if (dir == Ease::Out)
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutCubic(t,b, c, d);
|
||||
else if (dir == Ease::InOut)
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutCubic(t,b, c, d);
|
||||
}
|
||||
else if (type == Ease::Quartic)
|
||||
else if (mType == Ease::Quartic)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInQuart(t,b, c, d);
|
||||
else if (dir == Ease::Out)
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutQuart(t,b, c, d);
|
||||
else if (dir == Ease::InOut)
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutQuart(t,b, c, d);
|
||||
}
|
||||
else if (type == Ease::Quintic)
|
||||
else if (mType == Ease::Quintic)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInQuint(t,b, c, d);
|
||||
else if (dir == Ease::Out)
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutQuint(t,b, c, d);
|
||||
else if (dir == Ease::InOut)
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutQuint(t,b, c, d);
|
||||
}
|
||||
else if (type == Ease::Sinusoidal)
|
||||
else if (mType == Ease::Sinusoidal)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInSine(t,b, c, d);
|
||||
else if (dir == Ease::Out)
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutSine(t,b, c, d);
|
||||
else if (dir == Ease::InOut)
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutSine(t,b, c, d);
|
||||
}
|
||||
else if (type == Ease::Exponential)
|
||||
else if (mType == Ease::Exponential)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInExpo(t,b, c, d);
|
||||
else if (dir == Ease::Out)
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutExpo(t,b, c, d);
|
||||
else if (dir == Ease::InOut)
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutExpo(t,b, c, d);
|
||||
}
|
||||
else if (type == Ease::Circular)
|
||||
else if (mType == Ease::Circular)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInCirc(t,b, c, d);
|
||||
else if (dir == Ease::Out)
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutCirc(t,b, c, d);
|
||||
else if (dir == Ease::InOut)
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutCirc(t,b, c, d);
|
||||
}
|
||||
else if (type == Ease::Elastic)
|
||||
else if (mType == Ease::Elastic)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
value = mEaseInElastic(t,b, c, d, param[0], param[1]);
|
||||
else if (dir == Ease::Out)
|
||||
value = mEaseOutElastic(t,b, c, d, param[0], param[1]);
|
||||
else if (dir == Ease::InOut)
|
||||
value = mEaseInOutElastic(t,b, c, d, param[0], param[1]);
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInElastic(t,b, c, d, mParam[0], mParam[1]);
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutElastic(t,b, c, d, mParam[0], mParam[1]);
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutElastic(t,b, c, d, mParam[0], mParam[1]);
|
||||
}
|
||||
else if (type == Ease::Back)
|
||||
else if (mType == Ease::Back)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
value = mEaseInBack(t,b, c, d, param[0]);
|
||||
else if (dir == Ease::Out)
|
||||
value = mEaseOutBack(t,b, c, d, param[0]);
|
||||
else if (dir == Ease::InOut)
|
||||
value = mEaseInOutBack(t,b, c, d, param[0]);
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInBack(t,b, c, d, mParam[0]);
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutBack(t,b, c, d, mParam[0]);
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutBack(t,b, c, d, mParam[0]);
|
||||
}
|
||||
else if (type == Ease::Bounce)
|
||||
else if (mType == Ease::Bounce)
|
||||
{
|
||||
if (dir == Ease::In)
|
||||
if (mDir == Ease::In)
|
||||
value = mEaseInBounce(t,b, c, d);
|
||||
else if (dir == Ease::Out)
|
||||
else if (mDir == Ease::Out)
|
||||
value = mEaseOutBounce(t,b, c, d);
|
||||
else if (dir == Ease::InOut)
|
||||
else if (mDir == Ease::InOut)
|
||||
value = mEaseInOutBounce(t,b, c, d);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -76,9 +76,9 @@ class EaseF : public Ease
|
|||
{
|
||||
//-------------------------------------- Public data
|
||||
public:
|
||||
S32 dir; // inout, in, out
|
||||
S32 type; // linear, etc...
|
||||
F32 param[2]; // optional params
|
||||
S32 mDir; // inout, in, out
|
||||
S32 mType; // linear, etc...
|
||||
F32 mParam[2]; // optional params
|
||||
|
||||
//-------------------------------------- Public interface
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
|
||||
S32 v1index = -1;
|
||||
bool v1Existed = false;
|
||||
for( U32 nvert = 0; nvert < pointList.size(); ++ nvert )
|
||||
if( pointList[ nvert ].equal( v1, 0.001f ) )
|
||||
for( U32 nvert = 0; nvert < mPointList.size(); ++ nvert )
|
||||
if(mPointList[ nvert ].equal( v1, 0.001f ) )
|
||||
{
|
||||
v1index = nvert;
|
||||
v1Existed = true;
|
||||
|
|
@ -149,8 +149,8 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
|
||||
S32 v2index = -1;
|
||||
bool v2Existed = false;
|
||||
for( U32 nvert = 0; nvert < pointList.size(); ++ nvert )
|
||||
if( pointList[ nvert ].equal( v2, 0.001f ) )
|
||||
for( U32 nvert = 0; nvert < mPointList.size(); ++ nvert )
|
||||
if(mPointList[ nvert ].equal( v2, 0.001f ) )
|
||||
{
|
||||
v2index = nvert;
|
||||
v2Existed = true;
|
||||
|
|
@ -161,30 +161,30 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
|
||||
if( !v1Existed )
|
||||
{
|
||||
v1index = pointList.size();
|
||||
pointList.push_back( v1 );
|
||||
v1index = mPointList.size();
|
||||
mPointList.push_back( v1 );
|
||||
}
|
||||
|
||||
// Add vertex 2, if necessary.
|
||||
|
||||
if( !v2Existed )
|
||||
{
|
||||
v2index = pointList.size();
|
||||
pointList.push_back( v2 );
|
||||
v2index = mPointList.size();
|
||||
mPointList.push_back( v2 );
|
||||
}
|
||||
|
||||
// If both v1 and v2 already existed in the point
|
||||
// set, this must be an edge that we are sharing so try
|
||||
// to find it.
|
||||
|
||||
const U32 thisPlaneIndex = planeList.size();
|
||||
const U32 thisPlaneIndex = mPlaneList.size();
|
||||
bool foundExistingEdge = false;
|
||||
|
||||
if( v1Existed && v2Existed )
|
||||
{
|
||||
for( U32 nedge = 0; nedge < edgeList.size(); ++ nedge )
|
||||
for( U32 nedge = 0; nedge < mEdgeList.size(); ++ nedge )
|
||||
{
|
||||
Edge& edge = edgeList[ nedge ];
|
||||
Edge& edge = mEdgeList[ nedge ];
|
||||
|
||||
if( ( edge.vertex[ 0 ] == v1index && edge.vertex[ 1 ] == v2index ) ||
|
||||
( edge.vertex[ 0 ] == v2index && edge.vertex[ 1 ] == v1index ) )
|
||||
|
|
@ -222,13 +222,13 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
|
||||
if( !invert )
|
||||
{
|
||||
edgeList.push_back(
|
||||
mEdgeList.push_back(
|
||||
Edge( thisPlaneIndex, 0, v1index, v2index )
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
edgeList.push_back(
|
||||
mEdgeList.push_back(
|
||||
Edge( thisPlaneIndex, 0, v2index, v1index )
|
||||
);
|
||||
}
|
||||
|
|
@ -242,6 +242,6 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes )
|
|||
// If this plane produced edges, add it.
|
||||
|
||||
if( haveEdges )
|
||||
planeList.push_back( currentPlane );
|
||||
mPlaneList.push_back( currentPlane );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,42 +124,42 @@ struct PolyhedronVectorData : public PolyhedronData
|
|||
typedef Vector< Edge > EdgeListType;
|
||||
|
||||
/// List of planes. Note that by default, the normals facing *inwards*.
|
||||
PlaneListType planeList;
|
||||
PlaneListType mPlaneList;
|
||||
|
||||
/// List of vertices.
|
||||
PointListType pointList;
|
||||
PointListType mPointList;
|
||||
|
||||
/// List of edges.
|
||||
EdgeListType edgeList;
|
||||
EdgeListType mEdgeList;
|
||||
|
||||
PolyhedronVectorData()
|
||||
{
|
||||
VECTOR_SET_ASSOCIATION( pointList );
|
||||
VECTOR_SET_ASSOCIATION( planeList );
|
||||
VECTOR_SET_ASSOCIATION( edgeList );
|
||||
VECTOR_SET_ASSOCIATION(mPointList);
|
||||
VECTOR_SET_ASSOCIATION(mPlaneList);
|
||||
VECTOR_SET_ASSOCIATION(mEdgeList);
|
||||
}
|
||||
|
||||
/// @name Accessors
|
||||
/// @{
|
||||
|
||||
/// Return the number of planes that make up this polyhedron.
|
||||
U32 getNumPlanes() const { return planeList.size(); }
|
||||
U32 getNumPlanes() const { return mPlaneList.size(); }
|
||||
|
||||
/// Return the planes that make up the polyhedron.
|
||||
/// @note The normals of these planes are facing *inwards*.
|
||||
PlaneF* getPlanes() const { return planeList.address(); }
|
||||
PlaneF* getPlanes() const { return mPlaneList.address(); }
|
||||
|
||||
/// Return the number of points that this polyhedron has.
|
||||
U32 getNumPoints() const { return pointList.size(); }
|
||||
U32 getNumPoints() const { return mPointList.size(); }
|
||||
|
||||
///
|
||||
Point3F* getPoints() const { return pointList.address(); }
|
||||
Point3F* getPoints() const { return mPointList.address(); }
|
||||
|
||||
/// Return the number of edges that this polyhedron has.
|
||||
U32 getNumEdges() const { return edgeList.size(); }
|
||||
U32 getNumEdges() const { return mEdgeList.size(); }
|
||||
|
||||
///
|
||||
Edge* getEdges() const { return edgeList.address(); }
|
||||
Edge* getEdges() const { return mEdgeList.address(); }
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
@ -168,9 +168,9 @@ struct PolyhedronVectorData : public PolyhedronData
|
|||
|
||||
void buildBox( const MatrixF& mat, const Box3F& box, bool invertNormals = false )
|
||||
{
|
||||
pointList.setSize( 8 );
|
||||
planeList.setSize( 6 );
|
||||
edgeList.setSize( 12 );
|
||||
mPointList.setSize( 8 );
|
||||
mPlaneList.setSize( 6 );
|
||||
mEdgeList.setSize( 12 );
|
||||
|
||||
buildBoxData( *this, mat, box, invertNormals );
|
||||
}
|
||||
|
|
@ -190,13 +190,13 @@ struct PolyhedronUnmanagedVectorData : public PolyhedronData
|
|||
protected:
|
||||
|
||||
/// List of planes. Note that by default, the normals facing *inwards*.
|
||||
PlaneListType planeList;
|
||||
PlaneListType mPlaneList;
|
||||
|
||||
/// List of vertices.
|
||||
PointListType pointList;
|
||||
PointListType mPointList;
|
||||
|
||||
/// List of edges.
|
||||
EdgeListType edgeList;
|
||||
EdgeListType mEdgeList;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -204,26 +204,26 @@ struct PolyhedronUnmanagedVectorData : public PolyhedronData
|
|||
/// @{
|
||||
|
||||
/// Return the number of planes that make up this polyhedron.
|
||||
U32 getNumPlanes() const { return planeList.size(); }
|
||||
U32 getNumPlanes() const { return mPlaneList.size(); }
|
||||
|
||||
/// Return the planes that make up the polyhedron.
|
||||
/// @note The normals of these planes are facing *inwards*.
|
||||
const PlaneF* getPlanes() const { return planeList.address(); }
|
||||
PlaneF* getPlanes() { return planeList.address(); }
|
||||
const PlaneF* getPlanes() const { return mPlaneList.address(); }
|
||||
PlaneF* getPlanes() { return mPlaneList.address(); }
|
||||
|
||||
/// Return the number of points that this polyhedron has.
|
||||
U32 getNumPoints() const { return pointList.size(); }
|
||||
U32 getNumPoints() const { return mPointList.size(); }
|
||||
|
||||
///
|
||||
const Point3F* getPoints() const { return pointList.address(); }
|
||||
Point3F* getPoints() { return pointList.address(); }
|
||||
const Point3F* getPoints() const { return mPointList.address(); }
|
||||
Point3F* getPoints() { return mPointList.address(); }
|
||||
|
||||
/// Return the number of edges that this polyhedron has.
|
||||
U32 getNumEdges() const { return edgeList.size(); }
|
||||
U32 getNumEdges() const { return mEdgeList.size(); }
|
||||
|
||||
///
|
||||
const Edge* getEdges() const { return edgeList.address(); }
|
||||
Edge* getEdges() { return edgeList.address(); }
|
||||
const Edge* getEdges() const { return mEdgeList.address(); }
|
||||
Edge* getEdges() { return mEdgeList.address(); }
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
|
@ -239,13 +239,13 @@ struct PolyhedronFixedVectorData : public PolyhedronData
|
|||
protected:
|
||||
|
||||
/// List of planes. Note that by default, the normals facing *inwards*.
|
||||
PlaneListType planeList;
|
||||
PlaneListType mPlaneList;
|
||||
|
||||
/// List of vertices.
|
||||
PointListType pointList;
|
||||
PointListType mPointList;
|
||||
|
||||
/// List of edges.
|
||||
EdgeListType edgeList;
|
||||
EdgeListType mEdgeList;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -254,23 +254,23 @@ struct PolyhedronFixedVectorData : public PolyhedronData
|
|||
/// @{
|
||||
|
||||
/// Return the number of planes that make up this polyhedron.
|
||||
U32 getNumPlanes() const { return planeList.size(); }
|
||||
U32 getNumPlanes() const { return mPlaneList.size(); }
|
||||
|
||||
/// Return the planes that make up the polyhedron.
|
||||
/// @note The normals of these planes are facing *inwards*.
|
||||
PlaneF* getPlanes() const { return planeList.address(); }
|
||||
PlaneF* getPlanes() const { return mPlaneList.address(); }
|
||||
|
||||
/// Return the number of points that this polyhedron has.
|
||||
U32 getNumPoints() const { return pointList.size(); }
|
||||
U32 getNumPoints() const { return mPointList.size(); }
|
||||
|
||||
///
|
||||
Point3F* getPoints() const { return pointList.address(); }
|
||||
Point3F* getPoints() const { return mPointList.address(); }
|
||||
|
||||
/// Return the number of edges that this polyhedron has.
|
||||
U32 getNumEdges() const { return edgeList.size(); }
|
||||
U32 getNumEdges() const { return mEdgeList.size(); }
|
||||
|
||||
///
|
||||
Edge* getEdges() const { return edgeList.address(); }
|
||||
Edge* getEdges() const { return mEdgeList.address(); }
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
@ -302,9 +302,9 @@ struct PolyhedronImpl : public Base
|
|||
/// Construct a polyhedron described by the given planes and edges.
|
||||
PolyhedronImpl( PlaneListType planes, PointListType points, EdgeListType edges )
|
||||
{
|
||||
this->planeList = planes;
|
||||
this->pointList = points;
|
||||
this->edgeList = edges;
|
||||
this->mPlaneList = planes;
|
||||
this->mPointList = points;
|
||||
this->mEdgeList = edges;
|
||||
}
|
||||
|
||||
/// Return the AABB around the polyhedron.
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B
|
|||
|
||||
// Corner points.
|
||||
|
||||
typename Polyhedron::PointListType& pointList = poly.pointList;
|
||||
typename Polyhedron::PointListType& pointList = poly.mPointList;
|
||||
|
||||
pointList[ 0 ] = min; // near left bottom
|
||||
pointList[ 1 ] = min + yvec; // far left bottom
|
||||
|
|
@ -475,7 +475,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B
|
|||
|
||||
// Side planes.
|
||||
|
||||
typename Polyhedron::PlaneListType& planeList = poly.planeList;
|
||||
typename Polyhedron::PlaneListType& planeList = poly.mPlaneList;
|
||||
|
||||
const F32 pos = invertNormals ? -1.f : 1.f;
|
||||
const F32 neg = - pos;
|
||||
|
|
@ -490,7 +490,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B
|
|||
// The edges are constructed so that the vertices
|
||||
// are oriented clockwise for face[0].
|
||||
|
||||
typename Polyhedron::EdgeType* edge = &poly.edgeList[ 0 ];
|
||||
typename Polyhedron::EdgeType* edge = &poly.mEdgeList[ 0 ];
|
||||
|
||||
for( U32 i = 0; i < 4; ++ i )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ inline QuatF& QuatF::neg()
|
|||
|
||||
inline F32 QuatF::dot( const QuatF &q ) const
|
||||
{
|
||||
return (w*q.w + x*q.x + y*q.y + z*q.z);
|
||||
return mClampF(w*q.w + x*q.x + y*q.y + z*q.z, -1.0f, 1.0f);
|
||||
}
|
||||
|
||||
inline F32 QuatF::angleBetween( const QuatF & q )
|
||||
|
|
|
|||
|
|
@ -142,10 +142,10 @@ inline bool mathRead(Stream& stream, QuatF* q)
|
|||
|
||||
inline bool mathRead(Stream& stream, EaseF* e)
|
||||
{
|
||||
bool success = stream.read( &e->dir );
|
||||
success &= stream.read( &e->type );
|
||||
success &= stream.read( &e->param[ 0 ] );
|
||||
success &= stream.read( &e->param[ 1 ] );
|
||||
bool success = stream.read( &e->mDir );
|
||||
success &= stream.read( &e->mType );
|
||||
success &= stream.read( &e->mParam[ 0 ] );
|
||||
success &= stream.read( &e->mParam[ 1 ] );
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
@ -270,10 +270,10 @@ inline bool mathWrite(Stream& stream, const QuatF& q)
|
|||
|
||||
inline bool mathWrite(Stream& stream, const EaseF& e)
|
||||
{
|
||||
bool success = stream.write(e.dir);
|
||||
success &= stream.write(e.type);
|
||||
success &= stream.write(e.param[0]);
|
||||
success &= stream.write(e.param[1]);
|
||||
bool success = stream.write(e.mDir);
|
||||
success &= stream.write(e.mType);
|
||||
success &= stream.write(e.mParam[0]);
|
||||
success &= stream.write(e.mParam[1]);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ ConsoleGetType( TypeEaseF )
|
|||
static const U32 bufSize = 256;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(returnBuffer, bufSize, "%d %d %g %g",
|
||||
pEase->dir, pEase->type, pEase->param[0], pEase->param[1]);
|
||||
pEase->mDir, pEase->mType, pEase->mParam[0], pEase->mParam[1]);
|
||||
|
||||
return returnBuffer;
|
||||
}
|
||||
|
|
@ -567,11 +567,11 @@ ConsoleSetType( TypeEaseF )
|
|||
EaseF* pDst = (EaseF*)dptr;
|
||||
|
||||
// defaults...
|
||||
pDst->param[0] = -1.0f;
|
||||
pDst->param[1] = -1.0f;
|
||||
pDst->mParam[0] = -1.0f;
|
||||
pDst->mParam[1] = -1.0f;
|
||||
if (argc == 1) {
|
||||
U32 args = dSscanf(argv[0], "%d %d %f %f", // the two params are optional and assumed -1 if not present...
|
||||
&pDst->dir, &pDst->type, &pDst->param[0],&pDst->param[1]);
|
||||
&pDst->mDir, &pDst->mType, &pDst->mParam[0],&pDst->mParam[1]);
|
||||
if( args < 2 )
|
||||
Con::warnf( "Warning, EaseF probably not read properly" );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1086,9 +1086,9 @@ bool mRayQuadCollide( const Quad &quad,
|
|||
- (beta * (alpha_11 - 1.0f)) - 1.0f;
|
||||
F32 C = alpha;
|
||||
F32 D = (B * B) - (4.0f * A * C);
|
||||
F32 Q = -0.5f * (B + (B < 0.0f ? -1.0f : 1.0f) ) * mSqrt(D);
|
||||
u = Q / A;
|
||||
if ((u < 0.0f) || (u > 1.0f)) u = C / Q;
|
||||
F32 F = -0.5f * (B + (B < 0.0f ? -1.0f : 1.0f) ) * mSqrt(D);
|
||||
u = F / A;
|
||||
if ((u < 0.0f) || (u > 1.0f)) u = C / F;
|
||||
v = beta / ((u * (beta_11 - 1.0f)) + 1.0f);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue