本文整理汇总了C++中MeshRenderer::GetMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshRenderer::GetMesh方法的具体用法?C++ MeshRenderer::GetMesh怎么用?C++ MeshRenderer::GetMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshRenderer
的用法示例。
在下文中一共展示了MeshRenderer::GetMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Scene::Render( RenderPass renderPass, Viewport* viewport )
{
static Mesh* skyboxMesh = ResourceManager::GetGenMesh(GenMeshes::Cube);
std::string viewportName = viewport != NULL ? viewport->GetName() : "";
bool ignoreShadowCast = true;
if (renderPass == RenderPass::ShadowPass)
{
ignoreShadowCast = false;
}
for (uint rank = 0; rank < m_layers.size(); rank++)
{
if ( !m_layers[rank]->IsEnabled() ) continue;
RenderManager::UseNewLayer(renderPass);
if (rank == 0)
{
if ( m_skyboxMaterial != NULL && renderPass != RenderPass::PickingPass )
{
Transform transform(NULL);
transform.SetPositionWorld( RenderManager::GetRenderCamera()->GetComponent<Transform>()->GetPositionWorld() );
transform.SetScaleWorld( Vector3(m_skyboxSize) );
MeshRenderer renderer;
renderer.SetMaterial(m_skyboxMaterial);
renderer.SetMesh(skyboxMesh);
renderer.SetFaceCulling( FaceCulling::CULL_FRONT );
RenderManager::ObjectToRender objectToRender;
objectToRender.transform = &transform;
objectToRender.meshRenderer = &renderer;
objectToRender.renderPass = renderPass;
RenderManager::RenderObject( objectToRender );
}
GizmoManager::RenderGrid( renderPass );
}
#if (ME3D_SHADING_MODE == ME3D_CLASSIC_SHADING)
if (viewport != NULL && viewport->HasEnableLights() && renderPass != RenderPass::PickingPass)
{
for (uint j = 0; j < m_layers[rank]->GetObjectsCount(); j++)
{
GameObject* obj = m_layers[rank]->GetObjectAt(j);
if (obj->IsFullyActive())
{
Light* lightComp = obj->GetComponent<Light>();
if (lightComp != NULL && lightComp->IsEnabled())
{
RenderManager::ActiveLight activeLight;
activeLight.light = lightComp;
activeLight.transform = obj->GetComponent<Transform>();
RenderManager::AddActiveLight( activeLight );
}
}
}
}
#endif
for (uint j = 0; j < m_layers[rank]->GetObjectsCount(); j++)
{
GameObject* obj = m_layers[rank]->GetObjectAt(j);
if ( !obj->IsIgnoringViewport(viewportName)
&& obj->IsFullyActive() )
{
GizmoManager::RenderFollower( obj, renderPass );
MeshRenderer* renderer = obj->GetComponent<MeshRenderer>();
GuiTexture* guiTexture = obj->GetComponent<GuiTexture>();
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (renderer != NULL &&
renderer->GetMaterial() != NULL &&
renderer->GetMesh() != NULL &&
(ignoreShadowCast || renderer->IsCastingShadows()) )
{
RenderManager::ObjectToRender objectToRender;
objectToRender.uniqueIndex = obj->GetUniqueIndex();
objectToRender.transform = obj->GetComponent<Transform>();
objectToRender.meshRenderer = renderer;
objectToRender.renderPass = renderPass;
RenderManager::RenderObject( objectToRender );
}
//.........这里部分代码省略.........