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


C++ RotateX函数代码示例

本文整理汇总了C++中RotateX函数的典型用法代码示例。如果您正苦于以下问题:C++ RotateX函数的具体用法?C++ RotateX怎么用?C++ RotateX使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: drawBouquet

void drawBouquet(float r, float g, float b)
{
	
	mvstack.push(model_view);
		model_view *= RotateX(-90);
		set_colour(r,g,b);
		drawCone();

		model_view *= RotateX(90);
		model_view *= Translate(0.0f, 2.0f, 0.0f);
		drawFlower();

		mvstack.push(model_view);
			model_view *= RotateZ(25);
			model_view *= Translate(-1.0f, 0.25f, 0.0f);
			drawFlower();
		model_view = mvstack.pop();

		mvstack.push(model_view);
			model_view *= RotateZ(-25);
			model_view *= Translate(1.0f, 0.25f, 0.0f);
			drawFlower();
		model_view = mvstack.pop();
	model_view = mvstack.pop();
}
开发者ID:gulfstreamiv,项目名称:UCLA-CS-Coursework,代码行数:25,代码来源:anim.cpp

示例2: Translate

void Joint::updateTransform(Animation *animation, int frameCounter, int &channelCounter)
{
	if(numChannels == 6)
	{
		Mat4f temp = Translate(animation->Frames[frameCounter].Tranformations[channelCounter], animation->Frames[frameCounter].Tranformations[channelCounter + 1], animation->Frames[frameCounter].Tranformations[channelCounter + 2]);
		TLocal = temp; 

		////so animations stay in one spot
		//Mat4f temp = Translate(0.0f, animation->Frames[frameCounter].Tranformations[channelCounter + 1], 0.0f);
		//TLocal = temp; 	

		Mat4f rZ = RotateZ(animation->Frames[frameCounter].Tranformations[channelCounter + 3]);	//z
		Mat4f rX = RotateX(animation->Frames[frameCounter].Tranformations[channelCounter + 4]);	//y
		Mat4f rY = RotateY(animation->Frames[frameCounter].Tranformations[channelCounter + 5]);	//x
		RLocal = rZ * rX * rY; //rZ * rY * rX

		channelCounter += 6;
	}
	else if(numChannels == 3)
	{
		Mat4f rZ = RotateZ(animation->Frames[frameCounter].Tranformations[channelCounter]);
		Mat4f rX = RotateX(animation->Frames[frameCounter].Tranformations[channelCounter + 1]);
		Mat4f rY = RotateY(animation->Frames[frameCounter].Tranformations[channelCounter + 2]);
		RLocal = rZ * rX * rY; 

		channelCounter += 3;
	}

	//update all of the childern
	for(unsigned int i = 0; i < this->Children.size(); i++)
	{
		Children[i]->updateTransform(animation, frameCounter, channelCounter);	
	}
}
开发者ID:KrisMaddeaux,项目名称:Telkram,代码行数:34,代码来源:BVH_FileLoader.cpp

示例3: Rotate

// rotate about u-axis 
Matrix4D Rotate(const Matrix4D &m,const Vector3D& u, float theta)
{
	float x, y, z,w;
	x = u.x;
	y = u.y;
	z = u.z;

	w=Magnitude(u);
	float ux, uy, uz,ud,xtheta,ytheta;
	ux = x / w;
	uy = y / w;
	uz = z / w;

	ud = pow(pow(uy, 2) + pow(uz, 2), 0.5);
	xtheta = acos(uy / ud);
	ytheta = acos(ud);

	Matrix4D temp;
	temp = Translate(x, y, z)*m;
	temp = RotateX(ytheta)*temp;
	temp = RotateY(ytheta)*temp;
	temp = RotateZ(theta)*temp;
	temp = Inverse(RotateY(ytheta))*temp;
	temp = Inverse(RotateX(xtheta))*temp;
	temp = Inverse(Translate(x, y, z))*temp;

	return temp;

}
开发者ID:Redrock912,项目名称:reboot,代码行数:30,代码来源:transform.cpp

示例4: RotateX

