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


C++ Matrix34::MakeRotateX方法代码示例

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


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

示例1: project1

void project1() {
	// Create scene
	Scene scn;
	scn.SetSkyColor(Color(0.8f, 0.9f, 1.0f));

	// Create boxes
    LambertMaterial lambert1;
    lambert1.SetDiffuseColor(Color(0.3f,0.3f,0.3f));

	MeshObject box1;
	box1.MakeBox(5.0f,0.1f,5.0f, &lambert1);
	scn.AddObject(box1);
    
    
    LambertMaterial lambert2;
    lambert2.SetDiffuseColor(Color(0.7f,0.7f,0.7f));
	MeshObject box2;
	box2.MakeBox(1.0f,1.0f,1.0f, &lambert2);
    
	InstanceObject inst1(box2);
	Matrix34 mtx;
	mtx.MakeRotateX(0.5f);
	mtx.d.y=1.0f;
	inst1.SetMatrix(mtx);
	scn.AddObject(inst1);
    
	InstanceObject inst2(box2);
	mtx.MakeRotateY(1.0f);
	mtx.d.Set(-1.0f,0.0f,1.0f);
	inst2.SetMatrix(mtx);
	scn.AddObject(inst2);
    
	// Create lights
	DirectLight sunlgt;
	sunlgt.SetBaseColor(Color(1.0f, 1.0f, 0.9f));
	sunlgt.SetIntensity(0.5f);
	sunlgt.SetDirection(Vector3(-0.5f, -1.0f, -0.5f));
	scn.AddLight(sunlgt);
    
	PointLight redlgt;
	redlgt.SetBaseColor(Color(1.0f, 0.2f, 0.2f));
	redlgt.SetIntensity(2.0f);
	redlgt.SetPosition(Vector3(2.0f, 2.0f, 0.0f));
	scn.AddLight(redlgt);
    
	// Create camera
	Camera cam;
	cam.LookAt(Vector3(2.0f,2.0f,5.0f), Vector3(0.0f,0.0f,0.0f));
	cam.SetResolution(800,600);
	cam.SetFOV(40.0f);
	cam.SetAspect(1.33f);
    
	// Render image
	cam.Render(scn);
	cam.SaveBitmap("project1.bmp");
}
开发者ID:petrosferdinand,项目名称:CSE168,代码行数:56,代码来源:Main.cpp

示例2: Keyboard


//.........这里部分代码省略.........

		case 'p':		//Pause Animation
			pauseAnimation = !pauseAnimation;
			break;

	//Parachute
		case 'o':		//toggle between cloth and parachute
			clothFirst = !clothFirst;
			break;


	//Cloth Modifications.
		case 'f':		//Switch to solid
			drawStyle = 1;
			break;
		case 'g':		//Switch to wire
			drawStyle = 0;
			break;
		case 'a':		//Move left
			cloth.translateCloth(Vector3(-translateAmount, 0, 0));
			break;
		case 'd':		//Move right
			cloth.translateCloth(Vector3(translateAmount, 0, 0));
			break;
		case 'w':		//Move forward
			cloth.translateCloth(Vector3(0, 0, -translateAmount));
			break;
		case 's':		//Move backward
			cloth.translateCloth(Vector3(0, 0, translateAmount));
			break;
		case 'v':		//Move up
			cloth.translateCloth(Vector3(0, translateAmount, 0));
			break;
		case 'b':		//Move down
			cloth.translateCloth(Vector3(0, -translateAmount, 0));
			break;
		case 'q':		//rotate X counterclock wise
			rotMtx.MakeRotateX(rotateClothRad);
			cloth.rotateCloth(rotMtx);
			break;
		case 'e':		//rotate X clock wise
			rotMtx.MakeRotateX(-rotateClothRad);
			cloth.rotateCloth(rotMtx);
			break;
		case 'r':		//rotate Y counterclock wise
			rotMtx.MakeRotateY(rotateClothRad);
			cloth.rotateCloth(rotMtx);
			break;
		case 't':		//rotate Y clock wise
			rotMtx.MakeRotateY(-rotateClothRad);
			cloth.rotateCloth(rotMtx);
			break;
		case 'y':		//rotate Z counterclock wise
			rotMtx.MakeRotateZ(rotateClothRad);
			cloth.rotateCloth(rotMtx);
			break;
		case 'u':		//rotate Z clock wise
			rotMtx.MakeRotateZ(-rotateClothRad);
			cloth.rotateCloth(rotMtx);
			break;



	//Wind adjustments
		case 'm':		//toggle wind
			if(windFactor != 0)	//on turn off
				windFactor = 0;
			else
				windFactor = 20;	//off turn on
			break;
		case 'h':		//Increase wind
			windFactor += 1;
			break;
		case 'j':
			windFactor -= 1;
			break;

	//Ground adjustments
		case 'z':		//toggle ground
			toggleGnd = !toggleGnd;
			break;
		case 'x':		//raise ground
			gnd.setPositionY(gnd.getPositionY() + 0.5);	
			break;
		case 'c':		//lower ground
			gnd.setPositionY(gnd.getPositionY() - 0.5);	
			break;
		case 'k':		//Draw Solid
			gndDrawType = 0;	
			break;
		case 'l':		//Draw Wire
			gndDrawType = 1;	
			break;





	}
}
开发者ID:ludaxkris,项目名称:parachute-animation,代码行数:101,代码来源:tester.cpp


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