Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/ trim whitespaces #2342

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 8 additions & 8 deletions include/cinder/Arcball.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class CI_API Arcball {
: mCamera( camera ), mUseConstraint( false ), mSphere( sphere )
{
}

void mouseDown( const app::MouseEvent &event )
{
mouseDown( event.getPos(), event.getWindow()->getSize() );
}

void mouseDown( const vec2 &mousePos, const ivec2 &windowSize )
{
mInitialMousePos = mousePos;
Expand All @@ -63,7 +63,7 @@ class CI_API Arcball {
{
mouseDrag( event.getPos(), event.getWindow()->getSize() );
}

void mouseDrag( const vec2 &mousePos, const ivec2 &windowSize )
{
float addition;
Expand All @@ -81,18 +81,18 @@ class CI_API Arcball {

mCurrentQuat = normalize( rotation * mInitialQuat );
}

void resetQuat() { mCurrentQuat = mInitialQuat = quat(); }
const quat& getQuat() const { return mCurrentQuat; }
void setQuat( const quat &q ) { mCurrentQuat = q; }
void setSphere( const Sphere &s ) { mSphere = s; }
const Sphere& getSphere() const { return mSphere; }

void setConstraintAxis( const vec3 &constraintAxis ) { mConstraintAxis = normalize( constraintAxis ); mUseConstraint = true; }
void setNoConstraintAxis() { mUseConstraint = false; }
bool isUsingConstraint() const { return mUseConstraint; }
const vec3& getConstraintAxis() const { return mConstraintAxis; }

void mouseOnSphere( const vec2 &point, const ivec2 &windowSize, vec3 *resultVector, float *resultAngleAddition )
{
float rayT;
Expand All @@ -114,7 +114,7 @@ class CI_API Arcball {
vec3 closestPointOnSphere = mSphere.closestPoint( newRay );
// our result point is the vector between this closest point on the sphere and its center
*resultVector = normalize( closestPointOnSphere - mSphere.getCenter() );

// our angle addition is the screen-space distance between the mouse and the closest point on the sphere, divided into
// the screen-space radius of the sphere's projected ellipse, multiplied by pi
float screenRadius = std::max( length( axisA ), length( axisB ) );
Expand Down Expand Up @@ -144,7 +144,7 @@ class CI_API Arcball {
onPlane = -onPlane;
return ( onPlane * ( 1.0f / math<float>::sqrt( norm ) ) );
}

if( dot( axis, vec3( 0, 0, 1 ) ) < 0.0001f )
onPlane = vec3( 1, 0, 0 );
else
Expand Down
6 changes: 3 additions & 3 deletions include/cinder/Area.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class CI_API Area {
explicit Area( const RectT<float> &r );

void set( int32_t aX1, int32_t aY1, int32_t aX2, int32_t aY2 );

int32_t getWidth() const { return x2 - x1; }
int32_t getHeight() const { return y2 - y1; }
ivec2 getSize() const { return ivec2( x2 - x1, y2 - y1 ); }
vec2 getCenter() const { return vec2( ( x1 + x2 ) / 2.0f, ( y1 + y2 ) / 2.0f ); }
int32_t calcArea() const { return getWidth() * getHeight(); }

void clipBy( const Area &clip );
Area getClipBy( const Area &clip ) const;

Expand Down Expand Up @@ -127,7 +127,7 @@ class CI_API Area {
friend CI_API std::ostream& operator<<( std::ostream &o, const Area &area )
{
return o << "(" << area.x1 << ", " << area.y1 << ")-(" << area.x2 << ", " << area.y2 << ")";
}
}
};

extern CI_API std::pair<Area,ivec2> clippedSrcDst( const Area &srcSurfaceBounds, const Area &srcArea, const Area &dstSurfaceBounds, const ivec2 &dstLT );
Expand Down
2 changes: 1 addition & 1 deletion include/cinder/AxisAlignedBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CI_API AxisAlignedBox {
//! Returns the extents of the axis-aligned box.
const vec3& getExtents() const { return mExtents; }

//! Returns the size of the axis-aligned box.
//! Returns the size of the axis-aligned box.
vec3 getSize() const { return 2.0f * mExtents; }

//! Returns the corner of the axis-aligned box with the smallest x, y and z coordinates.
Expand Down
2 changes: 1 addition & 1 deletion include/cinder/BSpline.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class CI_API BSpline {
// reallocated and the first d points are replicated. In either case the
// knot array is calculated accordingly.
BSpline( const std::vector<VecT> &points, int degree, bool loop, bool open );

// Open, nonuniform spline. The knot array must have n-d elements. The
// elements must be nondecreasing. Each element must be in [0,1].
BSpline() : mCtrlPoints( 0 ), mNumCtrlPoints( -1 ) {}
Expand Down
8 changes: 4 additions & 4 deletions include/cinder/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ class CI_API Buffer {

void* getData() { return mData; }
const void* getData() const { return mData; }

void resize( size_t newSize );

void copyFrom( const void *data, size_t length );
//TODO: copy from region of another buffer

//! Writes a Buffer to a DataTarget
void write( const DataTargetRef &dataTarget );

private:
void* mData;
size_t mAllocatedSize;
Expand Down
40 changes: 20 additions & 20 deletions include/cinder/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CI_API Camera {
//! Sets the position in world-space from which the Camera is viewing
void setEyePoint( const vec3 &eyePoint );

//! Returns the vector in world-space which represents "up" - typically vec3( 0, 1, 0 )
//! Returns the vector in world-space which represents "up" - typically vec3( 0, 1, 0 )
vec3 getWorldUp() const { return mWorldUp; }
//! Sets the vector in world-space which represents "up" - typically vec3( 0, 1, 0 )
void setWorldUp( const vec3 &worldUp );
Expand Down Expand Up @@ -105,7 +105,7 @@ class CI_API Camera {
void getFrustum( float *left, float *top, float *right, float *bottom, float *near, float *far ) const;
//! Returns whether the camera represents a perspective projection instead of an orthographic
virtual bool isPersp() const = 0;

//! Returns the Camera's Projection matrix, which converts view-space into clip-space
virtual const mat4& getProjectionMatrix() const { if( ! mProjectionCached ) calcProjection(); return mProjectionMatrix; }
//! Returns the Camera's View matrix, which converts world-space into view-space
Expand Down Expand Up @@ -162,7 +162,7 @@ class CI_API Camera {

float mFov; // vertical field of view in degrees
float mAspectRatio;
float mNearClip;
float mNearClip;
float mFarClip;
float mPivotDistance;

Expand All @@ -176,7 +176,7 @@ class CI_API Camera {
mutable bool mModelViewCached;
mutable mat4 mInverseModelViewMatrix;
mutable bool mInverseModelViewCached;

mutable float mFrustumLeft, mFrustumRight, mFrustumTop, mFrustumBottom;
};

Expand All @@ -192,34 +192,34 @@ class CI_API CameraPersp : public Camera {

//! Configures the camera's projection according to the provided parameters.
void setPerspective( float verticalFovDegrees, float aspectRatio, float nearPlane, float farPlane );
/** Returns both the horizontal and vertical lens shift.

/** Returns both the horizontal and vertical lens shift.
A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport.
A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport. */
void getLensShift( float *horizontal, float *vertical ) const { *horizontal = mLensShift.x; *vertical = mLensShift.y; }
/** Returns both the horizontal and vertical lens shift.
/** Returns both the horizontal and vertical lens shift.
A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport.
A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport. */
vec2 getLensShift() const { return vec2( mLensShift.x, mLensShift.y ); }
/** Sets both the horizontal and vertical lens shift.
/** Sets both the horizontal and vertical lens shift.
A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport.
A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport. */
void setLensShift( float horizontal, float vertical );
/** Sets both the horizontal and vertical lens shift.
/** Sets both the horizontal and vertical lens shift.
A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport.
A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport. */
void setLensShift( const vec2 &shift ) { setLensShift( shift.x, shift.y ); }
//! Returns the horizontal lens shift. A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport.
float getLensShiftHorizontal() const { return mLensShift.x; }
/** Sets the horizontal lens shift.
/** Sets the horizontal lens shift.
A horizontal lens shift of 1 (-1) will shift the view right (left) by half the width of the viewport. */
void setLensShiftHorizontal( float horizontal ) { setLensShift( horizontal, mLensShift.y ); }
//! Returns the vertical lens shift. A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport.
float getLensShiftVertical() const { return mLensShift.y; }
/** Sets the vertical lens shift.
/** Sets the vertical lens shift.
A vertical lens shift of 1 (-1) will shift the view up (down) by half the height of the viewport. */
void setLensShiftVertical( float vertical ) { setLensShift( mLensShift.x, vertical ); }

bool isPersp() const override { return true; }

//! Returns a Camera whose eyePoint is positioned to exactly frame \a worldSpaceSphere but is equivalent in other parameters (including orientation). Sets the result's pivotDistance to be the distance to \a worldSpaceSphere's center.
Expand Down Expand Up @@ -255,27 +255,27 @@ class CI_API CameraOrtho : public Camera {
//! A Camera used for stereoscopic displays.
class CI_API CameraStereo : public CameraPersp {
public:
CameraStereo()
CameraStereo()
: mConvergence( 1.0f ), mEyeSeparation( 0.05f ), mIsStereo( false ), mIsLeft( true ) {}
CameraStereo( int pixelWidth, int pixelHeight, float fov )
: CameraPersp( pixelWidth, pixelHeight, fov ),
: CameraPersp( pixelWidth, pixelHeight, fov ),
mConvergence( 1.0f ), mEyeSeparation( 0.05f ), mIsStereo( false ), mIsLeft( true ) {} // constructs screen-aligned camera
CameraStereo( int pixelWidth, int pixelHeight, float fov, float nearPlane, float farPlane )
: CameraPersp( pixelWidth, pixelHeight, fov, nearPlane, farPlane ),
: CameraPersp( pixelWidth, pixelHeight, fov, nearPlane, farPlane ),
mConvergence( 1.0f ), mEyeSeparation( 0.05f ), mIsStereo( false ), mIsLeft( true ) {} // constructs screen-aligned camera

//! Returns the current convergence, which is the distance at which there is no parallax.
float getConvergence() const { return mConvergence; }
//! Sets the convergence of the camera, which is the distance at which there is no parallax.
void setConvergence( float distance, bool adjustEyeSeparation = false );

//! Returns the distance between the camera's for the left and right eyes.
float getEyeSeparation() const { return mEyeSeparation; }
//! Sets the distance between the camera's for the left and right eyes. This affects the parallax effect.
//! Sets the distance between the camera's for the left and right eyes. This affects the parallax effect.
void setEyeSeparation( float distance ) { mEyeSeparation = distance; mModelViewCached = false; mProjectionCached = false; }
//! Returns the location of the currently enabled eye camera.
vec3 getEyePointShifted() const;

//! Enables the left eye camera.
void enableStereoLeft() { mIsStereo = true; mIsLeft = true; }
//! Returns whether the left eye camera is enabled.
Expand All @@ -291,7 +291,7 @@ class CI_API CameraStereo : public CameraPersp {

void getNearClipCoordinates( vec3 *topLeft, vec3 *topRight, vec3 *bottomLeft, vec3 *bottomRight ) const override { return getShiftedClipCoordinates( mNearClip, 1.0f, topLeft, topRight, bottomLeft, bottomRight ); }
void getFarClipCoordinates( vec3 *topLeft, vec3 *topRight, vec3 *bottomLeft, vec3 *bottomRight ) const override { return getShiftedClipCoordinates( mFarClip, mFarClip / mNearClip, topLeft, topRight, bottomLeft, bottomRight ); }

const mat4& getProjectionMatrix() const override;
const mat4& getViewMatrix() const override;
const mat4& getInverseViewMatrix() const override;
Expand All @@ -307,7 +307,7 @@ class CI_API CameraStereo : public CameraPersp {
void calcProjection() const override;

void getShiftedClipCoordinates( float clipDist, float ratio, vec3* topLeft, vec3* topRight, vec3* bottomLeft, vec3* bottomRight ) const;

private:
bool mIsStereo;
bool mIsLeft;
Expand Down
12 changes: 6 additions & 6 deletions include/cinder/CameraUi.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CI_API CameraUi {
CameraUi( CameraPersp *camera, const app::WindowRef &window = nullptr, int signalPriority = 0 );
CameraUi( const CameraUi &rhs );
~CameraUi();

CameraUi& operator=( const CameraUi &rhs );

//! Connects to mouseDown, mouseDrag, mouseWheel and resize signals of \a window, with optional priority \a signalPriority
Expand All @@ -55,7 +55,7 @@ class CI_API CameraUi {

//! Signal emitted whenever the user modifies the camera
signals::Signal<void()>& getSignalCameraChange();

void mouseDown( app::MouseEvent &event );
void mouseUp( app::MouseEvent &event );
void mouseWheel( app::MouseEvent &event );
Expand All @@ -78,24 +78,24 @@ class CI_API CameraUi {
void setMouseWheelMultiplier( float multiplier ) { mMouseWheelMultiplier = multiplier; }
//! Returns the multiplier on mouse wheel zooming. Default is \c 1.2.
float getMouseWheelMultiplier() const { return mMouseWheelMultiplier; }

//! Sets the minimum allowable pivot distance. Default is \c 1.0. If the user dollies closer than \a minPivotDistance the pivotDistance remains \a minPivotDistance.
void setMinimumPivotDistance( float minPivotDistance ) { mMinimumPivotDistance = minPivotDistance; }
//! Returns the minimum allowable pivot distance. Default is \c 1.0.
float getMinimumPivotDistance() const { return mMinimumPivotDistance; }

private:
enum { ACTION_NONE, ACTION_ZOOM, ACTION_PAN, ACTION_TUMBLE };

ivec2 getWindowSize() const;

vec2 mInitialMousePos;
CameraPersp mInitialCam;
CameraPersp *mCamera;
float mInitialPivotDistance;
float mMouseWheelMultiplier, mMinimumPivotDistance;
int mLastAction;

ivec2 mWindowSize; // used when mWindow is null
app::WindowRef mWindow;
bool mEnabled;
Expand Down
10 changes: 5 additions & 5 deletions include/cinder/Capture.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#if defined( CINDER_ANDROID )
#include "cinder/gl/Texture.h"
#endif
#endif

#if defined( CINDER_MAC ) || defined( CINDER_COCOA_TOUCH_DEVICE )
#if defined( __OBJC__ )
Expand All @@ -49,7 +49,7 @@
#elif defined( CINDER_ANDROID )
namespace cinder {
class CaptureImplJni;
}
}
#endif

#include <map>
Expand Down Expand Up @@ -88,7 +88,7 @@ class CI_API Capture {
float getAspectRatio() const { return getWidth() / (float)getHeight(); }
//! Returns the bounding rectangle of the capture imagee, which is Area( 0, 0, width, height )
Area getBounds() const { return Area( 0, 0, getWidth(), getHeight() ); }

//! Returns a SurfaceRef representing the current captured frame.
Surface8uRef getSurface() const;

Expand Down Expand Up @@ -136,7 +136,7 @@ class CI_API Capture {
Device() {}
std::string mName;
};

protected:
Capture( int32_t width, int32_t height, const DeviceRef device );

Expand All @@ -147,7 +147,7 @@ class CI_API Capture {
#elif defined( CINDER_MSW )
CaptureImplDirectShow *mImpl;
#elif defined( CINDER_ANDROID )
CaptureImplJni *mImpl;
CaptureImplJni *mImpl;
#endif
};

Expand Down
4 changes: 2 additions & 2 deletions include/cinder/CaptureImplAvFoundation.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CaptureImplAvFoundationDevice : public Capture::Device {
public:
CaptureImplAvFoundationDevice( AVCaptureDevice *device );
~CaptureImplAvFoundationDevice();

bool checkAvailable() const;
bool isConnected() const;
Capture::DeviceIdentifier getUniqueId() const { return mUniqueId; }
Expand All @@ -52,7 +52,7 @@ class CaptureImplAvFoundationDevice : public Capture::Device {
CVPixelBufferRef mWorkingPixelBuffer;
cinder::Surface8uRef mCurrentFrame;
NSString *mDeviceUniqueId;

cinder::Capture::DeviceRef mDevice;
bool mHasNewFrame;
bool mIsCapturing;
Expand Down
2 changes: 1 addition & 1 deletion include/cinder/CaptureImplCocoaDummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CaptureImplCocoaDummyDevice : public Capture::Device {
{
mName = name;
}

bool checkAvailable() const { return true; }
bool isConnected() const { return true; }
Capture::DeviceIdentifier getUniqueId() const { return mUniqueId; }
Expand Down
4 changes: 2 additions & 2 deletions include/cinder/CaptureImplJni.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class CaptureImplJni {
bool isConnected() const;
Capture::DeviceIdentifier getUniqueId() const { return mUniqueId; }
bool isFrontFacing() const { return mFrontFacing; }
ci::android::hardware::Camera* getNative() const { return mNativeDevice; }
ci::android::hardware::Camera* getNative() const { return mNativeDevice; }

const std::vector<ivec2>& getSupportedResolutions() const { return mSupportedResolutions; }

Expand All @@ -95,7 +95,7 @@ class CaptureImplJni {
mutable gl::Texture2dRef mCurrentTexture;

static bool sDevicesEnumerated;
static std::vector<Capture::DeviceRef> sDevices;
static std::vector<Capture::DeviceRef> sDevices;
};

} // namespace cinder
Loading