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


C++ MatrixStack::Pop方法代码示例

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


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

示例1: DrawWrist

    void DrawWrist(MatrixStack &modelToCameraStack)
    {
        modelToCameraStack.Push();
        modelToCameraStack.Translate(posWrist);
        modelToCameraStack.RotateZ(angWristRoll);
        modelToCameraStack.RotateX(angWristPitch);

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

        DrawFingers(modelToCameraStack);

        modelToCameraStack.Pop();
    }
开发者ID:captainadamo,项目名称:glfw_gltut,代码行数:17,代码来源:Hierarchy.cpp

示例2: DrawLowerArm

    void DrawLowerArm(MatrixStack &modelToCameraStack)
    {
        modelToCameraStack.Push();
        modelToCameraStack.Translate(posLowerArm);
        modelToCameraStack.RotateX(angLowerArm);

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

        DrawWrist(modelToCameraStack);

        modelToCameraStack.Pop();
    }
开发者ID:captainadamo,项目名称:glfw_gltut,代码行数:17,代码来源:Hierarchy.cpp

示例3: DrawUpperArm

    void DrawUpperArm(MatrixStack &modelToCameraStack)
    {
        modelToCameraStack.Push();
        modelToCameraStack.RotateX(angUpperArm);

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

        DrawLowerArm(modelToCameraStack);

        modelToCameraStack.Pop();
    }
开发者ID:captainadamo,项目名称:glfw_gltut,代码行数:18,代码来源:Hierarchy.cpp

示例4: MatrixStackTest

void GeometryTest::MatrixStackTest()
{
    MatrixStack matrixStack;
    CPPUNIT_ASSERT(matrixStack.stack.size() == 1);
    
    Matrix4f m1;
    m1 << 1.0f, 0.0f, 0.0f, 4.0f,
          0.0f, 1.0f, 0.0f, 4.0f,
          0.0f, 0.0f, 1.0f, 0.0f,
          0.0f, 0.0f, 0.0f, 1.0f;
    Matrix4f m2;
    m2 << 1.0f, 0.0f, 0.0f, 5.0f,
          0.0f, 1.0f, 0.0f, 5.0f,
          0.0f, 0.0f, 1.0f, 0.0f,
          0.0f, 0.0f, 0.0f, 1.0f;

    matrixStack.Push(m1);
    CPPUNIT_ASSERT(matrixStack.stack.size() == 2);
    CPPUNIT_ASSERT(matrixStack.GetTop() == m1);

    matrixStack.Push(m2);
    CPPUNIT_ASSERT(matrixStack.stack.size() == 3);
    CPPUNIT_ASSERT(matrixStack.GetTop() == m2);

    matrixStack.Push(m1);
    CPPUNIT_ASSERT(matrixStack.stack.size() == 4);
    CPPUNIT_ASSERT(matrixStack.GetTop() == m1);

    matrixStack.MultiplyWithTop(m2);
    CPPUNIT_ASSERT(matrixStack.stack.size() == 4);
    CPPUNIT_ASSERT(matrixStack.GetTop() == (m1 * m2));

    matrixStack.Pop();
    CPPUNIT_ASSERT(matrixStack.stack.size() == 3);

    matrixStack.Pop();
    CPPUNIT_ASSERT(matrixStack.stack.size() == 2);

    matrixStack.Pop();
    CPPUNIT_ASSERT(matrixStack.stack.size() == 1);

    matrixStack.Pop();
    CPPUNIT_ASSERT(matrixStack.stack.size() == 0);
}
开发者ID:Asido,项目名称:Tamagotchi,代码行数:44,代码来源:GeometryTest.cpp

示例5: 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:captainadamo,项目名称:glfw_gltut,代码行数:36,代码来源:Hierarchy.cpp

示例6: Draw

	/* Draw instances */
	void Map::Draw(MatrixStack& matrixStack, GLuint uniformLocation) const {
		GLfloat cubeSize = Cube::m_size;
		matrixStack.Push();
			matrixStack.Scale(glm::vec3(cubeSize));
			glUniformMatrix4fv(uniformLocation, 1, GL_FALSE, glm::value_ptr(matrixStack.Top()));
		matrixStack.Pop();
		
		for(size_t i=0; i<m_instanceDatas.size(); ++i) {
			glBindTexture(GL_TEXTURE_2D,std::get<1>(m_instanceDatas[i]));
			glBindVertexArray(std::get<0>(m_instanceDatas[i]));
			glDrawArraysInstanced(GL_TRIANGLES, 0, Cube::m_tmpNbVertices, std::get<2>(m_instanceDatas[i]));
			glBindVertexArray(0);
			glBindTexture(GL_TEXTURE_2D,0);
			//std::cout << "instance["<<i<<"] = " << std::get<2>(instanceDatas[i]);
		}
	}
开发者ID:Elfhir,项目名称:minecraft,代码行数:17,代码来源:Map.cpp

示例7: 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:captainadamo,项目名称:glfw_gltut,代码行数:62,代码来源:Hierarchy.cpp

示例8: CameraPopMatrix

void RageDisplay::CameraPopMatrix()
{
	g_ProjectionStack.Pop();
	g_ViewStack.Pop();
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:5,代码来源:RageDisplay.cpp

示例9: TexturePopMatrix

void RageDisplay::TexturePopMatrix() 
{ 
	g_TextureStack.Pop();
}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:4,代码来源:RageDisplay.cpp

示例10: PopMatrix

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


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