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


C++ MeshBuilder::AddLine方法代码示例

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


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

示例1: Render

//-----------------------------------------------------------------------------------
void Skeleton::Render() const
{
    if (!m_joints)
    {
        MeshBuilder builder;
        for (const Matrix4x4& modelSpaceMatrix : m_boneToModelSpace)
        {
            builder.AddIcoSphere(1.0f, RGBA::BLUE, 0, modelSpaceMatrix.GetTranslation());
        }
        m_joints = new MeshRenderer(new Mesh(), new Material(new ShaderProgram("Data/Shaders/fixedVertexFormat.vert", "Data/Shaders/fixedVertexFormat.frag"), 
            RenderState(RenderState::DepthTestingMode::OFF, RenderState::FaceCullingMode::RENDER_BACK_FACES, RenderState::BlendMode::ALPHA_BLEND)));
        m_joints->m_material->SetDiffuseTexture(Renderer::instance->m_defaultTexture);
        builder.CopyToMesh(m_joints->m_mesh, &Vertex_PCUTB::Copy, sizeof(Vertex_PCUTB), &Vertex_PCUTB::BindMeshToVAO);
    }
    if (!m_bones)
    {
        MeshBuilder builder;
        for (unsigned int i = 0; i < m_parentIndices.size(); i++)
        {
            int parentIndex = m_parentIndices[i];
            if (parentIndex >= 0)
            {
                builder.AddLine(m_boneToModelSpace[i].GetTranslation(), m_boneToModelSpace[parentIndex].GetTranslation(), RGBA::SEA_GREEN);
            }
        }
        m_bones = new MeshRenderer(new Mesh(), new Material(new ShaderProgram("Data/Shaders/fixedVertexFormat.vert", "Data/Shaders/fixedVertexFormat.frag"),
            RenderState(RenderState::DepthTestingMode::OFF, RenderState::FaceCullingMode::RENDER_BACK_FACES, RenderState::BlendMode::ALPHA_BLEND)));
        m_bones->m_material->SetDiffuseTexture(Renderer::instance->m_defaultTexture);
        builder.CopyToMesh(m_bones->m_mesh, &Vertex_PCUTB::Copy, sizeof(Vertex_PCUTB), &Vertex_PCUTB::BindMeshToVAO);
    }
    m_joints->Render();
    m_bones->Render();
}
开发者ID:picoriley,项目名称:CloudyCraft,代码行数:34,代码来源:Skeleton.cpp


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