Rendering poi, bookmarks and straight text with ortho view in 3d mode.

Conflicts:
	drape_frontend/frontend_renderer.cpp
	drape_frontend/render_group.cpp
This commit is contained in:
Daria Volvenkova 2015-10-20 17:58:03 +03:00
parent 02ef5bf592
commit 3a0d040353
14 changed files with 336 additions and 109 deletions

View file

@ -16,3 +16,7 @@ ROUTE_PROGRAM route_vertex_shader.vsh route_fragment_shader.fsh
ROUTE_ARROW_PROGRAM route_vertex_shader.vsh route_arrow_fragment_shader.fsh
DEBUG_RECT_PROGRAM debug_rect_vertex_shader.vsh debug_rect_fragment_shader.fsh
TEXTURING_3D_PROGRAM texturing3d_vertex_shader.vsh texturing3d_fragment_shader.fsh
TEXTURING_SPRITE_PROGRAM texturing_sprite_vertex_shader.vsh texturing_fragment_shader.fsh
TEXT_OUTLINED_SPRITE_PROGRAM text_outlined_sprite_vertex_shader.vsh text_fragment_shader.fsh
TEXT_SPRITE_PROGRAM text_sprite_vertex_shader.vsh text_fragment_shader.fsh
BOOKMARK_SPRITE_PROGRAM user_mark_sprite.vsh texturing_fragment_shader.fsh

View file

@ -0,0 +1,51 @@
attribute vec4 a_position;
attribute vec2 a_normal;
attribute vec2 a_colorTexCoord;
attribute vec2 a_outlineColorTexCoord;
attribute vec2 a_maskTexCoord;
uniform mat4 modelView;
uniform mat4 projection;
uniform mat4 pivotTransform;
uniform float u_isOutlinePass;
#ifdef ENABLE_VTF
uniform sampler2D u_colorTex;
varying lowp vec4 v_color;
#else
varying vec2 v_colorTexCoord;
#endif
varying vec2 v_maskTexCoord;
const float Zero = 0.0;
const float One = 1.0;
const float BaseDepthShift = -10.0;
void main()
{
float isOutline = step(0.5, u_isOutlinePass);
float notOutline = One - isOutline;
float depthShift = BaseDepthShift * isOutline;
// Here we intentionally decrease precision of 'pos' calculation
// to eliminate jittering effect in process of billboard reconstruction.
lowp vec4 pivot = (a_position + vec4(Zero, Zero, depthShift, Zero)) * modelView;
vec4 offset = vec4(a_normal, Zero, Zero);
pivot = pivot * projection;
offset = offset * projection;
gl_Position = pivotTransform * vec4(pivot.xy, Zero, One);
vec4 scale = pivotTransform * vec4(One, -One, Zero, One);
gl_Position = gl_Position + vec4(offset.xy * gl_Position.w / scale.w * scale.x, Zero, Zero);
vec2 colorTexCoord = a_colorTexCoord * notOutline + a_outlineColorTexCoord * isOutline;
#ifdef ENABLE_VTF
v_color = texture2D(u_colorTex, colorTexCoord);
#else
v_colorTexCoord = colorTexCoord;
#endif
v_maskTexCoord = a_maskTexCoord;
}

View file

@ -0,0 +1,44 @@
attribute vec4 a_position;
attribute vec2 a_normal;
attribute vec2 a_colorTexCoord;
attribute vec2 a_maskTexCoord;
uniform mat4 modelView;
uniform mat4 projection;
uniform mat4 pivotTransform;
uniform float u_isOutlinePass;
#ifdef ENABLE_VTF
uniform sampler2D u_colorTex;
varying lowp vec4 v_color;
#else
varying vec2 v_colorTexCoord;
#endif
varying vec2 v_maskTexCoord;
const float Zero = 0.0;
const float One = 1.0;
void main()
{
// Here we intentionally decrease precision of 'pivot' calculation
// to eliminate jittering effect in process of billboard reconstruction.
lowp vec4 pivot = a_position * modelView;
vec4 offset = vec4(a_normal, Zero, Zero);
pivot = pivot * projection;
offset = offset * projection;
gl_Position = pivotTransform * vec4(pivot.xy, Zero, One);
vec4 scale = pivotTransform * vec4(One, -One, Zero, One);
gl_Position = gl_Position + vec4(offset.xy * gl_Position.w / scale.w * scale.x, Zero, Zero);
#ifdef ENABLE_VTF
v_color = texture2D(u_colorTex, a_colorTexCoord);
#else
v_colorTexCoord = a_colorTexCoord;
#endif
v_maskTexCoord = a_maskTexCoord;
}