mat4 SpelchkCamera::getModelViewMatrix() {
  _modelViewMatrix = RotateX( _xAngle ) * RotateY( _yAngle )
                     * RotateZ( _zAngle ) * RotateX( _xHeadAngle )
                     * RotateY( _yHeadAngle ) * Translate( _translationVector )
                     * RotateX( -_xHeadAngle ) * RotateY( -_yHeadAngle );
  return _modelViewMatrix;
}
开发者ID:C-Compton,项目名称:OpenGL,代码行数:7,代码来源:SpelchkCamera.cpp

示例5: drawBanana1

void drawBanana1(void)
{
	mvstack.push(model_view);
	set_colour(.95, .9, .8);
	model_view *= Scale(0.08, 0.2, 0.1);
	model_view *= RotateX(90);
	drawSphere();
	model_view = mvstack.pop();

	mvstack.push(model_view);
	set_colour(.95, .9, .1);
	model_view *= Scale(0.1, 0.3, 0.112);
	model_view *= Translate (0, -.5, 0);
	model_view *= RotateX(90);
	drawSphere();
	model_view = mvstack.pop();

	mvstack.push(model_view);
	set_colour (.1, .1, .2);
	model_view *= Translate(0, -0.45, 0);
	model_view *= Scale(.025, .025,.025);
	drawSphere();
	model_view = mvstack.pop();


}
开发者ID:yabbadabbadoo1,项目名称:opengl-animation-test,代码行数:26,代码来源:anim.cpp

示例6: drawBench

void drawBench(void)
{
	mvstack.push(model_view);
	drawWood();
	model_view *= Translate (0, -2.5 ,0);
	drawWood();

	model_view *= Translate (0, -1, 1);
	model_view *= RotateX(90);
	model_view *= Scale(1, 0.25, 2);
	drawWood();
	model_view *= Translate(0, 2, 0);
	drawWood();
	model_view *= Translate(0, 2, 0);
	drawWood();
	model_view *= Translate(0, 2, 0);
	drawWood();
	model_view *= Translate(0, 2, 0);
	drawWood();
	model_view = mvstack.pop();

	mvstack.push(model_view);
	set_colour(.2,.2,.2);
	model_view *= Translate (-6.5 , -.7 , 0.25);
	drawHandle();
	model_view *= Translate (0, -.7, 1.25);
	model_view *= RotateX(90);
	drawHandle();
	model_view *= Scale (1, 1, 1.5);
	model_view *= Translate (0, 1.3, 1.5);
	model_view *= RotateX(90);
	drawHandle();
	model_view = mvstack.pop();

	mvstack.push(model_view);
	model_view *= Translate(6.5, -.7, 0.25);
	drawHandle();
	model_view *= Translate (0, -.7, 1.25);
	model_view *= RotateX(90);
	drawHandle();
	model_view *= Scale (1, 1, 1.5);
	model_view *= Translate (0, 1.3, 1.5);
	model_view *= RotateX(90);
	drawHandle();
	model_view = mvstack.pop();

	mvstack.push(model_view);
	model_view *= Translate (6.5, -4.5, 1);
	drawHandle();
	model_view = mvstack.pop();

	mvstack.push(model_view);
	model_view *= Translate (-6.5, -4.5, 1);
	drawHandle();
	model_view = mvstack.pop();
}
开发者ID:yabbadabbadoo1,项目名称:opengl-animation-test,代码行数:56,代码来源:anim.cpp

示例7: Translate

