本文整理汇总了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();
}
示例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);
}
示例3: PreMultMatrix
void RageDisplay::PreMultMatrix( const RageMatrix &m )
{
g_WorldStack.MultMatrixLocal( m );
}
示例4: SkewX
void RageDisplay::SkewX( float fAmount )
{
g_WorldStack.SkewX( fAmount );
}
示例5: PostMultMatrix
void RageDisplay::PostMultMatrix( const RageMatrix &m )
{
g_WorldStack.MultMatrix( m );
}
示例6: Scale
void RageDisplay::Scale( float x, float y, float z )
{
g_WorldStack.ScaleLocal(x, y, z);
}
示例7: RotateZ
void RageDisplay::RotateZ( float deg )
{
g_WorldStack.RotateZLocal( deg );
}
示例8: PopMatrix
void RageDisplay::PopMatrix()
{
g_WorldStack.Pop();
}
示例9: TranslateWorld
void RageDisplay::TranslateWorld( float x, float y, float z )
{
g_WorldStack.Translate(x, y, z);
}
示例10: GetTextureTop
const RageMatrix* RageDisplay::GetTextureTop()
{
return g_TextureStack.GetTop();
}
示例11: PushMatrix
void RageDisplay::PushMatrix()
{
g_WorldStack.Push();
}
示例12: GetWorldTop
const RageMatrix* RageDisplay::GetWorldTop()
{
return g_WorldStack.GetTop();
}
示例13: GetViewTop
const RageMatrix* RageDisplay::GetViewTop()
{
return g_ViewStack.GetTop();
}
示例14: GetProjectionTop
const RageMatrix* RageDisplay::GetProjectionTop()
{
return g_ProjectionStack.GetTop();
}