View file

@ -1,16 +1,13 @@
attribute vec2 a_pos;
attribute vec2 a_tcoord;
uniform mat4 rotate;
uniform mat4 translate;
uniform mat4 projection;
uniform mat4 m_transform;
varying vec2 v_tcoord;
void main()
{
v_tcoord = a_tcoord;
gl_Position = projection * translate * rotate * vec4(a_pos, 0.0, 1.0);
gl_Position = m_transform * vec4(a_pos, 0.0, 1.0);
}

View file

@ -0,0 +1,27 @@
attribute vec3 a_position;
attribute vec2 a_normal;
attribute vec2 a_colorTexCoords;
uniform mat4 modelView;
uniform mat4 projection;
uniform mat4 pivotTransform;
varying vec2 v_colorTexCoords;
void main(void)
{
// Here we intentionally decrease precision of 'pivot' calculation
// to eliminate jittering effect in process of billboard reconstruction.
lowp vec4 pivot = vec4(a_position, 1) * modelView;
vec4 offset = vec4(a_normal, 0, 0);
pivot = pivot * projection;
offset = offset * projection;
gl_Position = pivotTransform * vec4(pivot.xy, 0, 1);
vec4 scale = pivotTransform * vec4(1.0, -1.0, 0, 1.0);
gl_Position = gl_Position + vec4(offset.xy * gl_Position.w / scale.w * scale.x, 0, 0);
v_colorTexCoords = a_colorTexCoords;
}

View file

@ -0,0 +1,31 @@
attribute vec3 a_position;
attribute vec2 a_normal;
attribute vec2 a_colorTexCoords;
attribute float a_animate;
uniform mat4 modelView;
uniform mat4 projection;
uniform mat4 pivotTransform;
uniform float u_interpolationT;
varying vec2 v_colorTexCoords;
void main(void)
{
vec2 normal = a_normal;
if (a_animate > 0.0)
normal = u_interpolationT * normal;
vec4 pivot = vec4(a_position.xyz, 1) * modelView;
vec4 offset = vec4(normal, 0, 0);
pivot = pivot * projection;
offset = offset * projection;
gl_Position = pivotTransform * vec4(pivot.xy, 0, 1);
vec4 scale = pivotTransform * vec4(1.0, -1.0, 0, 1.0);
gl_Position = gl_Position + vec4(offset.xy * gl_Position.w / scale.w * scale.x, 0, 0);
v_colorTexCoords = a_colorTexCoords;
}

View file

