Commit 7ff24056 authored by Jack Andersen's avatar Jack Andersen

Mechanism for handling device-coordinate transformation

parent 8653be54
......@@ -122,7 +122,7 @@ public:
View::setMultiplyColor(color);
m_viewVertBlock.m_color = color;
if (m_viewVertBlockBuf)
m_viewVertBlockBuf.access() = m_viewVertBlock;
m_viewVertBlockBuf.access().finalAssign(m_viewVertBlock);
m_text->setMultiplyColor(color);
if (m_icon)
m_icon->setMultiplyColor(color);
......
......@@ -104,7 +104,7 @@ public:
{
View::setMultiplyColor(color);
m_splitBlock.m_color = color;
m_splitBlockBuf.access() = m_splitBlock;
m_splitBlockBuf.access().finalAssign(m_splitBlock);
if (m_views[0].m_view)
m_views[0].m_view->setMultiplyColor(color);
......
......@@ -117,7 +117,7 @@ public:
View::setMultiplyColor(color);
m_viewVertBlock.m_color = color;
if (m_viewVertBlockBuf)
m_viewVertBlockBuf.access() = m_viewVertBlock;
m_viewVertBlockBuf.access().finalAssign(m_viewVertBlock);
m_text->setMultiplyColor(color);
if (m_errText)
m_errText->setMultiplyColor(color);
......
......@@ -16,6 +16,8 @@ class IThemeData;
class ViewResources;
class RootView;
extern zeus::CMatrix4f g_PlatformMatrix;
class RectangleConstraint
{
public:
......@@ -101,6 +103,11 @@ public:
m_mv[3][0] = sub.location[0] * m_mv[0][0] - 1.0f;
m_mv[3][1] = sub.location[1] * m_mv[1][1] - 1.0f;
}
void finalAssign(const ViewBlock& other)
{
m_mv = g_PlatformMatrix * other.m_mv;
m_color = other.m_color;
}
};
template <typename VertStruct>
......@@ -222,7 +229,7 @@ public:
{
m_viewVertBlock.m_color = color;
if (m_viewVertBlockBuf)
m_viewVertBlockBuf.access() = m_viewVertBlock;
m_viewVertBlockBuf.access().finalAssign(m_viewVertBlock);
}
virtual int nominalWidth() const {return 0;}
......
......@@ -453,7 +453,7 @@ void ModalWindow::resized(const boo::SWindowRect& root, const boo::SWindowRect&
centerRect.location[1] = root.size[1] / 2 - m_height / 2.0;
View::resized(root, centerRect);
m_viewBlock.setViewRect(root, centerRect);
m_viewBlockBuf.access() = m_viewBlock;
m_viewBlockBuf.access().finalAssign(m_viewBlock);
setLineVerts(m_width, m_height, pf, m_lineTime);
setFillVerts(m_width, m_height, pf);
......
......@@ -111,7 +111,7 @@ void RootView::SplitMenuSystem::setArrowVerts(const boo::SWindowRect& rect, Spli
m_viewBlock.m_mv[3][1] = 2.0f * (rect.location[1] + (dir == SplitView::ArrowDir::Down ? rect.size[1] : 0)) /
float(root.size[1]) - 1.0f;
}
m_viewVertBlockBuf.access() = m_viewBlock;
m_viewVertBlockBuf.access().finalAssign(m_viewBlock);
}
void RootView::SplitMenuSystem::setLineVerts(const boo::SWindowRect& rect, float split, SplitView::Axis axis)
......@@ -135,7 +135,7 @@ void RootView::SplitMenuSystem::setLineVerts(const boo::SWindowRect& rect, float
m_viewBlock.m_mv[3][0] = (rect.location[0] + split * rect.size[0]) * m_viewBlock.m_mv[0][0] - 1.0f;
m_viewBlock.m_mv[3][1] = 2.0f * (rect.location[1] + rect.size[1] / 2.0f) / float(root.size[1]) - 1.0f;
}
m_viewVertBlockBuf.access() = m_viewBlock;
m_viewVertBlockBuf.access().finalAssign(m_viewBlock);
}
void RootView::destroyed()
......
......@@ -476,7 +476,7 @@ void SplitView::resized(const boo::SWindowRect& root, const boo::SWindowRect& su
m_splitBlock.setViewRect(root, ssub);
setVerticalVerts(ssub.size[1]);
}
m_splitBlockBuf.access() = m_splitBlock;
m_splitBlockBuf.access().finalAssign(m_splitBlock);
m_splitVertsBinding.load<decltype(m_splitVerts)>(m_splitVerts);
}
......
......@@ -140,7 +140,7 @@ void Toolbar::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
setHorizontalVerts(sub.size[0]);
m_vertsBinding.load<decltype(m_tbVerts)>(m_tbVerts);
m_tbBlock.setViewRect(root, sub);
m_tbBlockBuf.access() = m_tbBlock;
m_tbBlockBuf.access().finalAssign(m_tbBlock);
float gaugeUnit = rootView().viewRes().pixelFactor() * SPECTER_TOOLBAR_GAUGE;
float yOff = 0.0;
......
......@@ -84,7 +84,7 @@ void Tooltip::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
float pf = rootView().viewRes().pixelFactor();
setVerts(m_nomWidth, m_nomHeight, pf);
m_ttBlock.setViewRect(root, sub);
m_ttBlockBuf.access() = m_ttBlock;
m_ttBlockBuf.access().finalAssign(m_ttBlock);
std::pair<int,int> margin = m_cornersFilled[0]->queryGlyphDimensions(0);
......
......@@ -7,8 +7,18 @@ namespace specter
{
static logvisor::Module Log("specter::View");
zeus::CMatrix4f g_PlatformMatrix;
void View::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme)
{
switch (ctx.platform())
{
case boo::IGraphicsDataFactory::Platform::Vulkan:
g_PlatformMatrix.m[1][1] = -1.f;
break;
default:
break;
}
m_solidShader = hecl::conv->convert(ctx, Shader_SpecterViewShaderSolid{});
m_texShader = hecl::conv->convert(ctx, Shader_SpecterViewShaderTex{});
}
......@@ -41,7 +51,7 @@ void View::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
m_bgRect[2].m_pos.assign(sub.size[0], sub.size[1], 0.f);
m_bgRect[3].m_pos.assign(sub.size[0], 0.f, 0.f);
if (m_viewVertBlockBuf)
m_viewVertBlockBuf.access() = m_viewVertBlock;
m_viewVertBlockBuf.access().finalAssign(m_viewVertBlock);
m_bgVertsBinding.load<decltype(m_bgRect)>(m_bgRect);
}
......@@ -53,7 +63,7 @@ void View::resized(const ViewBlock& vb, const boo::SWindowRect& sub)
m_bgRect[2].m_pos.assign(sub.size[0], sub.size[1], 0.f);
m_bgRect[3].m_pos.assign(sub.size[0], 0.f, 0.f);
if (m_viewVertBlockBuf)
m_viewVertBlockBuf.access() = vb;
m_viewVertBlockBuf.access().finalAssign(vb);
m_bgVertsBinding.load<decltype(m_bgRect)>(m_bgRect);
}
......
......@@ -39,7 +39,6 @@ void main()
vtf.uv = uvIn[gl_VertexID];
vtf.color = colorIn * mulColor;
gl_Position = mv * mvMtx * vec4(pos, 1.0);
gl_Position = FLIPFROMGL(gl_Position);
}
#fragment glsl
......
......@@ -23,7 +23,6 @@ void main()
{
vtf.color = colorIn * mulColor;
gl_Position = mv * vec4(posIn, 1.0);
gl_Position = FLIPFROMGL(gl_Position);
}
#fragment glsl
......@@ -125,7 +124,6 @@ void main()
vtf.uv.xy = uvIn;
vtf.color = mulColor;
gl_Position = mv * vec4(posIn, 1.0);
gl_Position = FLIPFROMGL(gl_Position);
}
#fragment glsl
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment