/**
	 * @brief Remove a Vertex.
	 */
	void removeVertex( const vertex_descriptor& vd )
	{
		// clear_vertex is not called by boost graph itself.
		// It may result in an undefined behaviour if not called before.
		clearVertex( vd );
		boost::remove_vertex( vd, _graph ); // finally remove the vertex from the boost graph
		rebuildVertexDescriptorMap();
	}
bool surfaceShader::compileVertex()
    {
    jAssert( _vertex != "" );
    jAssert( _vertNum == 0 );
    clearVertex();
    string error;

    _vertNum = glCreateShader( GL_VERTEX_SHADER );
    if( !tools::compile( _vertNum, _vertex, error ) )
        {
        _errors.push_back( error );
        return false;
        }
    return true;
    }
MainWindow::MainWindow(QWidget *parent)
	: QMainWindow(parent)
	, m_update_pending(false), m_animating(false)
	, m_fgColor(255, 255, 255), m_bgColor(0, 0, 0)
{
	m_oglviewer = new OGLViewer;

	ui.setupUi(this);
	ui.ogl_layout->addWidget(m_oglviewer);
	//setWindowTitle(tr("OpenGL Qt Template"));

	m_oglviewer->setFocusPolicy(Qt::StrongFocus);
	connect(ui.clear_button, SIGNAL(clicked()), m_oglviewer, SLOT(clearVertex()));
	connect(ui.curve_type, SIGNAL(currentIndexChanged(int)), m_oglviewer, SLOT(changeCurveType(int)));
	connect(ui.degree_val, SIGNAL(valueChanged(int)), m_oglviewer, SLOT(setDegree(int)));
	connect(ui.seg_val, SIGNAL(valueChanged(int)), m_oglviewer, SLOT(setSegment(int)));

	connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(readPoints()));
	connect(ui.actionSave, SIGNAL(triggered()), this, SLOT(savePoints()));
	connect(ui.actionExport, SIGNAL(triggered()), this, SLOT(exportSVG()));

	signalMapper = new QSignalMapper(this);
	connect(signalMapper, SIGNAL(mapped(int)), m_oglviewer, SLOT(changeOperation(int)));
	signalMapper->setMapping(ui.actionInsert, 0);
	signalMapper->setMapping(ui.actionMove, 1);
	connect(ui.actionInsert, SIGNAL(triggered()), signalMapper, SLOT(map()));
	connect(ui.actionMove, SIGNAL(triggered()), signalMapper, SLOT(map()));

	connect(ui.intersection_button, SIGNAL(clicked()), m_oglviewer, SLOT(findIntersections()));

	connect(ui.disp_ctrl_pts, SIGNAL(toggled(bool)), m_oglviewer, SLOT(setDispCtrlPts(bool)));
	connect(ui.disp_curves, SIGNAL(toggled(bool)), m_oglviewer, SLOT(setDispCurves(bool)));
	connect(ui.disp_intersections, SIGNAL(toggled(bool)), m_oglviewer, SLOT(setDispIntersections(bool)));

	ui.foreground_color->setStyleSheet("QPushButton { background-color : #FFFFFF;}");
	ui.background_color->setStyleSheet("QPushButton { background-color : #000000;}");
	connect(ui.foreground_color, SIGNAL(clicked()), this, SLOT(pickColor()));
	
}
Exemple #4
0
// 頂点情報の更新
void SceneE::updateVertex(){
    
    // 頂点情報の初期化
    clearVertex();
    
    triangulation.reset();
    
    step = 1 + ofNoise(_noiseSeed) * 50;
    
    float r1 = 200;
    for(int i = 0; i < 360*2; i += step){
        float rn1 = r1 + ofNoise(_noiseSeed) * 25 + pMagnitude[20]*3;
        float radi = ofDegToRad(i);
        float x = rn1 * cos(radi);
        float y = rn1 * sin(radi);
        myVerts1[i/step] = ofVec3f(x, y, 0);
        _noiseSeed += 0.01;
        
        if(ofRandom(1) > 0.6){
            triangulation.addPoint(ofPoint(x, y, 0));
        }
    }
    
    step = 1 + ofNoise(_noiseSeed) * 50;
    
    float r2 = 150;
    for(int i = 0; i < 360*2; i += step){
        float rn2 = r2 + ofNoise(_noiseSeed) * 10  + pMagnitude[30]*3;
        float radi = ofDegToRad(i);
        float x = rn2 * cos(radi);
        float y = rn2 * sin(radi);
        myVerts2[i/step] = ofVec3f(x, y, 0);
        _noiseSeed += 0.01;
        
        if(ofRandom(1) > 0.7){
            triangulation.addPoint(ofPoint(x, y, 0));
        }
    }
    
    step = 1 + ofNoise(_noiseSeed) * 50;
    
    float r3 = 100 + pMagnitude[16];
    for(int i = 0; i < 360*2; i += step){
        float rn3 = r3 + ofNoise(_noiseSeed) * 50  + pMagnitude[40]*3;
        float radi = ofDegToRad(i);
        float x = rn3 * cos(radi);
        float y = rn3 * sin(radi);
        myVerts3[i/step] = ofVec3f(x, y, 0);
        _noiseSeed += 0.01;
        
        if(ofRandom(1) > 0.8){
            triangulation.addPoint(ofPoint(x, y, 0));
        }
    }
    
    step = 1 + ofNoise(_noiseSeed) * 50;
    
    float r4 = 50;
    for(int i = 0; i < 360*2; i += step){
        float rn4 = r4 + ofNoise(_noiseSeed) * 20 + pMagnitude[60]*3;
        float radi = ofDegToRad(i);
        float x = rn4 * cos(radi);
        float y = rn4 * sin(radi);
        myVerts4[i/step] = ofVec3f(x, y, 0);
        _noiseSeed += 0.01;
        
        if(ofRandom(1) > 0.4){
            triangulation.addPoint(ofPoint(x, y, 0));
        }
    }
    
    // 頂点情報の更新
    myVbo1.updateVertexData(myVerts1, NUM_PERTICLES);
    myVbo2.updateVertexData(myVerts2, NUM_PERTICLES);
    myVbo3.updateVertexData(myVerts3, NUM_PERTICLES);
    myVbo4.updateVertexData(myVerts4, NUM_PERTICLES);
}
void surfaceShader::clearShader()
    {
    clearFragment();
    clearVertex();
    clearProgram();
    }