@ -8,6 +8,7 @@
#include "drape_frontend/renderer3d.hpp"
#include "drape/debug_rect_renderer.hpp"
#include "drape/shader_def.hpp"
#include "drape/support_manager.hpp"
#include "drape/utils/glyph_usage_tracker.hpp"
@ -45,7 +46,8 @@ FrontendRenderer::FrontendRenderer(Params const & params)
, m_routeRenderer(new RouteRenderer())
, m_overlayTree(new dp::OverlayTree())
, m_useFramebuffer(false)
, m_3dModeChanged(false)
, m_isSpriteRenderPass(false)
, m_3dModeChanged(true)
, m_framebuffer(new Framebuffer())
, m_renderer3d(new Renderer3d())
, m_viewport(params.m_viewport)
@ -464,20 +466,26 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
}
case Message::Enable3dMode:
{
ref_ptr<Enable3dModeMessage> msg = message;
m_renderer3d->SetVerticalFOV(msg->GetAngleFOV());
m_renderer3d->SetPlaneAngleX(msg->GetAngleX());
m_useFramebuffer = true;
m_3dModeChanged = true;
AddUserEvent(Enable3dModeEvent(max(m_renderer3d->GetScaleX(), m_renderer3d->GetScaleY())));
if (!m_useFramebuffer)
{
ref_ptr<Enable3dModeMessage> msg = message;
m_renderer3d->SetVerticalFOV(msg->GetAngleFOV());
m_renderer3d->SetPlaneAngleX(msg->GetAngleX());
m_useFramebuffer = true;
m_3dModeChanged = true;
AddUserEvent(Enable3dModeEvent(max(m_renderer3d->GetScaleX(), m_renderer3d->GetScaleY())));
}
break;
}
case Message::Disable3dMode:
{
m_useFramebuffer = false;
m_3dModeChanged = true;
AddUserEvent(Disable3dMode(false));
if (m_useFramebuffer)
{
m_useFramebuffer = false;
m_3dModeChanged = true;
AddUserEvent(Disable3dMode(false));
}
break;
}
@ -522,6 +530,8 @@ void FrontendRenderer::OnResize(ScreenBase const & screen)
m_renderer3d->SetSize(m_pixelRect.SizeX(), m_pixelRect.SizeY());
m_framebuffer->SetDefaultContext(m_contextFactory->getDrawContext());
m_framebuffer->SetSize(width, height);
RefreshPivotTransform();
}
}
@ -784,6 +794,24 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView)
{
m_framebuffer->Disable();
m_renderer3d->Render(m_framebuffer->GetTextureId(), make_ref(m_gpuProgramManager));
// Test code to check ortho overlays in 3d mode
m_isSpriteRenderPass = true;
GLFunctions::glDisable(gl_const::GLDepthTest);
for (currentRenderGroup = 0; 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));
}
m_isSpriteRenderPass = false;
// End of test code
}
GLFunctions::glEnable(gl_const::GLDepthTest);
@ -793,8 +821,23 @@ void FrontendRenderer::RenderScene(ScreenBase const & modelView)
#endif
}
bool FrontendRenderer::IsSpriteProgram(int programIndex) const
{
return programIndex == gpu::TEXTURING_SPRITE_PROGRAM
|| programIndex == gpu::TEXT_SPRITE_PROGRAM
|| programIndex == gpu::TEXT_OUTLINED_SPRITE_PROGRAM
|| programIndex == gpu::BOOKMARK_SPRITE_PROGRAM;
}
void FrontendRenderer::RenderSingleGroup(ScreenBase const & modelView, ref_ptr<BaseRenderGroup> group)
{
dp::GLState const & state = group->GetState();
bool isSpriteProgram = IsSpriteProgram(state.GetProgramIndex());
if ((m_isSpriteRenderPass && !isSpriteProgram) ||
(m_useFramebuffer && !m_isSpriteRenderPass && isSpriteProgram))
return;
group->UpdateAnimation();
group->Render(modelView);
}
@ -822,6 +865,14 @@ void FrontendRenderer::RefreshModelView(ScreenBase const & screen)
m_generalUniforms.SetMatrix4x4Value("modelView", mv.m_data);
}
void FrontendRenderer::RefreshPivotTransform()
{
if (m_useFramebuffer)
m_generalUniforms.SetMatrix4x4Value("pivotTransform", m_renderer3d->GetTransform().m_data);
else
m_generalUniforms.SetMatrix4x4Value("pivotTransform", math::Identity<float, 4>().m_data);
}
void FrontendRenderer::RefreshBgColor()
{
uint32_t color = drule::rules().GetBgColor(df::GetDrawTileScale(m_userEventStream.GetCurrentScreen()));
@ -1175,6 +1226,7 @@ void FrontendRenderer::PrepareScene(ScreenBase const & modelView)
{
RefreshModelView(modelView);
RefreshBgColor();
RefreshPivotTransform();
}
void FrontendRenderer::UpdateScene(ScreenBase const & modelView)

View file

@ -140,6 +140,7 @@ private:
void RenderSingleGroup(ScreenBase const & modelView, ref_ptr<BaseRenderGroup> group);
void RefreshProjection();
void RefreshModelView(ScreenBase const & screen);
void RefreshPivotTransform();
void RefreshBgColor();
ScreenBase const & ProcessEvents(bool & modelViewChanged, bool & viewportChanged);
@ -209,6 +210,8 @@ private:
FeatureID GetVisiblePOI(m2::PointD const & pixelPoint) const;
FeatureID GetVisiblePOI(m2::RectD const & pixelRect) const;
bool IsSpriteProgram(int programIndex) const;
private:
drape_ptr<dp::GpuProgramManager> m_gpuProgramManager;
@ -227,6 +230,7 @@ private:
dp::UniformValuesStorage m_generalUniforms;
bool m_useFramebuffer;
bool m_isSpriteRenderPass;
bool m_3dModeChanged;
drape_ptr<Framebuffer> m_framebuffer;
drape_ptr<Renderer3d> m_renderer3d;

View file

@ -43,7 +43,7 @@ void PoiSymbolShape::Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManag
glsl::vec2(texRect.maxX(), texRect.minY())},
};
dp::GLState state(gpu::TEXTURING_PROGRAM, dp::GLState::OverlayLayer);
dp::GLState state(gpu::TEXTURING_SPRITE_PROGRAM, dp::GLState::OverlayLayer);
state.SetColorTexture(region.GetTexture());
state.SetTextureFilter(gl_const::GLNearest);

