view UI code/6Dbox.h @ 27:27cdf475aa4b

more fiddling
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 29 Oct 2014 15:38:38 +0000
parents 8d7ae43b2edd
children 953db6518738
line wrap: on
line source
//
//  6Dbox.h
//  riftathon
//
//  Created by Robert Tubb on 27/10/2014.
//
//

#ifndef __riftathon___Dbox__
#define __riftathon___Dbox__
#include "3DboxGL.h"
#include "ofxVectormath.h"
#include <iostream>

class Leap6DBox : public Leap3DBoxGL {
    
public:
    Leap6DBox(float ax,
                float ay,
                float awidth,
                float aheight,
                float azx,
                float azy,
                const UIProps& props);

    
    void drawIndicatorBlob(float x, float y, float z, ofColor c, bool isHint = false);
    void draw6DOFIndicatorBlob(float x, float y, float z, ofColor c, float r, float p, float yaw,ofImage* texImg);
    void setTexture(ofImage* img);
    void setValue(int index, int value);
    void setValueAndScale(int index, int value);
    
    void setHintValue(int which, int val);
    void setHintTexture(ofImage* img);
    void update();
    void animateHintToNewValues(float x, float y, float z, float r, float p, float yaw);
    void setHintValues(vector<int> vals);
    void setValues(vector<int> vals);
    
    void draw();
    void showValueIndicator(bool showing){
        indicatorShowing = showing;
    };
  
private:

    
    void drawIndicator();
    void draw3DCrossHairs(float x , float y, float z, ofColor c, bool isHint = false);
    
    void setUpHandMesh();
    void setUpThumb(ofPoint baseTR, ofPoint baseBR);
    void makeTexFace(ofPoint LT, ofPoint RT, ofPoint  RB, ofPoint LB);
    float rollVal, pitchVal, yawVal;
    ofMatrix4x4 getRotationQuat(float roll, float pitch, float yaw);
    
    ofMesh handMesh;
    ofImage* texImg;
    ofImage defaultImage;
    ofImage hintImage;
    ofImage* hintImageRef;
    ofMesh guideHandMesh;
    
    float hw, hh, hl, scale;
    float hintRoll, hintPitch, hintYaw;
    float minAngVal, maxAngVal;
    bool indicatorShowing;
};


#endif /* defined(__riftathon___Dbox__) */