本文整理汇总了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");
}
示例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;
}
}