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


C++ Keyboard::Backward方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
	    unsigned value = x | (y<<16);
	    pMortonTable[ofs++] = value;
	    if (ofs == MAXX*MAXY)
		break;
	}
    }
    SAFE( cudaMemcpy(cudaMortonTable, pMortonTable, ofs*sizeof(unsigned), cudaMemcpyHostToDevice) );

    //
    // Game time...
    //

    pLight->_x = LightDistanceFactor*maxi*cos(angle3);
    pLight->_y = LightDistanceFactor*maxi*sin(angle3);

    g_benchmark = bench;

    ModeDescription();
    watch.reset();
    while(!keys.Abort()) {
	framesDrawn++;
	if (bench && framesDrawn>benchFrames)
	    break;
	if (!bench) {
	    // Only allow keyboard control if we are not benchmarking
	    if (keys.Left())
		angle1-=dAngle;
	    if (keys.Right())
		angle1+=dAngle;
	    if (keys.Up())
		angle2=min(angle2+dAngle, DEGREES_TO_RADIANS(89.0f));
	    if (keys.Down())
		angle2=max(angle2-dAngle, DEGREES_TO_RADIANS(-89.0f));
	    if (keys.Forward() || keys.Backward()) {
		Vector3 fromEyeToLookat(lookat);
		fromEyeToLookat -= eye;
		if (autoRotate)
		    fromEyeToLookat *= 0.05f;
		else
		    fromEyeToLookat *= 0.05f*maxi;
		/*
		cout << "At " << eye._x << " " << eye._y << " " << eye._z << endl;
		cout << "Looking at " << lookat._x << " " << lookat._y << " " << lookat._z << endl;
		cout << "Adding " << fromEyeToLookat._x << " " << fromEyeToLookat._y << " " << fromEyeToLookat._z << endl;
		*/
		if (keys.Forward())
		    eye += fromEyeToLookat;
		else
		    eye -= fromEyeToLookat;
	    }
	    if (keys.isF4()) {
		watch.reset(); framesDrawn = 1;
		while (keys.isF4()) keys.poll(); g_bUsePoints       = !g_bUsePoints;       ModeDescription(); }
	    if (keys.isF5()) {
		watch.reset(); framesDrawn = 1;
		while (keys.isF5()) keys.poll(); g_bUseSpecular     = !g_bUseSpecular;     ModeDescription(); }
	    if (keys.isF6()) {
		watch.reset(); framesDrawn = 1;
		while (keys.isF6()) keys.poll(); g_bUsePhongInterp  = !g_bUsePhongInterp;  ModeDescription(); }
	    if (keys.isF7()) {
		watch.reset(); framesDrawn = 1;
		while (keys.isF7()) keys.poll(); g_bUseReflections  = !g_bUseReflections;  ModeDescription(); }
	    if (keys.isF8()) {
		watch.reset(); framesDrawn = 1;
		while (keys.isF8()) keys.poll(); g_bUseShadows      = !g_bUseShadows;      ModeDescription(); }
	    if (keys.isF9()) {
开发者ID:petronny,项目名称:renderer-cuda,代码行数:67,代码来源:main.cpp


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