当前位置: 首页>>代码示例>>C++>>正文


C++ VRCamera::setEye方法代码示例

本文整理汇总了C++中VRCamera::setEye方法的典型用法代码示例。如果您正苦于以下问题:C++ VRCamera::setEye方法的具体用法?C++ VRCamera::setEye怎么用?C++ VRCamera::setEye使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VRCamera的用法示例。


在下文中一共展示了VRCamera::setEye方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawGLScene

void drawGLScene()
{
    if (stereo)
    {   glDrawBuffer(GL_BACK);

        // Draw left eye view
        glDrawBuffer(GL_BACK_LEFT);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(0.0,0.0,0.0,1.0);
        cam.setEye(eyeRight);
        drawTrial();

        // Draw right eye view
        glDrawBuffer(GL_BACK_RIGHT);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(0.0,0.0,0.0,1.0);
        cam.setEye(eyeLeft);
        drawTrial();

        glutSwapBuffers();
    }
    else	// MONOCULAR
    {   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(0.0,0.0,0.0,1.0);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        if ( (int) factors["Anchored"] != 0 )
            cam.setEye(Vector3d(fixationPoint.x(),fixationPoint.y(),0));
        else
            cam.setEye(Vector3d::Zero());
        drawTrial();
        glutSwapBuffers();
    }
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: drawStimulus

void drawStimulus()
{
	if( fingerCalibrationDone==3 && index.z() < (startingPoint - 40.0) )
	{
		fingersAtStart=false;
		letStimTimer=true;
		if(stimTimer.getElapsedTimeInMilliSec() < str2num<int>(parameters.find("TestStimulusDuration")))
		{
			if ( isStimulusDrawn )
			{
			// Central rod on focal plane
				glPushMatrix();
				glLoadIdentity();
				glTranslated(0,0,factors["AbsDepth"]+(estdepth/2));
				stimDrawer[0].draw();
				glPopMatrix();
		
				// Left rod shifted 2 cm behind the focal plane
				glPushMatrix();
				glLoadIdentity();
				glTranslated(-estsize/2,0,factors["AbsDepth"]-(estdepth/2));
				stimDrawer[1].draw();
				glPopMatrix();

				// Right rod shifted 2 cm behind the focal plane
				glPushMatrix();
				glLoadIdentity();
				glTranslated(estsize/2,0,factors["AbsDepth"]-(estdepth/2));
				stimDrawer[2].draw();
				glPopMatrix();
			} else  {
				glDrawBuffer(GL_BACK);
				// Draw left eye view
				glDrawBuffer(GL_BACK_LEFT);
				glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
				glClearColor(0.0,0.0,0.0,1.0);
				cam.setEye(eyeLeft);

				// Draw right eye view
			    glDrawBuffer(GL_BACK_RIGHT);
				glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
				glClearColor(0.0,0.0,0.0,1.0);
				cam.setEye(eyeRight);
				glutSwapBuffers();
			}
		} else {
			endTrial=true;
			letStimTimer=false;
			isStimulusDrawn=false;
		}
	} else {
		fingersAtStart=true;
	}
}
开发者ID:,项目名称:,代码行数:54,代码来源:

示例3: drawGLScene

// X CARLO: In questa funzione mettere solamente chiamate a funzioni e non inserire codice libero!!!
// Preferibilmente deve restare cosi e devi solo lavorare sulla drawTrial altrimenti il codice diventa un casino
// Se mai volessi simulare che il centro di proiezione si muove rispetto alla vera coordinate dell'occhio 
// devi modificare cam.setEye(...)
void drawGLScene()
{
    if (stereo)
    {   
		if(fingerCalibrationDone==3 && !endTrial)
		{
			
			if(timer.getElapsedTimeInMilliSec() < 1500)
			{
				if(index.z() > (factors["AbsDepth"]+2.0) )
					transportView();
				else 
					pointingView();
			} else
			{
				beepOk(1);
				endTrial=true;
			}

		} else
			drawBlack();
    }

    else
    {   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(0.0,0.0,0.0,1.0);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        cam.setEye(eyeRight);
        drawTrial();
		drawInfo();
        glutSwapBuffers();
    }
}
开发者ID:guendas,项目名称:cncsvision,代码行数:38,代码来源:ExpHugo2.0.cpp

示例4: drawTrial

void drawTrial()
{   switch ( trialMode )
    {
    case FIXATIONMODE:
    {   drawFixation();

    }
    break;
    case PROBEMODE :
    {
		// this is to avoid to flickering of probe...
        initProjectionScreen(focalDistance,Affine3d::Identity());
		// updates the model view and projection matrix 
		cam.setEye(eyeRight);
        drawProbe();
    }
    break;
    case STIMULUSMODE:
    {
        responseTimer.start();
		drawRedDotsPlane();
    }
    break;
    default:
    {   drawFixation();
    }
    }
}
开发者ID:guendas,项目名称:cncsvision,代码行数:28,代码来源:expPassiveTwoPlanesRelativeSlant.cpp

示例5: pointingView

void pointingView()
{
	glDrawBuffer(GL_BACK);
	// Draw left eye view
	glDrawBuffer(GL_BACK_LEFT);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(viewPointingLeft,0.0,0.0,1.0);
	cam.setEye(eyeLeft);
	drawInfo();

	// Draw right eye view
	glDrawBuffer(GL_BACK_RIGHT);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(viewPointingRight,0.0,0.0,1.0);
	cam.setEye(eyeRight);
	drawInfo();
	glutSwapBuffers();
}
开发者ID:guendas,项目名称:cncsvision,代码行数:18,代码来源:ExpHugo2.0.cpp

示例6: drawTheVoid

void drawTheVoid()
{

			glDrawBuffer(GL_BACK);
			// Draw left eye view
			glDrawBuffer(GL_BACK_LEFT);
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
			glClearColor(0.0,0.0,0.0,1.0);
			cam.setEye(eyeLeft);

			// Draw right eye view
		    glDrawBuffer(GL_BACK_RIGHT);
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
			glClearColor(0.0,0.0,0.0,1.0);
			cam.setEye(eyeRight);
			glutSwapBuffers();

}
开发者ID:guendas,项目名称:cncsvision,代码行数:18,代码来源:ExpOct2012grasp3.0.cpp

示例7: drawGLScene

void drawGLScene()
{
    if (stereo)
    {
        // Draw the right eye view on the left buffer
        glDrawBuffer(GL_BACK);
        glDrawBuffer(GL_BACK_LEFT);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(0.0,0.0,0.0,1.0);
        cam.setEye(eyeRight);
        drawInfo();
        drawTrial();
        // Draw the left eye view on the right buffer
        glDrawBuffer(GL_BACK_RIGHT);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(0.0,0.0,0.0,1.0);
        //cam.setEye(eyeLeft); così è senza disparità
		cam.setEye(eyeRight);
        if ( headCalibrationDone <3)
        {
            drawInfo();
            drawTrial();
        }
        drawInfo();
        // Doesn't draw the right eye view if is not binocular
        if ( (int)(factors.at("Binocular"))==1 && (headCalibrationDone==3) )
        {
            drawTrial();
        }
        glutSwapBuffers();
    }
    else
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(0.0,0.0,0.0,1.0);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        cam.setEye(eyeRight);
        drawInfo();
        drawTrial();
        glutSwapBuffers();
    }
}
开发者ID:guendas,项目名称:cncsvision,代码行数:43,代码来源:expDprimeTMSoverMT.cpp

