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


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

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


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

示例1: main


//.........这里部分代码省略.........
    maxDim++;
    // Build morton table for our pixels
    int ofs = 0;
    for(unsigned work=0; work<maxDim*maxDim; work++) {
	unsigned topBit = 0x80000000;
	unsigned w = work;
	int x=0, y=0;
	for(unsigned i=0; i<32; i+=2) {
	    y = (y<<1) | ((w&topBit)?1:0);
	    w<<=1;
	    x = (x<<1) | ((w&topBit)?1:0);
	    w<<=1;
	}
	if (x>=0 && y>=0 && x<MAXX && y<MAXY) {
	    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;
开发者ID:petronny,项目名称:renderer-cuda,代码行数:67,代码来源:main.cpp


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