Skip to content

Commit

Permalink
Merge branch 'master' of github.com:CreativeInquiry/TeenieHarrisProject
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemcdonald committed Mar 29, 2019
2 parents 1c90b5e + a5e6e4f commit 4c76cb3
Show file tree
Hide file tree
Showing 19 changed files with 1,613 additions and 8 deletions.
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2018 Teenie Harris Project contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions apps/UMAPViewer/addons.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ofxAssimpModelLoader
ofxCv
ofxOpenCv
41 changes: 41 additions & 0 deletions apps/UMAPViewer/src/Camera2d.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#pragma once
#include "ofMain.h"

class Camera2d : public ofCamera {
private:
ofVec2f mouseStart;
ofVec2f startPosition;
float zoom;
float maxZoom = .01;
float minZoom = 1;
float zoomSpeed = 1. / 1000;
public:
void setup() {
setupPerspective(true);
ofVec3f position = getPosition();
ofCamera::setPosition(0, 0, position.z);
zoom = 1;
ofAddListener(ofEvents().mouseDragged, this, &Camera2d::mouseDragged);
ofAddListener(ofEvents().mousePressed, this, &Camera2d::mousePressed);
ofAddListener(ofEvents().mouseScrolled, this, &Camera2d::mouseScrolled);
}
void mouseDragged(ofMouseEventArgs& e) {
ofVec3f position = getPosition();
position.x = startPosition.x - (e.x - mouseStart.x) * zoom;
position.y = startPosition.y - (e.y - mouseStart.y) * zoom;
ofCamera::setPosition(position);
}
void mousePressed(ofMouseEventArgs& e) {
mouseStart = e;
startPosition = getPosition();
}
void mouseScrolled(ofMouseEventArgs& e) {
zoom += -e.scrollY * zoomSpeed;
zoom = ofClamp(zoom, maxZoom, minZoom);
setFov(60 * zoom);
}
void setPosition(float x, float y) {
ofVec3f position = getPosition();
ofCamera::setPosition(x, y, position.z);
}
};
Loading

0 comments on commit 4c76cb3

Please sign in to comment.