示例8: drawGLScene

void drawGLScene()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glClearColor(0.0,0.0,0.0,1.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    cam.setEye(Vector3d(interoculardistance/2,0,0));
    drawTrial();
    glutSwapBuffers();
}
开发者ID:guendas,项目名称:cncsvision,代码行数:10,代码来源:expPointsStrip_base.cpp

示例9: drawGLScene

void drawGLScene()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(0.0, 0.0, 0.0, 1.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	cam.setEye(eyeRight);
	drawInfo();
	glutSwapBuffers();
}
开发者ID:guendas,项目名称:cncsvision,代码行数:10,代码来源:summer14-platoGraspRovereto.cpp

示例10: drawScene

void drawScene()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    cam.setEye(Vector3d(0.0,0.0,0.0));
    drawThings();
    glutSwapBuffers();
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例11: drawGLScene

void drawGLScene()
{
    if (stereo)
    {
        glDrawBuffer(GL_BACK);
        // Draw left eye view
        glDrawBuffer(GL_BACK_LEFT);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(1.0,1.0,1.0,1.0);
        cam.setEye(eyeRight);

        // Draw right eye view
        glDrawBuffer(GL_BACK_RIGHT);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(1.0,1.0,1.0,1.0);
        cam.setEye(eyeLeft);
        glutSwapBuffers();
    }
    else
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glClearColor(1.0,1.0,1.0,1.0);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        cam.setEye(eyeRight);
        glLineWidth(3);
        glPushMatrix();
        glLoadIdentity();
        // Here we draw the central cross, must be 150 millimeters on horizontal and vertical in order to have a correct monitor calibration
        glColor3fv(glBlack);
        glBegin(GL_LINES);
        glVertex3d(-crossSize/2,0,baseFocalDistance);
        glVertex3d(crossSize/2,0,baseFocalDistance);

        glVertex3d(0,crossSize/2,baseFocalDistance);
        glVertex3d(0,-crossSize/2,baseFocalDistance);
        glEnd();
        glPopMatrix();
        glutSwapBuffers();
    }
}
开发者ID:guendas,项目名称:cncsvision,代码行数:41,代码来源:pureCalibrationTS.cpp

