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


C++ TIMER::Reset方法代码示例

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


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

示例1: DemoInit

//Set up variables
bool DemoInit()
{
	if(!window.Init("Metaballs", 512, 512, 32, 24, 8, WINDOWED_SCREEN))
		return 0;											//quit if not created
	
	//set up grid
	if(!cubeGrid.CreateMemory())
		return false;
	if(!cubeGrid.Init(gridSize))
		return false;

	//set up metaballs
	for(int i=0; i<numMetaballs; i++)
		metaballs[i].Init(VECTOR3D(0.0f, 0.0f, 0.0f), 5.0f+float(i));

	//Set Up Colors
	diffuseColors[0].Set(0.345f, 0.843f, 0.902f, 1.0f);
	diffuseColors[1].Set(0.047f, 0.839f, 0.271f, 1.0f);
	diffuseColors[2].Set(0.976f, 0.213f, 0.847f, 1.0f);	

	//reset timer for start
	timer.Reset();
	
	return true;
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: StateGraphicsNext

void StateGraphicsNext(int state)
{
	if (StateGraphics == state)
	{
		return;
	}

	StateGraphicsTimer.Reset();
	StateGraphicsLast = StateGraphics;
	StateGraphics = state;

	// The visual target first appears in this state, so set graphics sync timer.
	if (StateGraphics == STATE_GO)
	{
		// Set graphics sync timer relative to offset of next vertical retrace.
		GraphicsTargetTimer.Reset(-GRAPHICS_VerticalRetraceOffsetTimeUntilNext());
	}
}
开发者ID:anosnowhong,项目名称:phantom,代码行数:18,代码来源:DynamicLearning_migrating.cpp

示例3: StateNext

void StateNext(int state)
{
	if (State == state)
	{
		return;
	}

	printf("STATE: %s[%d] > %s[%d] (%.0lf msec).\n", StateText[State], State, StateText[state], state, StateTimer.Elapsed());
	StateTimer.Reset();
	StateLast = State;
	State = state;
}
开发者ID:anosnowhong,项目名称:phantom,代码行数:12,代码来源:DynamicLearning_migrating.cpp

示例4: Init

//Called for initiation
bool Init(void)
{
	//Check for necessary extensions
	if(!GLEE_ARB_depth_texture || !GLEE_ARB_shadow)
	{
		printf("I require ARB_depth_texture and ARB_shadow extensionsn\n");
		return false;
	}
	
	//Load identity modelview
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	//Shading states
	glShadeModel(GL_SMOOTH);
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

	//Depth states
	glClearDepth(1.0f);
	glDepthFunc(GL_LEQUAL);
	glEnable(GL_DEPTH_TEST);

	glEnable(GL_CULL_FACE);

	//We use glScale when drawing the scene
	glEnable(GL_NORMALIZE);

	//Create the shadow map texture
	glGenTextures(1, &shadowMapTexture);
	glBindTexture(GL_TEXTURE_2D, shadowMapTexture);
	glTexImage2D(	GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadowMapSize, shadowMapSize, 0,
					GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

	//Use the color as the ambient and diffuse material
	glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
	glEnable(GL_COLOR_MATERIAL);
	
	//White specular material color, shininess 16
	glMaterialfv(GL_FRONT, GL_SPECULAR, white);
	glMaterialf(GL_FRONT, GL_SHININESS, 16.0f);

	//Calculate & save matrices
	glPushMatrix();
	
	glLoadIdentity();
	gluPerspective(45.0f, (float)windowWidth/windowHeight, 1.0f, 100.0f);
	glGetFloatv(GL_MODELVIEW_MATRIX, cameraProjectionMatrix);
	
	glLoadIdentity();
	gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
				0.0f, 0.0f, 0.0f,
				0.0f, 1.0f, 0.0f);
	glGetFloatv(GL_MODELVIEW_MATRIX, cameraViewMatrix);
	
	glLoadIdentity();
	gluPerspective(45.0f, 1.0f, 2.0f, 8.0f);
	glGetFloatv(GL_MODELVIEW_MATRIX, lightProjectionMatrix);
	
	glLoadIdentity();
	gluLookAt(	lightPosition.x, lightPosition.y, lightPosition.z,
				0.0f, 0.0f, 0.0f,
				0.0f, 1.0f, 0.0f);
	glGetFloatv(GL_MODELVIEW_MATRIX, lightViewMatrix);
	
	glPopMatrix();

	//Reset timer
	timer.Reset();

	return true;
}
开发者ID:shanfl,项目名称:collectcode,代码行数:78,代码来源:main.cpp

示例5: StateProcess

void StateProcess(void)
{
	double d;

	// Check that robot is in a safe state.
	if (!ROBOT_Safe(ROBOT_ID))
	{
		printf("Robot not safe.\n");
		ProgramExit();
	}

	// Special processing while a trial is running.
	if (TrialRunning)
	{
		if (!RobotActive())
		{
			// If robot is not active, abort current trial.
			ErrorRobotInactive();
			TrialAbort();
			MissTrial();
		}
		else
			if (FrameData.Full())
			{
				// Abort current trail if frame data is full.
				ErrorFrameDataFull();
				TrialAbort();
				MissTrial();
			}
	}

	// Some states are processing in the LoopTask.
	if (StateLoopTask[State])
	{
		return;
	}

	// State processing.
	switch (State)
	{
	case STATE_INITIALIZE:
		// Initialization state.
		if (TargetTestFlag)
		{
			break;
		}

		ExperimentTimer.Reset();
		StateNext(STATE_SETUP);
		break;

	case STATE_SETUP:


		// Setup details of next trial, but only when robot stationary and active.


		if (RobotNotMoving() && RobotActive())
		{
			printf("Dynamic learning: before Trialsetup i am here=====!!!!\n");
			TrialSetup();
			StateNext(STATE_HOME);
		}
		break;

	case STATE_HOME:
		// Start trial when robot in home position (and stationary and active).
		if (RobotNotMoving() && RobotHome() && RobotActive())
		{
			StateNext(STATE_START);
			break;
		}
		break;

	case STATE_START:
		// Start trial.
		TrialStart();
		StateNext(STATE_DELAY);
		break;

	case STATE_DELAY:
		// Delay period before go signal.
		if (StateTimer.ExpiredSeconds(TrialDelay))
		{
			StateNext(STATE_GO);
			break;
		}

		if (MovementStarted())
		{
			ErrorMoveTooSoon();
			TrialAbort();
			MissTrial();
		}
		break;

	case STATE_GO:
		// Wait until graphics state matches.
		if (State != StateGraphics)
		{
//.........这里部分代码省略.........
开发者ID:anosnowhong,项目名称:phantom,代码行数:101,代码来源:DynamicLearning_migrating.cpp

示例6: TrialList

BOOL TrialList(void)
{
	int item, i;
	BOOL ok = TRUE;

	TotalTrials = 0;

	// Single or multiple configuration file paradigm?
	if (ConfigFiles == 1)
	{

		TotalTrials = Trials;
		ConfigIndex = 0;
	}
	else
	{
		// Loop over configuration files, counting the number of trials.
		for (ok = TRUE, ConfigIndex = 1; (ok && (ConfigIndex < ConfigFiles)); ConfigIndex++)
		{
			if (!ConfigLoad(ConfigFile[ConfigIndex]))
			{
				ok = FALSE;
				continue;
			}

			TotalTrials += Trials;
			printf("%d %s Trials=%d TotalTrials=%d\n", ConfigIndex, ConfigFile[ConfigIndex], Trials, TotalTrials);
		}

		ConfigIndex = 1;
	}

	if ((TotalTrials == 0) || !ok)
	{
		return(FALSE);
	}

	// Set rows of TrialData to the number of trials.
	TrialData.SetRows(TotalTrials);

	printf("Making list of %d trials (ESCape to abort)...\n", TotalTrials);

	TotalTrials = 0;
	TotalNullTrials = 0;
	TotalExposureTrials = 0;
	TotalCatchTrials = 0;

	// Loop over configuration files, appending each to growing trial list.
	for (ok = TRUE; (ok && (ConfigIndex < ConfigFiles)); ConfigIndex++)
	{
		if (ConfigIndex > 0)
		{
			if (!ConfigLoad(ConfigFile[ConfigIndex]))
			{
				ok = FALSE;
				continue;
			}
		}

		// Create subset of trials for this configuration file.
		if (!TrialListSubset())
		{
			ok = FALSE;
			continue;
		}

		TotalTrials += Trials;
		TotalNullTrials += NullTrial;
		TotalExposureTrials += ExposureTrial;
		TotalCatchTrials += CatchTrial;

		printf("%d %s Trials=%d TotalTrials=%d\n", ConfigIndex, ConfigFile[ConfigIndex], Trials, TotalTrials);
	}

	if (!ok)
	{
		return(FALSE);
	}

	printf("%d Total Trials, %d Null, %d Exposure, %d Catch.\n", TotalTrials, TotalNullTrials, TotalExposureTrials, TotalCatchTrials);

	// Total number of trails.
	Trials = TotalTrials;

	// Save trial list to file.
	ok = DATAFILE_Save(TrialListFile, TrialData);
	printf("%s %s Trials=%d.\n", TrialListFile, STR_OkFailed(ok), TrialData.GetRows());

	// Reset trial number, etc.
	Trial = 1;
	TrialSetup();
	ExperimentTimer.Reset();
	StateNext(STATE_INITIALIZE);

	return(TRUE);
}
开发者ID:anosnowhong,项目名称:phantom,代码行数:96,代码来源:DynamicLearning_migrating.cpp


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