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


C++ MatrixStack类代码示例

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


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

示例1: DrawFingers

	void DrawFingers(MatrixStack &modelToCameraStack)
	{
		//Draw left finger
		modelToCameraStack.Push();
		modelToCameraStack.Translate(posLeftFinger);
		modelToCameraStack.RotateY(angFingerOpen);

		modelToCameraStack.Push();
		modelToCameraStack.Translate(glm::vec3(0.0f, 0.0f, lenFinger / 2.0f));
		modelToCameraStack.Scale(glm::vec3(widthFinger / 2.0f, widthFinger/ 2.0f, lenFinger / 2.0f));
		glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelToCameraStack.Top()));
		glDrawElements(GL_TRIANGLES, ARRAY_COUNT(indexData), GL_UNSIGNED_SHORT, 0);
		modelToCameraStack.Pop();

		{
			//Draw left lower finger
			modelToCameraStack.Push();
			modelToCameraStack.Translate(glm::vec3(0.0f, 0.0f, lenFinger));
			modelToCameraStack.RotateY(-angLowerFinger);

			modelToCameraStack.Push();
			modelToCameraStack.Translate(glm::vec3(0.0f, 0.0f, lenFinger / 2.0f));
			modelToCameraStack.Scale(glm::vec3(widthFinger / 2.0f, widthFinger/ 2.0f, lenFinger / 2.0f));
			glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelToCameraStack.Top()));
			glDrawElements(GL_TRIANGLES, ARRAY_COUNT(indexData), GL_UNSIGNED_SHORT, 0);
			modelToCameraStack.Pop();

			modelToCameraStack.Pop();
		}

		modelToCameraStack.Pop();

		//Draw right finger
		modelToCameraStack.Push();
		modelToCameraStack.Translate(posRightFinger);
		modelToCameraStack.RotateY(-angFingerOpen);

		modelToCameraStack.Push();
		modelToCameraStack.Translate(glm::vec3(0.0f, 0.0f, lenFinger / 2.0f));
		modelToCameraStack.Scale(glm::vec3(widthFinger / 2.0f, widthFinger/ 2.0f, lenFinger / 2.0f));
		glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelToCameraStack.Top()));
		glDrawElements(GL_TRIANGLES, ARRAY_COUNT(indexData), GL_UNSIGNED_SHORT, 0);
		modelToCameraStack.Pop();

		{
			//Draw right lower finger
			modelToCameraStack.Push();
			modelToCameraStack.Translate(glm::vec3(0.0f, 0.0f, lenFinger));
			modelToCameraStack.RotateY(angLowerFinger);

			modelToCameraStack.Push();
			modelToCameraStack.Translate(glm::vec3(0.0f, 0.0f, lenFinger / 2.0f));
			modelToCameraStack.Scale(glm::vec3(widthFinger / 2.0f, widthFinger/ 2.0f, lenFinger / 2.0f));
			glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelToCameraStack.Top()));
			glDrawElements(GL_TRIANGLES, ARRAY_COUNT(indexData), GL_UNSIGNED_SHORT, 0);
			modelToCameraStack.Pop();

			modelToCameraStack.Pop();
		}

		modelToCameraStack.Pop();
	}
开发者ID:Nuclearfossil,项目名称:ducking-octo-dangerzone,代码行数:62,代码来源:Hierarchy.cpp

示例2: Draw

	void Draw()
	{
		MatrixStack modelToCameraStack;

		glUseProgram(theProgram);
		glBindVertexArray(vao);

		modelToCameraStack.Translate(posBase);
		modelToCameraStack.RotateY(angBase);

		//Draw left base.
		{
			modelToCameraStack.Push();
			modelToCameraStack.Translate(posBaseLeft);
			modelToCameraStack.Scale(glm::vec3(1.0f, 1.0f, scaleBaseZ));
			glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelToCameraStack.Top()));
			glDrawElements(GL_TRIANGLES, ARRAY_COUNT(indexData), GL_UNSIGNED_SHORT, 0);
			modelToCameraStack.Pop();
		}

		//Draw right base.
		{
			modelToCameraStack.Push();
			modelToCameraStack.Translate(posBaseRight);
			modelToCameraStack.Scale(glm::vec3(1.0f, 1.0f, scaleBaseZ));
			glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelToCameraStack.Top()));
			glDrawElements(GL_TRIANGLES, ARRAY_COUNT(indexData), GL_UNSIGNED_SHORT, 0);
			modelToCameraStack.Pop();
		}

		//Draw main arm.
		DrawUpperArm(modelToCameraStack);

		glBindVertexArray(0);
		glUseProgram(0);
	}
开发者ID:Nuclearfossil,项目名称:ducking-octo-dangerzone,代码行数:36,代码来源:Hierarchy.cpp

示例3: PreMultMatrix

void RageDisplay::PreMultMatrix( const RageMatrix &m )
{
	g_WorldStack.MultMatrixLocal( m );
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例4: SkewX

void RageDisplay::SkewX( float fAmount )
{
	g_WorldStack.SkewX( fAmount );
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例5: PostMultMatrix

void RageDisplay::PostMultMatrix( const RageMatrix &m )
{
	g_WorldStack.MultMatrix( m );
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例6: Scale

void RageDisplay::Scale( float x, float y, float z )
{
	g_WorldStack.ScaleLocal(x, y, z);
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例7: RotateZ

void RageDisplay::RotateZ( float deg )
{
	g_WorldStack.RotateZLocal( deg );
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例8: PopMatrix

void RageDisplay::PopMatrix() 
{ 
	g_WorldStack.Pop();
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例9: TranslateWorld

void RageDisplay::TranslateWorld( float x, float y, float z )
{
	g_WorldStack.Translate(x, y, z);
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例10: GetTextureTop

const RageMatrix* RageDisplay::GetTextureTop()
{
	return g_TextureStack.GetTop();
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例11: PushMatrix

void RageDisplay::PushMatrix() 
{ 
	g_WorldStack.Push();
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例12: GetWorldTop

const RageMatrix* RageDisplay::GetWorldTop()
{
	return g_WorldStack.GetTop();
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例13: GetViewTop

const RageMatrix* RageDisplay::GetViewTop()
{
	return g_ViewStack.GetTop();
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp

示例14: GetProjectionTop

const RageMatrix* RageDisplay::GetProjectionTop()
{
	return g_ProjectionStack.GetTop();
}
开发者ID:BitMax,项目名称:openitg,代码行数:4,代码来源:RageDisplay.cpp


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