View file

@ -75,7 +75,8 @@ void RenderGroup::Render(ScreenBase const & screen)
auto const & params = df::VisualParams::Instance().GetGlyphVisualParams();
int programIndex = m_state.GetProgramIndex();
if (programIndex == gpu::TEXT_OUTLINED_PROGRAM)
if (programIndex == gpu::TEXT_OUTLINED_PROGRAM ||
programIndex == gpu::TEXT_OUTLINED_SPRITE_PROGRAM)
{
m_uniforms.SetFloatValue("u_contrastGamma", params.m_outlineContrast, params.m_outlineGamma);
m_uniforms.SetFloatValue("u_isOutlinePass", 1.0f);
@ -90,7 +91,8 @@ void RenderGroup::Render(ScreenBase const & screen)
for(auto & renderBucket : m_renderBuckets)
renderBucket->Render(screen);
}
else if(programIndex == gpu::TEXT_PROGRAM)
else if (programIndex == gpu::TEXT_PROGRAM ||
programIndex == gpu::TEXT_SPRITE_PROGRAM)
{
m_uniforms.SetFloatValue("u_contrastGamma", params.m_contrast, params.m_gamma);
dp::ApplyUniforms(m_uniforms, m_shader);

View file

@ -17,11 +17,14 @@ Renderer3d::Renderer3d()
, m_height(0)
, m_fov(M_PI / 3.0f)
, m_angleX(-M_PI_4)
, m_offsetZ(0.0f)
, m_offsetY(0.0f)
, m_offsetX(0.0f)
, m_offsetZ(0.0f)
, m_scaleX(1.0)
, m_scaleY(1.0)
, m_scaleMatrix(math::Zero<float, 4>())
, m_rotationMatrix(math::Zero<float, 4>())
, m_translationMatrix(math::Zero<float, 4>())
, m_projectionMatrix(math::Zero<float, 4>())
, m_VAO(0)
, m_bufferId(0)
{
@ -42,57 +45,11 @@ void Renderer3d::SetSize(uint32_t width, uint32_t height)
{
m_width = width;
m_height = height;
UpdateProjectionMatrix();
}
void Renderer3d::SetVerticalFOV(float fov)
math::Matrix<float, 4, 4> const & Renderer3d::GetTransform() const
{
m_fov = fov;
CalculateGeometry();
UpdateProjectionMatrix();
}
void Renderer3d::CalculateGeometry()
{
m_offsetZ = 1 / tan(m_fov / 2.0) + sin(-m_angleX);
m_offsetY = -1 + cos(-m_angleX);
m_scaleY = cos(-m_angleX) + sin(-m_angleX) * tan(m_fov / 2.0 - m_angleX);
m_scaleX = 1.0 + 2*sin(-m_angleX) * cos(m_fov / 2.0) / (m_offsetZ * cos(m_fov / 2.0 - m_angleX));
m_scaleX = m_scaleY;
/*
const float vertices[] =
{
-1.0f, 1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
-1.0f, -1.0f, 0.0f, 0.0f,
1.0f, -1.0f, 1.0f, 0.0f
};
*/
m_vertices[0] = -1.0f * m_scaleX;
m_vertices[1] = 2.0f * m_scaleY - 1.0f;
m_vertices[2] = 0.0f;
m_vertices[3] = 1.0f;
m_vertices[4] = 1.0f * m_scaleX;
m_vertices[5] = 2.0f * m_scaleY - 1.0f;
m_vertices[6] = 1.0f;
m_vertices[7] = 1.0f;
m_vertices[8] = -1.0f * m_scaleX;
m_vertices[9] = -1.0f;
m_vertices[10] = 0.0f;
m_vertices[11] = 0.0f;
m_vertices[12] = 1.0f * m_scaleX;
m_vertices[13] = -1.0f;
m_vertices[14] = 1.0f;
m_vertices[15] = 0.0f;
UpdateRotationMatrix();
UpdateTranslationMatrix();
return m_transformMatrix;
}
float Renderer3d::GetScaleX() const
@ -111,6 +68,60 @@ void Renderer3d::SetPlaneAngleX(float angleX)
CalculateGeometry();
}
void Renderer3d::SetVerticalFOV(float fov)
{
m_fov = fov;
CalculateGeometry();
}
void Renderer3d::CalculateGeometry()
{
float cameraZ = 1 / tan(m_fov / 2.0);
m_scaleY = cos(-m_angleX) + sin(-m_angleX) * tan(m_fov / 2.0 - m_angleX);
m_scaleX = 1.0 + 2*sin(-m_angleX) * cos(m_fov / 2.0) / (cameraZ * cos(m_fov / 2.0 - m_angleX));
m_scaleX = m_scaleY = max(m_scaleX, m_scaleY);
m_offsetZ = cameraZ + sin(-m_angleX) * m_scaleY;
m_offsetY = cos(-m_angleX) * m_scaleX - 1.0;
/*
const float vertices[] =
{
-1.0f, 1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f,
-1.0f, -1.0f, 0.0f, 0.0f,
1.0f, -1.0f, 1.0f, 0.0f
};
*/
m_vertices[0] = -1.0f;
m_vertices[1] = 1.0;
m_vertices[2] = 0.0f;
m_vertices[3] = 1.0f;
m_vertices[4] = 1.0f;
m_vertices[5] = 1.0f;
m_vertices[6] = 1.0f;
m_vertices[7] = 1.0f;
m_vertices[8] = -1.0f;
m_vertices[9] = -1.0f;
m_vertices[10] = 0.0f;
m_vertices[11] = 0.0f;
m_vertices[12] = 1.0f;
m_vertices[13] = -1.0f;
m_vertices[14] = 1.0f;
m_vertices[15] = 0.0f;
UpdateScaleMatrix();
UpdateRotationMatrix();
UpdateTranslationMatrix();
UpdateProjectionMatrix();
m_transformMatrix = m_scaleMatrix * m_rotationMatrix * m_translationMatrix * m_projectionMatrix;
}
void Renderer3d::Build(ref_ptr<dp::GpuProgram> prg)
{
m_bufferId = GLFunctions::glGenBuffer();
@ -142,9 +153,7 @@ void Renderer3d::Render(uint32_t textureId, ref_ptr<dp::GpuProgramManager> mng)
dp::UniformValuesStorage uniforms;
uniforms.SetIntValue("tex", 0);
uniforms.SetMatrix4x4Value("rotate", m_rotationMatrix.data());
uniforms.SetMatrix4x4Value("translate", m_translationMatrix.data());
uniforms.SetMatrix4x4Value("projection", m_projectionMatrix.data());
uniforms.SetMatrix4x4Value("m_transform", m_transformMatrix.m_data);
dp::ApplyUniforms(uniforms, prg);
@ -155,7 +164,8 @@ void Renderer3d::Render(uint32_t textureId, ref_ptr<dp::GpuProgramManager> mng)
GLFunctions::glBindBuffer(m_bufferId, gl_const::GLArrayBuffer);
GLFunctions::glBindVertexArray(m_VAO);
GLFunctions::glBufferData(gl_const::GLArrayBuffer, sizeof(m_vertices), m_vertices, gl_const::GLStaticDraw);
GLFunctions::glBufferData(gl_const::GLArrayBuffer, m_vertices.size() * sizeof(m_vertices[0]),
m_vertices.data(), gl_const::GLStaticDraw);
GLFunctions::glViewport(0, 0, m_width, m_height);
GLFunctions::glClear();
@ -170,47 +180,45 @@ void Renderer3d::Render(uint32_t textureId, ref_ptr<dp::GpuProgramManager> mng)
void Renderer3d::UpdateProjectionMatrix()
{
float ctg_fovy = 1.0/tanf(m_fov/2.0f);
float ctg_fovy = 1.0 / tanf(m_fov / 2.0f);
float aspect = 1.0;
float near = 0.1f;
float far = 100.0f;
m_projectionMatrix.fill(0.0f);
m_projectionMatrix(0, 0) = ctg_fovy / aspect;
m_projectionMatrix(1, 1) = ctg_fovy;
m_projectionMatrix(2, 2) = (far + near) / (far - near);
m_projectionMatrix(2, 3) = 1.0f;
m_projectionMatrix(3, 2) = -2 * far * near / (far - near);
}
m_projectionMatrix[0] = ctg_fovy / aspect;
m_projectionMatrix[5] = ctg_fovy;
m_projectionMatrix[10] = (far + near) / (far - near);
m_projectionMatrix[11] = 1.0f;
m_projectionMatrix[14] = -2 * far * near / (far - near);
void Renderer3d::UpdateScaleMatrix()
{
m_scaleMatrix(0, 0) = m_scaleX;
m_scaleMatrix(1, 1) = m_scaleY;
m_scaleMatrix(2, 2) = 1.0f;
m_scaleMatrix(3, 3) = 1.0f;
}
void Renderer3d::UpdateRotationMatrix()
{
m_rotationMatrix.fill(0.0f);
m_rotationMatrix[0] = 1.0f;
m_rotationMatrix[5] = cos(m_angleX);
m_rotationMatrix[6] = -sin(m_angleX);
m_rotationMatrix[9] = sin(m_angleX);
m_rotationMatrix[10] = cos(m_angleX);
m_rotationMatrix[15] = 1.0f;
m_rotationMatrix(0, 0) = 1.0f;
m_rotationMatrix(1, 1) = cos(m_angleX);
m_rotationMatrix(1, 2) = -sin(m_angleX);
m_rotationMatrix(2, 1) = sin(m_angleX);
m_rotationMatrix(2, 2) = cos(m_angleX);
m_rotationMatrix(3, 3) = 1.0f;
}
void Renderer3d::UpdateTranslationMatrix()
{
m_translationMatrix.fill(0.0f);
float dx = 0.0f;
float dy = m_offsetY;
float dz = m_offsetZ;
m_translationMatrix[0] = 1.0f;
m_translationMatrix[5] = 1.0f;
m_translationMatrix[10] = 1.0f;
m_translationMatrix[12] = dx;
m_translationMatrix[13] = dy;
m_translationMatrix[14] = dz;
m_translationMatrix[15] = 1.0f;
m_translationMatrix(0, 0) = 1.0f;
m_translationMatrix(1, 1) = 1.0f;
m_translationMatrix(2, 2) = 1.0f;
m_translationMatrix(3, 0) = 0.0f;
m_translationMatrix(3, 1) = m_offsetY;
m_translationMatrix(3, 2) = m_offsetZ;
m_translationMatrix(3, 3) = 1.0f;
}
}

View file

@ -1,8 +1,11 @@
#pragma once
#include "drape/gpu_program_manager.hpp"
#include "viewport.hpp"
#include "drape/gpu_program_manager.hpp"
#include "base/matrix.hpp"
namespace df
{
@ -16,6 +19,8 @@ public:
void SetVerticalFOV(float fov);
void SetPlaneAngleX(float angleX);
math::Matrix<float, 4, 4> const & GetTransform() const;
float GetScaleX() const;
float GetScaleY() const;
@ -26,6 +31,7 @@ private:
void CalculateGeometry();
void UpdateScaleMatrix();
void UpdateRotationMatrix();
void UpdateTranslationMatrix();
void UpdateProjectionMatrix();
@ -35,21 +41,22 @@ private:
float m_fov;
float m_angleX;
float m_offsetX;
float m_offsetY;
float m_offsetZ;
float m_scaleX;
float m_scaleY;
array<float, 16> m_rotationMatrix;
array<float, 16> m_translationMatrix;
array<float, 16> m_projectionMatrix;
math::Matrix<float, 4, 4> m_scaleMatrix;
math::Matrix<float, 4, 4> m_rotationMatrix;
math::Matrix<float, 4, 4> m_translationMatrix;
math::Matrix<float, 4, 4> m_projectionMatrix;
math::Matrix<float, 4, 4> m_transformMatrix;
uint32_t m_VAO;
uint32_t m_bufferId;
float m_vertices[16];
array<float, 16> m_vertices;
};
}

