コード例 #1
0
/*
 * Treat if mouse/pen is under motion (drawing on screen for example)
 * @param args current arg (time/renderScale/pixelScale....
 * @return if the event has been treated (y or n)
 */
bool ColorSpaceKeyerOverlay::penMotion( const OFX::PenArgs& args )
{
	if(_isPenDown)														//if mouse is already selected
	{
		_end.x = args.penPosition.x;									//capture mouse current position x
		_end.y = args.penPosition.y;									//capture mouse current position y
		
		int deltaX = _end.x - _origin.x;								//compute delta for rotation on Y axis (horizontal)
		int deltaY = _end.y - _origin.y;								//compute delta for rotation on X axis (vertical)
		if(_isCtrlKeyDown)												//rotation center is current color selection average
		{
			_rotateXForm = (deltaX/args.pixelScale.x)/kRotationSpeed;	//add delta to geodesic center rotation (X axis)
			_rotateYForm = (deltaY/args.pixelScale.y)/kRotationSpeed;	//add delta to geodesic center rotation (Y axis)
			
			//update model-View matrix
			Ofx3DPointD rotationCenter = getData()._geodesicFormColor._center;	//get current rotation center
			updateModelView(rotationCenter);								//update model-view
		}
		else															//rotation center is reference center (0.5,0.5,0.5 in cube reference)
		{
			_rotateX = (deltaX/args.pixelScale.x)/kRotationSpeed;		//add delta to cube rotation (X axis)
			_rotateY = (deltaY/args.pixelScale.y)/kRotationSpeed;		//add delta to cube rotation (Y axis)
			
			//update model-View matrix
			Ofx3DPointD rotationCenter;									//create rotation center
			rotationCenter.x = 0.5;										//set rotation center X value 0 by default
			rotationCenter.y = 0.5;										//set rotation center Y value
			rotationCenter.z = 0.5;										//set rotation center Z value
			updateModelView(rotationCenter);							//update model-view
		}
		_origin.x = args.penPosition.x;									//change origin X (prepare next penMotion)
		_origin.y = args.penPosition.y;									//change origin Y (prepare next penMotion)
		
		return true;													//event has been captured
	}
	return false;
}
コード例 #2
0
ファイル: scene.cpp プロジェクト: bcrusco/CUDA-Rasterizer
Scene::Scene() {
	// Create with some default values
	this->nearPlane = 0.1f;
	this->farPlane = 100.0f;
	camera.fieldOfView = 45.0f;
	camera.position = glm::vec3(0.0f, 0.0f, 3.0f);
	camera.lookAt = glm::vec3(0.0f);
	camera.right = glm::vec3(1.0f, 0.0f, 0.0f);

	light.position = 1000.0f * camera.position;
	light.color = glm::vec3(1.0f);

	culling = false;
	scissor = false;
	pointRasterization = false;
	lineRasterization = false;

	mouseState.initialPositionsSet = false;

	// Then have to calculate the model view matrix
	updateModelView();
}
コード例 #3
0
MainWindow::MainWindow(RInside &r, QWidget *parent) :
    QMainWindow(parent),
    m_r(r),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    dataModel = new DataModel(r);
    dlg = NULL;
    localdlg = NULL;


    //relationView = new ModelRelationView(this,ui->modelRelationContainer);
    //mrvLayout = new QHBoxLayout(ui->modelRelationContainer);
    //ui->modelRelationContainer->layout()->setMargin(0);
    //mrvLayout->addWidget(this->relationView);


    modelView = new ModelView(this,ui->modelContainer);
    containerLayout = new QHBoxLayout(ui->modelContainer);
    ui->modelContainer->layout()->setMargin(0);
    containerLayout->addWidget(this->modelView);

    /*scrollArea = new QScrollArea();
    containerLayout->addWidget(scrollArea);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    scrollArea->setWidgetResizable(true);
    scrollArea->setWidget(modelView);
    scrollArea->show();*/

    ui->listView_selected->setMouseTracking(true);

    //localView = new LocalModelView(this,ui->LocalModelContainer);
    //localLayout = new QHBoxLayout(ui->LocalModelContainer);
    //ui->LocalModelContainer->layout()->setMargin(0);
    //localLayout->addWidget(localView);

    timeLineView = new TimeHeatmapView(this,ui->modelMetric);
    metricLayout = new QHBoxLayout(ui->modelMetric);
    ui->modelMetric->layout()->setMargin(0);
    metricLayout->addWidget(timeLineView);

    concesusView = new ConsensusView(this,ui->rightWidget);
    concesusLayout = new QHBoxLayout(ui->rightWidget);
    ui->rightWidget->layout()->setMargin(0);
    concesusLayout->addWidget(concesusView);

    // double link interaction between model view and model eval view;
    /*connect(metricView,SIGNAL(hopoverGlyph(int)),
            modelView,SLOT(highlightProfile(int)));
    connect(modelView,SIGNAL(modelProfileHopover(int)),
            metricView,SLOT(highlightGlyph(int)));
*/

    connect(this, SIGNAL(timeLineChanged()),
            dataModel,SLOT(normalize()));

    //connect(this, SIGNAL(timeLineChanged()),
            //timeLineView, SLOT(updateTimeHeatmapView()));

    connect(dataModel, SIGNAL(dataSelectionChanged()),
            timeLineView, SLOT(updateTimeHeatmapView()));

    connect(ui->binSlider,SIGNAL(valueChanged(int)),
            timeLineView,SLOT(updateBins(int)));

    connect(ui->intvlSlider,SIGNAL(valueChanged(int)),
            timeLineView,SLOT(updateIntvls(int)));

    connect(ui->btnAddModel, SIGNAL(clicked()),
            dataModel,SLOT(updateModelProfile()));

    connect(dataModel, SIGNAL(timelinemodelChanged()),
                modelView, SLOT(updateModelView()));

    connect(this->modelView, SIGNAL(timelineSelectionChanged()),
            this->timeLineView,SLOT(updateSelection()));

    connect(this->timeLineView,SIGNAL(colorRangeChanged(int)),
            this, SLOT(updateColorSliderRange(int)));

    connect(this->ui->colorSlider,SIGNAL(valueChanged(int)),
            this->timeLineView,SLOT(updateColors(int)));

    connect(this->ui->binModSlidr,SIGNAL(valueChanged(int)),
            modelView,SLOT(updateBinSize(int)));

    connect(this->ui->intvlModSlider,SIGNAL(valueChanged(int)),
            dataModel,SLOT(updateWinNum(int)));

    connect(this->ui->colorModSlider,SIGNAL(valueChanged(int)),
            modelView,SLOT(updateColors(int)));

    connect(modelView,SIGNAL(colorRangeChanged(int)),
            this,SLOT(updateModelColorSliderRange(int)));

    connect(this->ui->binModSlidr,SIGNAL(valueChanged(int)),
            this->ui->lblModBins,SLOT(setNum(int)));

    connect(this->ui->intvlModSlider,SIGNAL(valueChanged(int)),
            this->ui->lblModIntvls,SLOT(setNum(int)));

    connect(this->ui->colorModSlider,SIGNAL(valueChanged(int)),
            this->ui->lblModColorRange,SLOT(setNum(int)));

    connect(this->ui->cBoxConf,SIGNAL(toggled(bool)),
            modelView,SLOT(updateBoxPlot(bool)));

    connect(this->modelView,SIGNAL(clusterAdded()),
            this->concesusView,SLOT(updateGlyphs()));

    connect(this,SIGNAL(simThresChanged(double)),
            this->concesusView,SLOT(updateThreshold(double)));

    connect(this->concesusView,SIGNAL(indexAggregated(QSet<int>)),
            this->modelView,SLOT());
    connect(this->concesusView,SIGNAL(),
            this->timeLineView,SLOT());
}