forked from organicmaps/organicmaps
[drape] resize message will send only to frontend renderer
This commit is contained in:
parent
51ed0b0a9f
commit
16fe5cdc48
7 changed files with 32 additions and 32 deletions
|
@ -69,9 +69,6 @@ namespace df
|
|||
PostToRenderThreads(MovePointer<Message>(new DropTilesMessage(descr)));
|
||||
}
|
||||
break;
|
||||
case Message::Resize:
|
||||
m_readManager->Resize(static_cast<ResizeMessage *>(message.GetRaw())->GetRect());
|
||||
break;
|
||||
case Message::TileReadStarted:
|
||||
case Message::TileReadEnded:
|
||||
case Message::MapShapeReaded:
|
||||
|
|
|
@ -26,8 +26,6 @@ namespace df
|
|||
|
||||
void DrapeEngine::OnSizeChanged(int x0, int y0, int w, int h)
|
||||
{
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
MovePointer<Message>(new ResizeMessage(x0, y0, w, h)));
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
|
||||
MovePointer<Message>(new ResizeMessage(x0, y0, w, h)));
|
||||
}
|
||||
|
|
|
@ -26,7 +26,12 @@ namespace df
|
|||
|
||||
m_commutator->RegisterThread(ThreadsCommutator::RenderThread, this);
|
||||
RefreshProjection(viewport.GetWidth(), viewport.GetHeight());
|
||||
RefreshModelView(0);
|
||||
|
||||
m_modelView.OnSize(viewport.GetX0(), viewport.GetY0(), viewport.GetWidth(), viewport.GetHeight());
|
||||
m2::RectD rect(-174, -95, 174, 95);
|
||||
m_modelView.SetFromRect(m2::AnyRectD(m2::PointD(0, 0), ang::AngleD(0), rect));
|
||||
|
||||
RefreshModelView();
|
||||
StartThread();
|
||||
}
|
||||
|
||||
|
@ -107,21 +112,24 @@ namespace df
|
|||
case Message::Resize:
|
||||
{
|
||||
ResizeMessage * rszMsg = static_cast<ResizeMessage *>(message.GetRaw());
|
||||
RefreshProjection(rszMsg->GetRect().SizeX(), rszMsg->GetRect().SizeY());
|
||||
m2::RectI const & rect = rszMsg->GetRect();
|
||||
int32_t sizeX = rect.SizeX();
|
||||
int32_t sizeY = rect.SizeY();
|
||||
m_modelView.OnSize(0, 0, sizeX, sizeY);
|
||||
RefreshProjection(sizeX, sizeY);
|
||||
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
MovePointer<Message>(new UpdateCoverageMessage(m_modelView)));
|
||||
break;
|
||||
}
|
||||
|
||||
case Message::Rotate:
|
||||
{
|
||||
RotateMessage * rtMsg = static_cast<RotateMessage *>(message.GetRaw());
|
||||
RefreshModelView(rtMsg->GetDstAngle());
|
||||
|
||||
ScreenBase screen(m2::RectI(0, 0, m_viewport.GetWidth(), m_viewport.GetHeight()),
|
||||
m2::AnyRectD(m2::PointD(0, 0), ang::AngleD(rtMsg->GetDstAngle()),
|
||||
m2::RectD(0 ,0, 50, 50)));
|
||||
m_modelView.Rotate(rtMsg->GetDstAngle());
|
||||
RefreshModelView();
|
||||
|
||||
m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread,
|
||||
MovePointer<Message>(new UpdateCoverageMessage(screen)));
|
||||
MovePointer<Message>(new UpdateCoverageMessage(m_modelView)));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -178,19 +186,19 @@ namespace df
|
|||
m_generalUniforms.SetMatrix4x4Value("projection", m);
|
||||
}
|
||||
|
||||
void FrontendRenderer::RefreshModelView(float radians)
|
||||
void FrontendRenderer::RefreshModelView()
|
||||
{
|
||||
float c = cos(radians);
|
||||
float s = sin(radians);
|
||||
float model[16] =
|
||||
{
|
||||
c, -s, 0.0, 0.0,
|
||||
s, c, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0
|
||||
};
|
||||
ScreenBase::MatrixT const & m = m_modelView.GtoPMatrix();
|
||||
math::Matrix<float, 4, 4> mv;
|
||||
|
||||
m_generalUniforms.SetMatrix4x4Value("modelView", model);
|
||||
/// preparing ModelView matrix
|
||||
|
||||
mv(0, 0) = m(0, 0); mv(0, 1) = m(1, 0); mv(0, 2) = 0; mv(0, 3) = m(2, 0);
|
||||
mv(1, 0) = m(0, 1); mv(1, 1) = m(1, 1); mv(1, 2) = 0; mv(1, 3) = m(2, 1);
|
||||
mv(2, 0) = 0; mv(2, 1) = 0; mv(2, 2) = 1; mv(2, 3) = 0;
|
||||
mv(3, 0) = m(0, 2); mv(3, 1) = m(1, 2); mv(3, 2) = 0; mv(3, 3) = m(2, 2);
|
||||
|
||||
m_generalUniforms.SetMatrix4x4Value("modelView", mv.m_data);
|
||||
}
|
||||
|
||||
void FrontendRenderer::RenderPartImpl(pair<const GLState, MasterPointer<VertexArrayBuffer> > & node)
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "../drape/uniform_values_storage.hpp"
|
||||
|
||||
#include "../geometry/screenbase.hpp"
|
||||
|
||||
#include "../std/map.hpp"
|
||||
|
||||
namespace df
|
||||
|
@ -55,7 +57,7 @@ namespace df
|
|||
private:
|
||||
void RenderScene();
|
||||
void RefreshProjection(int w, int h);
|
||||
void RefreshModelView(float radians);
|
||||
void RefreshModelView();
|
||||
|
||||
void RenderPartImpl(pair<const GLState, MasterPointer<VertexArrayBuffer> > & node);
|
||||
|
||||
|
@ -87,5 +89,6 @@ namespace df
|
|||
|
||||
UniformValuesStorage m_generalUniforms;
|
||||
Viewport m_viewport;
|
||||
ScreenBase m_modelView;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -90,11 +90,6 @@ namespace df
|
|||
m_currentViewport = screen;
|
||||
}
|
||||
|
||||
void ReadManager::Resize(const m2::RectI & rect)
|
||||
{
|
||||
m_currentViewport.OnSize(rect);
|
||||
}
|
||||
|
||||
void ReadManager::Stop()
|
||||
{
|
||||
for_each(m_tileInfos.begin(), m_tileInfos.end(), bind(&ReadManager::CancelTileInfo, this, _1));
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace df
|
|||
ReadManager(EngineContext & context, model::FeaturesFetcher & model);
|
||||
|
||||
void UpdateCoverage(ScreenBase const & screen, CoverageUpdateDescriptor & updateDescr);
|
||||
void Resize(m2::RectI const & rect);
|
||||
void Stop();
|
||||
|
||||
static size_t ReadCount();
|
||||
|
|
|
@ -8,7 +8,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
: QMainWindow(parent)
|
||||
, m_surface(NULL)
|
||||
{
|
||||
resize(600, 400);
|
||||
resize(1200, 800);
|
||||
DrapeSurface * surface = new DrapeSurface();
|
||||
m_surface = QWidget::createWindowContainer(surface, this);
|
||||
setCentralWidget(m_surface);
|
||||
|
|
Loading…
Add table
Reference in a new issue