Kaydet (Commit) 76fa5481 authored tarafından weigao's avatar weigao Kaydeden (comit) Markus Mohrhard

add function of adding screen text shape

Change-Id: I0f40081a0855bc8e43a8d4761222bd351b5d6f0c
üst 212dfdbb
...@@ -912,6 +912,15 @@ void GL3DBarChart::contextDestroyed() ...@@ -912,6 +912,15 @@ void GL3DBarChart::contextDestroyed()
mbValidContext = false; mbValidContext = false;
} }
void GL3DBarChart::addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, glm::vec3 rPos)
{
maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, nStr, 0));
opengl3D::TextCacheItem tmpTextCache = mpTextCache->getText(nStr);
float rectWidth = (float)tmpTextCache.maSize.Width() / (float)tmpTextCache.maSize.Height() * 0.05;
opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back());
pScreenText->setPosition(rLeftTop, glm::vec2(rLeftTop.x + rectWidth, rLeftTop.y - nTextHeight), rPos);
}
void GL3DBarChart::updateRenderFPS() void GL3DBarChart::updateRenderFPS()
{ {
int aDeltaMs = calcTimeInterval(mafpsRenderStartTime, mafpsRenderEndTime); int aDeltaMs = calcTimeInterval(mafpsRenderStartTime, mafpsRenderEndTime);
...@@ -925,11 +934,7 @@ void GL3DBarChart::updateRenderFPS() ...@@ -925,11 +934,7 @@ void GL3DBarChart::updateRenderFPS()
osl_getSystemTime(&mafpsRenderStartTime); osl_getSystemTime(&mafpsRenderStartTime);
} }
osl_getSystemTime(&mafpsRenderEndTime); osl_getSystemTime(&mafpsRenderEndTime);
maScreenTextShapes.push_back(new opengl3D::ScreenText(mpRenderer.get(), *mpTextCache, maFPS, 0)); addScreenTextShape(maFPS, glm::vec2(-0.99f, 0.99f), 0.1f, glm::vec3(0.0, 0.0, 0.0));
opengl3D::TextCacheItem tmpTextCache = mpTextCache->getText(maFPS);
float rectWidth = (float)tmpTextCache.maSize.Width() / (float)tmpTextCache.maSize.Height() * 0.05;
opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(&maScreenTextShapes.back());
pScreenText->setPosition(glm::vec2(-0.99f, 0.99f), glm::vec2(-0.99f + rectWidth, 0.89f));
} }
int GL3DBarChart::calcTimeInterval(TimeValue &startTime, TimeValue &endTime) int GL3DBarChart::calcTimeInterval(TimeValue &startTime, TimeValue &endTime)
......
...@@ -90,6 +90,7 @@ private: ...@@ -90,6 +90,7 @@ private:
void updateRenderFPS(); void updateRenderFPS();
DECL_LINK(updateTimer, void*); DECL_LINK(updateTimer, void*);
int calcTimeInterval(TimeValue &startTime, TimeValue &endTime); int calcTimeInterval(TimeValue &startTime, TimeValue &endTime);
void addScreenTextShape(OUString &nStr, glm::vec2 rLeftTop, float nTextHeight, glm::vec3 rPos);
css::uno::Reference<css::chart2::XChartType> mxChartType; css::uno::Reference<css::chart2::XChartType> mxChartType;
boost::ptr_vector<opengl3D::Renderable3DObject> maShapes; boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
......
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