forked from organicmaps/organicmaps-tmp
Billboard render pass removed.
This commit is contained in:
parent
e337f26588
commit
62a01db30d
3 changed files with 11 additions and 58 deletions
|
@ -159,10 +159,6 @@ void Arrow3d::Render(ScreenBase const & screen, ref_ptr<dp::GpuProgramManager> m
|
|||
|
||||
dp::ApplyUniforms(uniforms, prg);
|
||||
|
||||
GLFunctions::glEnable(gl_const::GLDepthTest);
|
||||
GLFunctions::glClearDepth();
|
||||
GLFunctions::glViewport(0, 0, screen.PixelRectIn3d().SizeX(), screen.PixelRectIn3d().SizeY());
|
||||
|
||||
GLFunctions::glBindVertexArray(m_VAO);
|
||||
GLFunctions::glDrawArrays(gl_const::GLTriangles, 0, m_vertices.size() / 3);
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "drape_frontend/user_mark_shapes.hpp"
|
||||
|
||||
#include "drape/debug_rect_renderer.hpp"
|
||||
#include "drape/shader_def.hpp"
|
||||
#include "drape/support_manager.hpp"
|
||||
|
||||
#include "drape/utils/glyph_usage_tracker.hpp"
|
||||
|
@ -44,7 +43,6 @@ FrontendRenderer::FrontendRenderer(Params const & params)
|
|||
, m_routeRenderer(new RouteRenderer())
|
||||
, m_overlayTree(new dp::OverlayTree())
|
||||
, m_enable3dInNavigation(false)
|
||||
, m_isBillboardRenderPass(false)
|
||||
, m_viewport(params.m_viewport)
|
||||
, m_userEventStream(params.m_isCountryLoadedFn)
|
||||
, m_modelViewChangedFn(params.m_modelViewChangedFn)
|
||||
|
@ -718,18 +716,15 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView)
|
|||
GLFunctions::glClear();
|
||||
|
||||
dp::GLState::DepthLayer prevLayer = dp::GLState::GeometryLayer;
|
||||
size_t overlayRenderGroup = 0;
|
||||
for (size_t currentRenderGroup = 0; currentRenderGroup < m_renderGroups.size(); ++currentRenderGroup)
|
||||
size_t currentRenderGroup = 0;
|
||||
for (; currentRenderGroup < m_renderGroups.size(); ++currentRenderGroup)
|
||||
{
|
||||
drape_ptr<RenderGroup> const & group = m_renderGroups[currentRenderGroup];
|
||||
|
||||
dp::GLState const & state = group->GetState();
|
||||
dp::GLState::DepthLayer layer = state.GetDepthLayer();
|
||||
if (prevLayer != layer && layer == dp::GLState::OverlayLayer)
|
||||
{
|
||||
overlayRenderGroup = currentRenderGroup;
|
||||
break;
|
||||
}
|
||||
|
||||
prevLayer = layer;
|
||||
RenderSingleGroup(modelView, make_ref(group));
|
||||
|
@ -753,7 +748,7 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView)
|
|||
m_myPositionController->Render(MyPositionController::RenderAccuracy,
|
||||
modelView, make_ref(m_gpuProgramManager), m_generalUniforms);
|
||||
|
||||
for (size_t currentRenderGroup = overlayRenderGroup; currentRenderGroup < m_renderGroups.size(); ++currentRenderGroup)
|
||||
for (; currentRenderGroup < m_renderGroups.size(); ++currentRenderGroup)
|
||||
{
|
||||
drape_ptr<RenderGroup> const & group = m_renderGroups[currentRenderGroup];
|
||||
RenderSingleGroup(modelView, make_ref(group));
|
||||
|
@ -767,14 +762,11 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView)
|
|||
|
||||
m_routeRenderer->RenderRoute(modelView, make_ref(m_gpuProgramManager), m_generalUniforms);
|
||||
|
||||
if (!isPerspective)
|
||||
for (drape_ptr<UserMarkRenderGroup> const & group : m_userMarkRenderGroups)
|
||||
{
|
||||
for (drape_ptr<UserMarkRenderGroup> const & group : m_userMarkRenderGroups)
|
||||
{
|
||||
ASSERT(group.get() != nullptr, ());
|
||||
if (m_userMarkVisibility.find(group->GetTileKey()) != m_userMarkVisibility.end())
|
||||
RenderSingleGroup(modelView, make_ref(group));
|
||||
}
|
||||
ASSERT(group.get() != nullptr, ());
|
||||
if (m_userMarkVisibility.find(group->GetTileKey()) != m_userMarkVisibility.end())
|
||||
RenderSingleGroup(modelView, make_ref(group));
|
||||
}
|
||||
|
||||
m_routeRenderer->RenderRouteSigns(modelView, make_ref(m_gpuProgramManager), m_generalUniforms);
|
||||
|
@ -782,37 +774,16 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView)
|
|||
m_myPositionController->Render(MyPositionController::RenderMyPosition,
|
||||
modelView, make_ref(m_gpuProgramManager), m_generalUniforms);
|
||||
|
||||
if (!isPerspective && m_guiRenderer != nullptr)
|
||||
m_guiRenderer->Render(make_ref(m_gpuProgramManager), modelView);
|
||||
|
||||
if (isPerspective)
|
||||
if (m_guiRenderer != nullptr)
|
||||
{
|
||||
m_isBillboardRenderPass = true;
|
||||
|
||||
// TODO: Try to avoid code duplicate in billboard render pass.
|
||||
GLFunctions::glDisable(gl_const::GLDepthTest);
|
||||
for (size_t currentRenderGroup = overlayRenderGroup; currentRenderGroup < m_renderGroups.size(); ++currentRenderGroup)
|
||||
{
|
||||
drape_ptr<RenderGroup> const & group = m_renderGroups[currentRenderGroup];
|
||||
RenderSingleGroup(modelView, make_ref(group));
|
||||
}
|
||||
|
||||
for (drape_ptr<UserMarkRenderGroup> const & group : m_userMarkRenderGroups)
|
||||
{
|
||||
ASSERT(group.get() != nullptr, ());
|
||||
group->UpdateAnimation();
|
||||
if (m_userMarkVisibility.find(group->GetTileKey()) != m_userMarkVisibility.end())
|
||||
RenderSingleGroup(modelView, make_ref(group));
|
||||
}
|
||||
|
||||
if (m_guiRenderer != nullptr)
|
||||
if (isPerspective)
|
||||
{
|
||||
ScreenBase modelView2d = modelView;
|
||||
modelView2d.ResetPerspective();
|
||||
m_guiRenderer->Render(make_ref(m_gpuProgramManager), modelView2d);
|
||||
}
|
||||
|
||||
m_isBillboardRenderPass = false;
|
||||
else
|
||||
m_guiRenderer->Render(make_ref(m_gpuProgramManager), modelView);
|
||||
}
|
||||
|
||||
GLFunctions::glEnable(gl_const::GLDepthTest);
|
||||
|
@ -827,20 +798,8 @@ bool FrontendRenderer::IsPerspective() const
|
|||
return m_userEventStream.GetCurrentScreen().isPerspective();
|
||||
}
|
||||
|
||||
bool FrontendRenderer::IsBillboardProgram(int programIndex) const
|
||||
{
|
||||
return programIndex == gpu::TEXTURING_BILLBOARD_PROGRAM
|
||||
|| programIndex == gpu::TEXT_BILLBOARD_PROGRAM
|
||||
|| programIndex == gpu::TEXT_OUTLINED_BILLBOARD_PROGRAM
|
||||
|| programIndex == gpu::BOOKMARK_BILLBOARD_PROGRAM;
|
||||
}
|
||||
|
||||
void FrontendRenderer::RenderSingleGroup(ScreenBase const & modelView, ref_ptr<BaseRenderGroup> group)
|
||||
{
|
||||
if (modelView.isPerspective() &&
|
||||
(m_isBillboardRenderPass != IsBillboardProgram(group->GetState().GetProgram3dIndex())))
|
||||
return;
|
||||
|
||||
group->UpdateAnimation();
|
||||
group->Render(modelView);
|
||||
}
|
||||
|
|
|
@ -212,7 +212,6 @@ private:
|
|||
FeatureID GetVisiblePOI(m2::PointD const & pixelPoint) const;
|
||||
FeatureID GetVisiblePOI(m2::RectD const & pixelRect) const;
|
||||
|
||||
bool IsBillboardProgram(int programIndex) const;
|
||||
bool IsPerspective() const;
|
||||
|
||||
private:
|
||||
|
@ -233,7 +232,6 @@ private:
|
|||
dp::UniformValuesStorage m_generalUniforms;
|
||||
|
||||
bool m_enable3dInNavigation;
|
||||
bool m_isBillboardRenderPass;
|
||||
|
||||
Viewport m_viewport;
|
||||
UserEventStream m_userEventStream;
|
||||
|
|
Loading…
Add table
Reference in a new issue