//draws the body of the O
//@pre mv has been assigned
//@post draws an O to the world
//@param mv - the model view
//@usage drawBody(some_model_view)
void
Letter_O::drawBody(mat4& mv)
{
    mvMatrixStack.pushMatrix(mv);
    mv = mv * Translate(0.7, -0.5, 0);
    mv = mv * Scale(1.5, 1.25, 1);
    mvMatrixStack.pushMatrix(mv);
    mv = mv * Translate(-2, 0, 0);
    for (int i = 0; i < 5; i++) {
        mvMatrixStack.pushMatrix(mv);
        mv = mv * Translate(-1 + pow(i / 2.5, 2.0), i +6, 0);
        vec4 color(0, 0, 1, 1);
        mv = mv*Scale(cHeight,cLength,cWidth);
        glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );
        shapes.drawCube(color);
        mv = mvMatrixStack.popMatrix();
    }

    for (int i = 0; i < 5; i++) {
        mvMatrixStack.pushMatrix(mv);
        mv = mv * RotateX(180);
        mv = mv * Translate(-1 + pow(i / 2.5, 2.0), i - 5, 0);
        vec4 color(0, 0, 1, 1);
        mv = mv*Scale(cHeight,cLength,cWidth);
        glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );
        shapes.drawCube(color);
        mv = mvMatrixStack.popMatrix();
    }
    mvMatrixStack.popMatrix();

    mvMatrixStack.pushMatrix(mv);
    mv = mv * Translate(3, 0, 0);
    mv = mv * RotateY(180);
    for (int i = 0; i < 5; i++) {
        mvMatrixStack.pushMatrix(mv);
        mv = mv * Translate(-1 + pow(i / 2.5, 2.0), i +6, 0);
        vec4 color(0, 0, 1, 1);
        mv = mv*Scale(cHeight,cLength,cWidth);
        glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );
        shapes.drawCube(color);
        mv = mvMatrixStack.popMatrix();
    }

    for (int i = 0; i < 5; i++) {
        mvMatrixStack.pushMatrix(mv);
        mv = mv * RotateX(180);
        mv = mv * Translate(-1 + pow(i / 2.5, 2.0), i - 5, 0);
        vec4 color(0, 0, 1, 1);
        mv = mv*Scale(cHeight,cLength,cWidth);
        glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );
        shapes.drawCube(color);
        mv = mvMatrixStack.popMatrix();
    }
    mvMatrixStack.popMatrix();
    mvMatrixStack.popMatrix();
}
开发者ID:garrettsparks,项目名称:Classwork,代码行数:61,代码来源:Letter_O.cpp

示例8: keyboard

void keyboard(unsigned char key, int x, int y) {
	switch(key) {
	case 033: // Esc
	case 'q': 
		exit(EXIT_SUCCESS);
		break;
	case 'w': // Write
		saveState("savestate.rubiks");
		break;
	case 'e': // Edit
		loadState("savestate.rubiks");
		break;
	case 'r': // Reset
		resetRotationMatrix();
		break;

	// Scene rotation with arrow keys
	case 'k':
		rotationMat *= RotateX(ROTATION_FACTOR_KEYBOARD);
		break;
	case 'j':
		rotationMat *= RotateX(-ROTATION_FACTOR_KEYBOARD);
		break;
	case 'l':
		rotationMat *= RotateZ(ROTATION_FACTOR_KEYBOARD);
		break;
	case 'h':
		rotationMat *= RotateZ(-ROTATION_FACTOR_KEYBOARD);
		break;
	
	// Shift + number keys
	case '!': key = 1; break;
	case '@': key = 2; break;
	case '#': key = 3; break;
	case '$': key = 4; break;
	case '%': key = 5; break;
	case '^': key = 6; break;
	case '&': key = 7; break;
	case '*': key = 8; break;
	case '(': key = 9; break;
	}
	if (key <= 9) {
		key--;
		rotateSlice(positions,key/3,key%3,false);
	}
	if (key > '0' && key <='9') {
		int p = key - '1';
		rotateSlice(positions,p/3,p%3,true);
	}
}
开发者ID:williamho,项目名称:rubiks,代码行数:50,代码来源:rubiks.cpp

示例9: drawTree

void drawTree(void)
{
	mvstack.push(model_view);
	set_colour(.4, .2, .1);
	model_view *= Scale (3, 8, 3);
	model_view *= RotateX(90);
	drawTrunk();
	model_view = mvstack.pop();

	mvstack.push(model_view);
	model_view *= Translate(0, 5, 0);
	model_view *= RotateX(90);
	drawGreen();
	model_view = mvstack.pop();
}
开发者ID:yabbadabbadoo1,项目名称:opengl-animation-test,代码行数:15,代码来源:anim.cpp

示例10: Win_PassiveMotion

