uninitialized variables-math

This commit is contained in:
AzaezelX 2020-05-11 16:17:40 -05:00
parent 5f59ebbacc
commit ebb7ed1b78
13 changed files with 32 additions and 19 deletions

View file

@ -67,6 +67,8 @@ class AngAxisF
inline AngAxisF::AngAxisF()
{
axis = Point3F(0.0f,0.0f,1.0f);
angle = 0.0f;
}
inline AngAxisF::AngAxisF( const Point3F & _axis, F32 _angle )

View file

@ -22,7 +22,7 @@
#ifndef _MMATRIX_H_
#define _MMATRIX_H_
#include <algorithm>
#ifndef _MPLANE_H_
#include "math/mPlane.h"
#endif
@ -232,6 +232,8 @@ inline MatrixF::MatrixF(bool _identity)
{
if (_identity)
identity();
else
std::fill_n(m, 16, 0);
}
inline MatrixF::MatrixF( const EulerF &e )

View file

@ -66,7 +66,7 @@ class PlaneF : public Point3F
/// @name Initialization
/// @{
PlaneF() {}
PlaneF() :d(0.0f) {}
PlaneF( const Point3F& p, const Point3F& n );
/// NOTE: d is the NEGATIVE distance along the xyz normal.
PlaneF( F32 _x, F32 _y, F32 _z, F32 _d);
@ -571,6 +571,7 @@ public:
inline PlaneD::PlaneD()
{
d = 0.0;
}
inline PlaneD::

View file

@ -76,7 +76,7 @@ class PlaneSet
/// Create an uninitialized set.
/// @warn None of the members will be initialized.
PlaneSet() {}
PlaneSet() :mNumPlanes(0), mPlanes(NULL) {}
/// Use the given set of planes to initialize the set.
///

View file

@ -266,8 +266,8 @@ class Point2D
//-------------------------------------- Point2I
//
inline Point2I::Point2I()
:x(0),y(0)
{
//
}
@ -448,8 +448,8 @@ inline Point2I& Point2I::operator/=(const Point2I &_vec)
//-------------------------------------- Point2F
//
inline Point2F::Point2F()
:x(0.0f), y(0.0f)
{
//
}
@ -692,8 +692,8 @@ inline void Point2F::normalizeSafe()
//-------------------------------------- Point2D
//
inline Point2D::Point2D()
:x(0.0), y(0.0)
{
//
}

View file

@ -276,8 +276,8 @@ public:
//-------------------------------------- Point3I
//
inline Point3I::Point3I()
: x(0), y(0), z(0)
{
//
}
inline Point3I::Point3I(const Point3I& _copy)
@ -431,9 +431,7 @@ inline Point3I& Point3I::operator/=(S32 div)
//-------------------------------------- Point3F
//
inline Point3F::Point3F()
#if defined(TORQUE_OS_LINUX)
: x(0.f), y(0.f), z(0.f)
#endif
: x(0.0f), y(0.0f), z(0.0f)
{
// Uninitialized points are definitely a problem.
// Enable the following code to see how often they crop up.
@ -761,6 +759,7 @@ inline Point3F& Point3F::operator=(const Point3D &_vec)
//-------------------------------------- Point3D
//
inline Point3D::Point3D()
: x(0.0), y(0.0), z(0.0)
{
//
}

View file

@ -39,7 +39,7 @@
class Point4I
{
public:
Point4I() {}
Point4I() :x(0), y(0), z(0), w(0) {}
Point4I(S32 _x, S32 _y, S32 _z, S32 _w);
void zero(); ///< Zero all values
@ -127,6 +127,7 @@ inline void Point4I::zero()
//-------------------------------------- Point4F
//
inline Point4F::Point4F()
:x(0.0f), y(0.0f), z(0.0f), w(0.0f)
{
}

View file

@ -98,7 +98,7 @@ struct PolyhedronData
/// it defines a *clockwise* orientation for face[ 0 ]. This is important!
U32 vertex[ 2 ];
Edge() {}
Edge() { std::fill_n(face, 2, 0), std::fill_n(vertex, 0, 0); }
Edge( U32 face1, U32 face2, U32 vertex1, U32 vertex2 )
{
face[ 0 ] = face1;

View file

@ -42,7 +42,7 @@ public:
public:
F32 x,y,z,w;
QuatF() {} // no init constructor
QuatF() :x(0.0f), y(0.0f), z(0.0f), w(1.0f) {} //identity constructor
QuatF( F32 _x, F32 _y, F32 _z, F32 w );
QuatF( const Point3F &axis, F32 angle );
QuatF( const MatrixF & m );

View file

@ -33,7 +33,7 @@
class MRandomGenerator
{
protected:
MRandomGenerator() {}
MRandomGenerator() :mSeed(-1) {}
S32 mSeed;
public:

View file

@ -35,7 +35,7 @@ public:
F32 radius;
public:
SphereF() { }
SphereF() :radius(1.0f) {}
SphereF( const Point3F& in_rPosition, const F32 in_rRadius )
: center(in_rPosition),
radius(in_rRadius)

View file

@ -186,8 +186,16 @@ struct FrustumData : public PolyhedronData
void _update() const;
FrustumData()
: mDirty( false ),
mIsInverted( false ) {}
: mIsOrtho(false),
mNearLeft(-1.0f),
mNearRight(1.0f),
mNearTop(1.0f),
mNearBottom(-1.0f),
mNearDist(0.1f),
mFarDist(1.0f),
mTransform(MatrixF(true)),
mDirty( false ),
mIsInverted( false ) {}
public:
@ -478,4 +486,4 @@ class Frustum : public PolyhedronImpl< FrustumData >
/// @}
};
#endif // _MATHUTIL_FRUSTUM_H_
#endif // _MATHUTIL_FRUSTUM_H_

View file

@ -73,7 +73,7 @@ public:
struct Sample
{
Sample() {}
Sample() :mF(0) { dMemset(&mVal, 0, sizeof(mVal)); }
Sample( F32 f, const T &val ) : mF(f), mVal(val) {}
F32 mF;