示例12: getPassiveMatrix

Affine3d getPassiveMatrix()
{
    Screen screenPassive;
    screenPassive.setWidthHeight(SCREEN_WIDE_SIZE, SCREEN_WIDE_SIZE*SCREEN_HEIGHT/SCREEN_WIDTH);
    screenPassive.setOffset(alignmentX,alignmentY);
    screenPassive.setFocalDistance(0);
    screenPassive.transform(headEyeCoords.getRigidStart().getFullTransformation()*Translation3d(Vector3d(0,0,focalDistance)));
    VRCamera camPassive;
    camPassive.init(screenPassive);
    camPassive.setDrySimulation(true);
    camPassive.setEye(eyeRight);
    return ( camPassive.getModelViewMatrix()*objectActiveTransformation );
}
开发者ID:guendas,项目名称:cncsvision,代码行数:13,代码来源:expDprimeTMSoverMT.cpp

示例13: drawGLScene

void drawGLScene()
{
	if (stereo)
	{   glDrawBuffer(GL_BACK);

	// Draw left eye view
	glDrawBuffer(GL_BACK_LEFT);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(0.0,0.0,0.0,1.0);

	cam.setEye(eyeRight);
	drawInfo();
	drawTrial();

	// Draw right eye view
	glDrawBuffer(GL_BACK_RIGHT);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(0.0,0.0,0.0,1.0);

	cam.setEye(eyeLeft);
	drawInfo();
	drawTrial();

	glutSwapBuffers();
	}
	else
	{   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(0.0,0.0,0.0,1.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	cam.setEye(eyeRight);
	if ( (int) factors["Rotation"] == 0 )
		cam.setEye(Vector3d(eyeRight.x()*factors["FollowingSpeed"],eyeRight.y(),eyeRight.z()));
	drawInfo();
	drawTrial();
	glutSwapBuffers();
	}
}
开发者ID:guendas,项目名称:cncsvision,代码行数:39,代码来源:expGiovanniRotationYawPassive.cpp

示例14: drawTrial

void drawTrial()
{   switch ( trialMode )
    {
    case FIXATIONMODE:
    {   drawFixation();

    }
    break;
    case PROBEMODE :
    {
        // this is to avoid to flickering of probe...
        initProjectionScreen(focalDistance,Affine3d::Identity());
        // updates the model view and projection matrix
        cam.setEye(eyeRight);
        drawProbe();
    }
    break;
    case STIMULUSMODE:
    {
        responseTimer.start();
        /*
        // x_dim= str2num<double>(parameters.find("planeXdimension")) + mathcommon::unifRand(0,100);
        num_dots= int(floor((x_dim[0]*str2num<double>(parameters.find("planeYdimension")))*(str2num<int>(parameters.find("numberdots"))/(str2num<double>(parameters.find("planeXdimension"))*str2num<double>(parameters.find("planeYdimension"))))));
        redDotsPlane[0].setNpoints(num_dots);  //XXX controllare densita di distribuzione dei punti
        redDotsPlane[0].setDimensions(x_dim[0],str2num<double>(parameters.find("planeYdimension")),0.01);
        //x_dim= str2num<double>(parameters.find("planeXdimension")) + mathcommon::unifRand(0,100);
        num_dots= int(floor((x_dim[1]*str2num<double>(parameters.find("planeYdimension")))*(str2num<int>(parameters.find("numberdots"))/(str2num<double>(parameters.find("planeXdimension"))*str2num<double>(parameters.find("planeYdimension"))))));
        redDotsPlane[1].setNpoints(num_dots);  //XXX controllare densita di distribuzione dei punti
        redDotsPlane[1].setDimensions(x_dim[1],str2num<double>(parameters.find("planeYdimension")),0.01);

        //	redDotsPlane[0].setDimensions(str2num<double>(parameters.find("planeXdimension"))+mathcommon::unifRand(0,100),str2num<double>(parameters.find("planeYdimension")),0.01);
        //   redDotsPlane[1].setDimensions(str2num<double>(parameters.find("planeXdimension"))+mathcommon::unifRand(0,100),str2num<double>(parameters.find("planeYdimension")),0.01);
        */
        drawRedDotsPlane();
        if ( str2num<int>(parameters.find("Occluder")))
            //if ((int) factors.at("Occluder")) /// if factor scommenta
            rectangle(str2num<double>(parameters.find("OccluderWidth")),str2num<double>(parameters.find("OccluderHeight")),focalDistance + str2num<double>(parameters.find("OccluderDistance"))); /// Added: Draw an occluding rectangle infront of the twsited structure

    }
    break;
    default:
    {   drawFixation();
    }
    }
}
开发者ID:,项目名称:,代码行数:45,代码来源:

示例15: update

void update(int value)
{
    // Conta i cicli di presentazione dello stimolo
    if ( (sumOutside > str2num<int>(parameters.find("StimulusCycles")) ) &&  (trialMode == STIMULUSMODE) )
    {
        sumOutside=0;
        trialMode++;
        trialMode=trialMode%4;
    }

    if (conditionInside && (sumOutside*2 > str2num<int>(parameters.find("FixationCycles"))) && (trialMode ==FIXATIONMODE )  )
    {
        sumOutside=0;
        trialMode++;
        trialMode=trialMode%4;
        stimulusDuration.start();
    }
    if ( trialMode == STIMULUSMODE )
        stimulusFrames++;
    if ( trialMode == FIXATIONMODE )
        stimulusFrames=0;

    Screen screenPassive;

    screenPassive.setWidthHeight(SCREEN_WIDE_SIZE, SCREEN_WIDE_SIZE*SCREEN_HEIGHT/SCREEN_WIDTH);
    screenPassive.setOffset(alignmentX,alignmentY);
    screenPassive.setFocalDistance(0);
    screenPassive.transform(headEyeCoords.getRigidStart().getFullTransformation()*Translation3d(center));

    camPassive.init(screenPassive);
    camPassive.setDrySimulation(true);
    camPassive.setEye(eyeRight);
    objectPassiveTransformation = ( camPassive.getModelViewMatrix()*objectActiveTransformation );
    // Coordinates picker
    markers = optotrak.getAllPoints();
    if ( isVisible(markers[1]) && isVisible(markers[2]) && isVisible(markers[3]) )
        headEyeCoords.update(markers[1],markers[2],markers[3]);
    Affine3d active = headEyeCoords.getRigidStart().getFullTransformation();

    eulerAngles.init( headEyeCoords.getRigidStart().getFullTransformation().rotation() );

    eyeLeft = headEyeCoords.getLeftEye();
    eyeRight = headEyeCoords.getRightEye();

    cyclopeanEye = (eyeLeft+eyeRight)/2.0;

    // Projection of view normal on the focal plane
    Vector3d directionOfSight = (active.rotation()*Vector3d(0,0,-1)).normalized();
    Eigen::ParametrizedLine<double,3> lineOfSightRight = Eigen::ParametrizedLine<double,3>::Through( eyeRight , eyeRight+directionOfSight );
    Eigen::ParametrizedLine<double,3> lineOfSightLeft  = Eigen::ParametrizedLine<double,3>::Through( eyeLeft, eyeLeft+directionOfSight );

    double lineOfSightRightDistanceToFocalPlane = lineOfSightRight.intersection(focalPlane);
    double lineOfSightLeftDistanceToFocalPlane = lineOfSightLeft.intersection(focalPlane);

    //double lenghtOnZ = (active*(center-eyeCalibration )+eyeRight).z();
    projPointEyeRight = lineOfSightRightDistanceToFocalPlane *(directionOfSight)+ (eyeRight);
    projPointEyeLeft= lineOfSightLeftDistanceToFocalPlane * (directionOfSight) + (eyeLeft);
    // second projection the fixation point computed with z non constant but perfectly parallel to projPointEyeRight
    lineOfSightRightDistanceToFocalPlane= (( active.rotation()*(center)) - eyeRight).norm();
    Vector3d secondProjection = lineOfSightRightDistanceToFocalPlane *(directionOfSight)+ (eyeRight);

    if ( !zOnFocalPlane )
        projPointEyeRight=secondProjection ;

    // Compute the translation to move the eye in order to avoid shear components
    Vector3d posAlongLineOfSight = (headEyeCoords.getRigidStart().getFullTransformation().rotation())*(eyeRight -eyeCalibration);

    switch ( (int)factors["Translation"] )
    {
    case -1:
    case -2:
        translationFactor.setZero();
        if ( trialMode == STIMULUSMODE )
            projPointEyeRight=center;
        break;
    case 0:
        translationFactor.setZero();
        break;
    case 1:
        translationFactor = factors["TranslationConstant"]*Vector3d(posAlongLineOfSight.z(),0,0);
        break;
    case 2:
        translationFactor = factors["TranslationConstant"]*Vector3d(0,posAlongLineOfSight.z(),0);
        break;
    }
    if ( passiveMode )
        initProjectionScreen(0,headEyeCoords.getRigidStart().getFullTransformation()*Translation3d(Vector3d(0,0,focalDistance)));
    else
        initProjectionScreen(focalDistance,Affine3d::Identity());

    checkBounds();
    /**** Save to file part ****/
    // Markers file save the used markers and time-depending experimental variable to a file
    // (Make sure that in passive experiment the list of variables has the same order)
    markersFile << trialNumber << " " << headCalibrationDone << " " << trialMode << " " ;
    markersFile <<markers[1].transpose() << " " << markers[2].transpose() << " " << markers[3].transpose() << " " << markers[17].transpose() << " " << markers[18].transpose() << " " ;

    markersFile <<	factors["Tilt"] << " " <<
                factors["Slant"] << " " <<
                factors["Translation"] << " " <<
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的VRCamera::setEye方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。