BoundingBoxDoorVisual::BoundingBoxDoorVisual ( const DoorVisualDefaultArgs& args, double height, double width, double scalingFactor ) : DoorVisual(args) { m_width = width; m_height = height; m_scalingFactor = scalingFactor; m_lineWidth = 0.03; m_wireframe = NULL; m_baseframe = NULL; m_thickness = 0.1; generateWireframe(); }
//-------------------------------------------------------------- void testApp::setup(){ g_element_buffer_data = NULL; g_vertex_buffer_data = NULL; move_camera = false; x_res = 100, z_res = 100; // number of *vertices* on x & z axis last_time = 0; // enable alpha blending glEnable( GL_BLEND ); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); // Draw in wireframe mode glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); ofSetLogLevel(OF_LOG_VERBOSE); ofBackground(0,0,0); // load shaders? // Initialize projection and model view matrices update_p_matrix(proj_mat, screen_width, screen_height); update_mv_matrix(mv_mat, 0); glMatrixMode(GL_PROJECTION); glLoadMatrixf(proj_mat); glMatrixMode(GL_MODELVIEW); glLoadMatrixf(mv_mat); // init GL buffers glGenBuffers(1, &vertexBuffer); glGenBuffers(1, &elementBuffer); // initialize shape shape = SHAPE_PLANE; generateWireframe(); bufferGrid(); // Easycam allows mouse interaction use_easycam=false; easycam.setNearClip( 0.0625); easycam.setDistance(1.0); }
//-------------------------------------------------------------- void testApp::keyPressed(int key){ if (key == (int)'q') { x_res /= 2; generateWireframe(); bufferGrid(); } else if (key == (int)'w') { x_res *= 2; generateWireframe(); bufferGrid(); } else if (key == (int)'a') { z_res /= 2; generateWireframe(); bufferGrid(); } else if (key == (int)'s') { z_res *= 2; generateWireframe(); bufferGrid(); } else if (key == (int)'c') { move_camera = !move_camera; } else if (key == (int)'1') { shape = SHAPE_PLANE; generateWireframe(); bufferGrid(); } else if (key == (int)'2') { shape = SHAPE_SPHERE; generateWireframe(); bufferGrid(); } else if (key == (int)'3') { shape = SHAPE_CYLINDER_X; generateWireframe(); bufferGrid(); } else if (key == (int)'4') { shape = SHAPE_CYLINDER_Y; generateWireframe(); bufferGrid(); } else if (key == (int)'o') { easycam.setDistance(easycam.getDistance()/2); } else if (key == (int)'p') { easycam.setDistance(easycam.getDistance()*2); } else if (key == (int)'e') { use_easycam = !use_easycam; } }