Test of draggable scope area + fixes

- Will be able to drag back/forth to cycle scope/spectrum/plot
- Fix for two crashes
This commit is contained in:
Charles J. Cliffe
2015-08-19 23:22:46 -04:00
parent 03c8619c5a
commit 7a0f523eaf
8 changed files with 161 additions and 18 deletions
+8
View File
@@ -8,6 +8,9 @@ using namespace CubicVR;
GLPanel::GLPanel() : fillType(GLPANEL_FILL_SOLID), contentsVisible(true), transform(mat4::identity()) {
pos[0] = 0.0f;
pos[1] = 0.0f;
rot[0] = 0.0f;
rot[1] = 0.0f;
rot[2] = 0.0f;
size[0] = 1.0f;
size[1] = 1.0f;
fill[0] = RGBA4f(0.5,0.5,0.5);
@@ -241,6 +244,11 @@ void GLPanel::drawPanelContents() {
void GLPanel::calcTransform(mat4 transform_in) {
// compute local transform
localTransform = mat4::translate(pos[0], pos[1], 0) * mat4::scale(size[0], size[1], 1);
if (rot[0] || rot[1] || rot[2]) {
localTransform *= mat4::rotate(rot[0], rot[1], rot[2]);
}
// compute global transform
transform = transform_in * localTransform;
+1
View File
@@ -36,6 +36,7 @@ public:
typedef enum GLPanelFillType { GLPANEL_FILL_NONE, GLPANEL_FILL_SOLID, GLPANEL_FILL_GRAD_X, GLPANEL_FILL_GRAD_Y, GLPANEL_FILL_GRAD_BAR_X, GLPANEL_FILL_GRAD_BAR_Y } GLPanelFillType;
typedef enum GLPanelCoordinateSystem { GLPANEL_Y_DOWN_ZERO_ONE, GLPANEL_Y_UP_ZERO_ONE, GLPANEL_Y_UP, GLPANEL_Y_DOWN } GLPanelCoordinateSystem;
float pos[2];
float rot[3];
float size[2];
float view[2];
GLPanelFillType fillType;