comparison UI code/3DboxGL.h @ 26:8d7ae43b2edd

BLOODY FIIDDLY MOFO THIS ONE
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 28 Oct 2014 19:15:28 +0000
parents 8eb530e0601b
children 75202498bee9
comparison
equal deleted inserted replaced
25:8eb530e0601b 26:8d7ae43b2edd
65 65
66 void drawIndicator(){ 66 void drawIndicator(){
67 67
68 if (hintShowing && (hintZ > zVal)){ 68 if (hintShowing && (hintZ > zVal)){
69 hintColor = calculateHintColor(); 69 hintColor = calculateHintColor();
70 draw3DCrossHairs(hintX, hintY, hintZ,hintColor); 70 draw3DCrossHairs(hintX, hintY, hintZ,hintColor, true);
71 71
72 } 72 }
73 73
74 // draw indicator 74 // draw indicator
75 draw3DCrossHairs(xVal,yVal,zVal, indicatorColor); 75 draw3DCrossHairs(xVal,yVal,zVal, indicatorColor);
77 // 77 //
78 78
79 79
80 if (hintShowing && hintZ <= zVal){ 80 if (hintShowing && hintZ <= zVal){
81 hintColor = calculateHintColor(); 81 hintColor = calculateHintColor();
82 draw3DCrossHairs(hintX, hintY, hintZ,hintColor); 82 draw3DCrossHairs(hintX, hintY, hintZ,hintColor, true);
83 83
84 } 84 }
85 } 85 }
86 void draw3DCrossHairs(float x , float y, float z, ofColor c){ 86 void draw3DCrossHairs(float x , float y, float z, ofColor c, bool isHint = false){
87 87
88 float ix = x*width - width/2; 88 float ix = x*width - width/2;
89 float iy = (1-y)*width - width/2; 89 float iy = (1-y)*width - width/2;
90 float iz = (1-z)*width - width/2; 90 float iz = (1-z)*width - width/2;
91 91
99 ofLine(ix,iy,iz,ix,bot,iz); 99 ofLine(ix,iy,iz,ix,bot,iz);
100 // line to left 100 // line to left
101 ofLine(ix,iy,iz,left,iy,iz); 101 ofLine(ix,iy,iz,left,iy,iz);
102 102
103 //blob 103 //blob
104 drawIndicatorBlob(ix,iy,iz,c); 104 drawIndicatorBlob(ix,iy,iz,c, isHint);
105 // line to front (a bit wierde?) 105 // line to front (a bit wierde?)
106 ofLine(ix,iy,iz,ix,iy,front); 106 ofLine(ix,iy,iz,ix,iy,front);
107 107
108 108
109 109
110 } 110 }
111 virtual void drawIndicatorBlob( float x, float y, float z, ofColor c){ 111 virtual void drawIndicatorBlob( float x, float y, float z, ofColor c, bool isHint = false){
112 ofSetColor(c); 112 ofSetColor(c);
113 ofDrawIcoSphere(x,y,z,12); 113 ofDrawIcoSphere(x,y,z,12);
114 } 114 }
115 ofColor calculateHintColor(){ 115 ofColor calculateHintColor(){
116 116