Skip to content

Commit

Permalink
Fixed an issue with uninitialized member variables and cleaned up the…
Browse files Browse the repository at this point in the history
… Camera classes.
  • Loading branch information
Paul Houx committed Feb 14, 2019
1 parent 564f917 commit fa4d3c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 5 additions & 3 deletions include/cinder/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ class CI_API Camera {

protected:
Camera()
: mModelViewCached( false ), mProjectionCached( false ), mInverseModelViewCached( false ), mWorldUp( vec3( 0, 1, 0 ) ),
mPivotDistance( 0 )
{}
: mWorldUp( vec3( 0, 1, 0 ) ), mFov( 35 ), mAspectRatio( 1 ), mNearClip( 0.1f ), mFarClip( 1000 )
, mPivotDistance( 1 ), mProjectionCached( false ), mModelViewCached( false ), mInverseModelViewCached( false )
, mFrustumLeft( -1 ), mFrustumRight( 1 ), mFrustumTop( 1 ), mFrustumBottom( -1 )
{
}

void calcMatrices() const;

Expand Down
5 changes: 0 additions & 5 deletions src/cinder/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,12 @@ void Camera::calcInverseView() const
// CameraPersp
// Creates a default camera resembling Maya Persp
CameraPersp::CameraPersp()
: Camera()
{
lookAt( vec3( 28, 21, 28 ), vec3(), vec3( 0, 1, 0 ) );
setPerspective( 35, 1.3333f, 0.1f, 1000 );
}

CameraPersp::CameraPersp( int pixelWidth, int pixelHeight, float fovDegrees )
: Camera()
{
float eyeX = pixelWidth / 2.0f;
float eyeY = pixelHeight / 2.0f;
Expand All @@ -267,7 +265,6 @@ CameraPersp::CameraPersp( int pixelWidth, int pixelHeight, float fovDegrees )
}

CameraPersp::CameraPersp( int pixelWidth, int pixelHeight, float fovDegrees, float nearPlane, float farPlane )
: Camera()
{
float halfFov, theTan, aspect;

Expand Down Expand Up @@ -386,14 +383,12 @@ CameraPersp CameraPersp::calcFraming( const Sphere &worldSpaceSphere ) const
////////////////////////////////////////////////////////////////////////////////////////
// CameraOrtho
CameraOrtho::CameraOrtho()
: Camera()
{
lookAt( vec3( 0, 0, 0.1f ), vec3(), vec3( 0, 1, 0 ) );
setFov( 35 );
}

CameraOrtho::CameraOrtho( float left, float right, float bottom, float top, float nearPlane, float farPlane )
: Camera()
{
mFrustumLeft = left;
mFrustumRight = right;
Expand Down

0 comments on commit fa4d3c6

Please sign in to comment.