View file

@ -157,7 +157,7 @@ void TextShape::DrawSubStringPlain(StraightTextLayout const & layout, dp::FontDe
layout.Cache(glsl::vec3(glsl::ToVec2(m_basePoint), m_params.m_depth),
baseOffset, color, staticBuffer, dynamicBuffer);
dp::GLState state(gpu::TEXT_PROGRAM, dp::GLState::OverlayLayer);
dp::GLState state(gpu::TEXT_SPRITE_PROGRAM, dp::GLState::OverlayLayer);
ASSERT(color.GetTexture() == outline.GetTexture(), ());
state.SetColorTexture(color.GetTexture());
state.SetMaskTexture(layout.GetMaskTexture());
@ -199,7 +199,7 @@ void TextShape::DrawSubStringOutlined(StraightTextLayout const & layout, dp::Fon
layout.Cache(glsl::vec3(glsl::ToVec2(m_basePoint), m_params.m_depth),
baseOffset, color, outline, staticBuffer, dynamicBuffer);
dp::GLState state(gpu::TEXT_OUTLINED_PROGRAM, dp::GLState::OverlayLayer);
dp::GLState state(gpu::TEXT_OUTLINED_SPRITE_PROGRAM, dp::GLState::OverlayLayer);
ASSERT(color.GetTexture() == outline.GetTexture(), ());
state.SetColorTexture(color.GetTexture());
state.SetMaskTexture(layout.GetMaskTexture());

View file

@ -157,7 +157,7 @@ void CacheUserPoints(UserMarksProvider const * provider,
buffer.emplace_back(pos, right + up + offset, glsl::ToVec2(texRect.RightBottom()), runAnim);
}
dp::GLState state(gpu::BOOKMARK_PROGRAM, dp::GLState::UserMarkLayer);
dp::GLState state(gpu::BOOKMARK_SPRITE_PROGRAM, dp::GLState::UserMarkLayer);
state.SetColorTexture(region.GetTexture());
dp::AttributeProvider attribProvider(1, buffer.size());