//----------------------------------------------------------------------------
// The passive motion callback for a window is called when the mouse moves within the window while no mouse buttons are pressed.
void Win_PassiveMotion(int x, int y) {

	g_fPhi = (float)-M_PI*(x - HALF_SIZE)/(HALF_SIZE); // 轉換成 g_fPhi 介於 -PI 到 PI 之間 (-180 ~ 180 之間)
	g_fTheta = (float)M_PI*(float)y/SCREEN_SIZE;
	g_vEye.x = g_fRadius*sin(g_fTheta)*sin(g_fPhi);
	g_vEye.y = g_fRadius*cos(g_fTheta);
	g_vEye.z = g_fRadius*sin(g_fTheta)*cos(g_fPhi);


	mxT = Translate(0, 1.0f, 0.0f)  * RotateY((M_PI+g_fPhi)/DegreesToRadians) *RotateX(90) *Scale(2,2,2);
	printf("%f\n",g_fPhi/DegreesToRadians);

	g_mxModelView = LookAt( g_vEye, g_vAt, g_vUp );

	// Change ModelView Matrix
	g_pFloor->SetModelViewMatrix(g_mxModelView);
	g_pLight->SetModelViewMatrix(g_mxModelView);
	//TODO 
	vec4 tmp = vec4(0,0,-1,0.0);
	float fuck = dot(tmp,g_vEye-vec4(0,1,0,0));

	g_pAimal[0]->SetTRSMatrix(mxT);
	g_pAimal[0]->SetModelViewMatrix(g_mxModelView);

}
开发者ID:youweit,项目名称:CG-Final-Project,代码行数:27,代码来源:Example4.cpp

示例11: MoveForward

// rotire fata de centru, la o distanta generica 5
void Camera::RotateXCenter (GLfloat Angle)
{
	float distance = 10;
	MoveForward(distance);
	RotateX(Angle);
	MoveBackward(distance);
}
开发者ID:danielrizea,项目名称:NFS--Just-Drive-The-Car-,代码行数:8,代码来源:Camera.cpp

示例12: Euler2C_One

/*
 * Arguments    : const float euler[3]
 *                float C[9]
 * Return Type  : void
 */
static void Euler2C_One(const float euler[3], float C[9])
{
  float fv3[9];
  float fv4[9];
  float fv5[9];
  float fv6[9];
  int i3;
  int i4;
  int i5;

  /*  if ~exist('rotateOrder','var') || isempty(rotateOrder) */
  /*      rotateOrder = 'ZYX'; */
  /*  end */
  RotateX(euler[2], fv3);
  RotateZ(euler[1], fv4);
  RotateY(euler[0], fv5);
  for (i3 = 0; i3 < 3; i3++) {
    for (i4 = 0; i4 < 3; i4++) {
      fv6[i3 + 3 * i4] = 0.0F;
      for (i5 = 0; i5 < 3; i5++) {
        fv6[i3 + 3 * i4] += fv3[i3 + 3 * i5] * fv4[i5 + 3 * i4];
      }
    }

    for (i4 = 0; i4 < 3; i4++) {
      C[i3 + 3 * i4] = 0.0F;
      for (i5 = 0; i5 < 3; i5++) {
        C[i3 + 3 * i4] += fv6[i3 + 3 * i5] * fv5[i5 + 3 * i4];
      }
    }
  }
}
开发者ID:michille78,项目名称:program_xyz,代码行数:37,代码来源:GenThumbDirection.c

示例13: drawPineTree

void drawPineTree(void)
{
	mvstack.push(model_view);
	mvstack.push(model_view);
	model_view *= Translate(0.0,19.0,0.0);
	model_view *= Scale(5.0,7.0,5.0);
	model_view *= RotateX(90);
	set_colour(0.0,0.8,0.3);
	drawCone();
	model_view = mvstack.pop();
	set_colour(.5,.5,.2);
	model_view *= Scale(1.0,13.0,1.0);
	model_view *= RotateX(90);
	drawCylinder();
	model_view = mvstack.pop();
}
开发者ID:gulfstreamiv,项目名称:UCLA-CS-Coursework,代码行数:16,代码来源:anim.cpp

示例14: LoadIdentity

CMatrix44f::CMatrix44f(const float& rotX, const float& rotY, const float& rotZ)
{
	LoadIdentity();
	RotateX(rotX);
	RotateY(rotY);
	RotateZ(rotZ);
}
开发者ID:AlexDiede,项目名称:spring,代码行数:7,代码来源:Matrix44f.cpp

示例15: Null

void CRotationMatrix::SetRotation3(CVector3 rotation)
{
	Null();
	RotateZ(rotation.x);
	RotateY(rotation.y);
	RotateX(rotation.z);
}
开发者ID:thunderk,项目名称:mandelbulber2,代码行数:7,代码来源:algebra.cpp


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