chart2/source/view/charttypes/GL3DBarChart.cxx | 83 +++++++++++++----- chart2/source/view/inc/GL3DBarChart.hxx | 6 + chart2/source/view/main/GL3DRenderer.cxx | 2 sc/source/core/opencl/formulagroupcl.cxx | 110 ++++++++++++++----------- sc/source/core/opencl/op_logical.cxx | 54 +++++++++--- sc/source/core/opencl/opbase.cxx | 48 +++++++--- sc/source/core/opencl/opbase.hxx | 5 - sc/source/ui/namedlg/namedefdlg.cxx | 1 8 files changed, 210 insertions(+), 99 deletions(-)
New commits: commit 3ad748accd49b128edeb979969d2100af8902624 Author: haochen <[email protected]> Date: Fri Jun 13 11:26:12 2014 +0800 GPU Calc:Support nested formulae expansion for simple nested Change-Id: If1ae42a5481cf76942ff1ac5e0ee31a94159badd diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 07900ad..e19d4a2 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1256,12 +1256,12 @@ public: ss << ", "; vSubArguments[i]->GenSlidingWindowDecl(ss); } - ss << ") {\n\t"; - ss << "double tmp = " << GetBottom() <<";\n\t"; - ss << "int gid0 = get_global_id(0);\n\t"; + ss << ") {\n"; + ss << "double tmp = " << GetBottom() <<";\n"; + ss << "int gid0 = get_global_id(0);\n"; if (isAverage()) - ss << "int nCount = 0;\n\t"; - ss << "double tmpBottom;\n\t"; + ss << "int nCount = 0;\n"; + ss << "double tmpBottom;\n"; unsigned i = vSubArguments.size(); while (i--) { @@ -1292,60 +1292,52 @@ public: if (pCur->GetType() == formula::svSingleVectorRef) { -#ifdef ISNAN const formula::SingleVectorRefToken* pSVR = static_cast< const formula::SingleVectorRefToken* >(pCur); - ss << "if (gid0 < " << pSVR->GetArrayLength() << "){\n\t\t"; -#else -#endif + ss << "if (gid0 < " << pSVR->GetArrayLength() << "){\n"; } else if (pCur->GetType() == formula::svDouble) { -#ifdef ISNAN - ss << "{\n\t\t"; -#endif - } - else - { + ss << "{\n"; } } -#ifdef ISNAN if(ocPush==vSubArguments[i]->GetFormulaToken()->GetOpCode()) { - ss << "tmpBottom = " << GetBottom() << ";\n\t\t"; + ss << "tmpBottom = " << GetBottom() << ";\n"; ss << "if (isNan("; ss << vSubArguments[i]->GenSlidingWindowDeclRef(); - ss << "))\n\t\t\t"; - ss << "tmp = "; - ss << Gen2("tmpBottom", "tmp") << ";\n\t\t"; - ss << "else{\n\t\t\t"; - ss << "tmp = "; + ss << "))\n"; + if ( ZeroReturnZero() ) + ss << " return 0;\n"; + else + { + ss << " tmp = "; + ss << Gen2("tmpBottom", "tmp") << ";\n"; + } + ss << "else{\n"; + ss << " tmp = "; ss << Gen2(vSubArguments[i]->GenSlidingWindowDeclRef(), "tmp"); - ss << ";\n\t\t\t"; - ss << "}\n\t"; - ss << "}\n\t"; + ss << ";\n"; + ss << " }\n"; + ss << "}\n"; + if ( vSubArguments[i]->GetFormulaToken()->GetType() == + formula::svSingleVectorRef&& ZeroReturnZero() ) + { + ss << "else{\n"; + ss << " return 0;\n"; + ss << " }\n"; + } } else { ss << "tmp = "; ss << Gen2(vSubArguments[i]->GenSlidingWindowDeclRef(), "tmp"); - ss << ";\n\t"; + ss << ";\n"; } -#else - ss << "tmp = "; - // Generate the operation in binary form - ss << Gen2(vSubArguments[i]->GenSlidingWindowDeclRef(), "tmp"); - ss << ";\n\t"; -#endif } ss << "return tmp"; -#ifdef ISNAN if (isAverage()) ss << "*pow((double)nCount,-1.0)"; -#else - if (isAverage()) - ss << "/(double)"<<nItems; -#endif ss << ";\n}"; } virtual bool isAverage() const { return false; } @@ -1535,6 +1527,11 @@ public: static_cast< const formula::SingleVectorRefToken*> (vSubArguments[i]->GetFormulaToken()); temp3<<pSVR->GetArrayLength(); + temp3 << ")||isNan("<<vSubArguments[i] + ->GenSlidingWindowDeclRef(); + temp3 << ")?0:"; + temp3 << vSubArguments[i]->GenSlidingWindowDeclRef(); + temp3 << ")"; } else if(vSubArguments[i]->GetFormulaToken()->GetType() == formula::svDoubleVectorRef){ @@ -1542,12 +1539,13 @@ public: static_cast< const formula::DoubleVectorRefToken*> (vSubArguments[i]->GetFormulaToken()); temp3<<pSVR->GetArrayLength(); - } - temp3 << ")||isNan("<<vSubArguments[i] + temp3 << ")||isNan("<<vSubArguments[i] ->GenSlidingWindowDeclRef(true); temp3 << ")?0:"; temp3 << vSubArguments[i]->GenSlidingWindowDeclRef(true); temp3 << ")"; + } + } else temp3 << vSubArguments[i]->GenSlidingWindowDeclRef(true); @@ -1604,6 +1602,11 @@ public: static_cast< const formula::SingleVectorRefToken*> (vSubArguments[i]->GetFormulaToken()); temp4<<pSVR->GetArrayLength(); + temp4 << ")||isNan("<<vSubArguments[i] + ->GenSlidingWindowDeclRef(); + temp4 << ")?0:"; + temp4 << vSubArguments[i]->GenSlidingWindowDeclRef(); + temp4 << ")"; } else if(vSubArguments[i]->GetFormulaToken()->GetType() == formula::svDoubleVectorRef) @@ -1612,12 +1615,13 @@ public: static_cast< const formula::DoubleVectorRefToken*> (vSubArguments[i]->GetFormulaToken()); temp4<<pSVR->GetArrayLength(); + temp4 << ")||isNan("<<vSubArguments[i] + ->GenSlidingWindowDeclRef(true); + temp4 << ")?0:"; + temp4 << vSubArguments[i]->GenSlidingWindowDeclRef(true); + temp4 << ")"; } - temp4 << ")||isNan("<<vSubArguments[i] - ->GenSlidingWindowDeclRef(true); - temp4 << ")?0:"; - temp4 << vSubArguments[i]->GenSlidingWindowDeclRef(true); - temp4 << ")"; + } else { @@ -1752,6 +1756,7 @@ public: return lhs + "*" + rhs; } virtual std::string BinFuncName(void) const SAL_OVERRIDE { return "fmul"; } + virtual bool ZeroReturnZero() {return true;}; }; /// Technically not a reduction, but fits the framework. @@ -2020,9 +2025,20 @@ public: ss << ")"; } else { if (mvSubArguments.size() != 2) - throw Unhandled(); - ss << "(" << mpCodeGen->Gen2(mvSubArguments[0]->GenSlidingWindowDeclRef(true), - mvSubArguments[1]->GenSlidingWindowDeclRef(true)) << ")"; + throw Unhandled(); + bool bArgument1_NeedNested = + (mvSubArguments[0]->GetFormulaToken()->GetType() + == formula::svSingleVectorRef)? false:true; + bool bArgument2_NeedNested = + (mvSubArguments[1]->GetFormulaToken()->GetType() + == formula::svSingleVectorRef) ? false:true; + ss << "("; + ss << mpCodeGen-> + Gen2(mvSubArguments[0] + ->GenSlidingWindowDeclRef(bArgument1_NeedNested), + mvSubArguments[1] + ->GenSlidingWindowDeclRef(bArgument2_NeedNested)); + ss << ")"; } return ss.str(); } diff --git a/sc/source/core/opencl/op_logical.cxx b/sc/source/core/opencl/op_logical.cxx index 9dce77b..96170f2 100644 --- a/sc/source/core/opencl/op_logical.cxx +++ b/sc/source/core/opencl/op_logical.cxx @@ -319,7 +319,6 @@ void OpIf::GenSlidingWindowFunction(std::stringstream &ss, { ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; - if(vSubArguments.size()!=3) throw Unhandled("unknown operand for ocPush"); for (unsigned i = 0; i < vSubArguments.size(); i++) { if (i) @@ -332,22 +331,49 @@ void OpIf::GenSlidingWindowFunction(std::stringstream &ss, FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken(); if(tmpCur0->GetType() == formula::svDoubleVectorRef) { - throw UnhandledToken(tmpCur0, "unknown operand for ocPush"); + throw UnhandledToken(tmpCur0, "unknown operand for ocPush"); } else { - ss << " if(isNan("; - ss << vSubArguments[0]->GenSlidingWindowDeclRef(); - ss << ")|| "; - ss << vSubArguments[0]->GenSlidingWindowDeclRef(); - ss << " == 0)\n"; - ss << " return "; - ss << vSubArguments[2]->GenSlidingWindowDeclRef(); - ss << ";\n"; - ss << " else"; - ss <<" return "; - ss << vSubArguments[1]->GenSlidingWindowDeclRef(); - ss <<";\n"; + if(vSubArguments.size()==3) + { + ss << " if(isNan("; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << ")|| "; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << " == 0)\n"; + ss << " return "; + ss << vSubArguments[2]->GenSlidingWindowDeclRef(); + ss << ";\n"; + ss << " else"; + ss <<" return "; + ss << vSubArguments[1]->GenSlidingWindowDeclRef(); + ss <<";\n"; + } + if(vSubArguments.size()==2) + { + ss << " if(isNan("; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << ")|| "; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << " == 0)\n"; + ss << " return 0;\n"; + ss << " else"; + ss <<" return "; + ss << vSubArguments[1]->GenSlidingWindowDeclRef(); + ss <<";\n"; + } + if(vSubArguments.size()==1) + { + ss << " if(isNan("; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << ")|| "; + ss << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << " == 0)\n"; + ss << " return 0;\n"; + ss << " else"; + ss <<" return 1;\n"; + } } ss << "}\n"; } diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx index 02b9c37..b0751f5 100644 --- a/sc/source/core/opencl/opbase.cxx +++ b/sc/source/core/opencl/opbase.cxx @@ -130,7 +130,6 @@ void CheckVariables::CheckSubArgumentIsNan( std::stringstream & ss, SubArguments &vSubArguments, int argumentNum) { int i = argumentNum; -#ifdef ISNAN if(vSubArguments[i]->GetFormulaToken()->GetType() == formula::svSingleVectorRef) { @@ -139,6 +138,17 @@ void CheckVariables::CheckSubArgumentIsNan( std::stringstream & ss, ss<< " if(singleIndex>="; ss<< pTmpDVR1->GetArrayLength(); ss<<" ||"; + ss<< "isNan("; + ss<< vSubArguments[i]->GenSlidingWindowDeclRef(true); + ss<<"))\n"; + ss<< " tmp"; + ss<< i; + ss <<"=0;\n else \n"; + ss <<" tmp"; + ss <<i; + ss << "="; + ss << vSubArguments[i]->GenSlidingWindowDeclRef(true); + ss<<";\n"; } if(vSubArguments[i]->GetFormulaToken()->GetType() == formula::svDoubleVectorRef) @@ -148,24 +158,36 @@ void CheckVariables::CheckSubArgumentIsNan( std::stringstream & ss, ss<< " if(doubleIndex>="; ss<< pTmpDVR2->GetArrayLength(); ss<<" ||"; + ss<< "isNan("; + ss<< vSubArguments[i]->GenSlidingWindowDeclRef(false); + ss<<"))\n"; + ss<< " tmp"; + ss<< i; + ss <<"=0;\n else \n"; + ss <<" tmp"; + ss <<i; + ss << "="; + ss << vSubArguments[i]->GenSlidingWindowDeclRef(false); + ss<<";\n"; } if(vSubArguments[i]->GetFormulaToken()->GetType() == formula::svDouble || vSubArguments[i]->GetFormulaToken()->GetOpCode() != ocPush) { ss<< " if("; + ss<< "isNan("; + ss<< vSubArguments[i]->GenSlidingWindowDeclRef(); + ss<<"))\n"; + ss<< " tmp"; + ss<< i; + ss <<"=0;\n else \n"; + ss <<" tmp"; + ss <<i; + ss << "="; + ss << vSubArguments[i]->GenSlidingWindowDeclRef(); + ss<<";\n"; + } - ss<< "isNan("; - ss<< vSubArguments[i]->GenSlidingWindowDeclRef(true); - ss<<"))\n"; - ss<< " tmp"; - ss<< i; - ss <<"=0;\n else \n"; -#endif - ss <<" tmp"; - ss <<i; - ss << "="; - ss << vSubArguments[i]->GenSlidingWindowDeclRef(true); - ss<<";\n"; + } void CheckVariables::CheckSubArgumentIsNan2( std::stringstream & ss, diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index d1d0005..487fc04 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -211,7 +211,7 @@ public: virtual void GenSlidingWindowDecl(std::stringstream &ss) const SAL_OVERRIDE; /// When referenced in a sliding window function - virtual std::string GenSlidingWindowDeclRef(bool=true) const SAL_OVERRIDE; + virtual std::string GenSlidingWindowDeclRef(bool=false) const SAL_OVERRIDE; /// Create buffer and pass the buffer to a given kernel virtual size_t Marshal(cl_kernel, int, int, cl_program) SAL_OVERRIDE; @@ -250,6 +250,9 @@ public: std::set<std::string>& ) {} virtual bool takeString() const = 0; virtual bool takeNumeric() const = 0; + //Continue process 'Zero' or Not(like OpMul, not continue process when meet + // 'Zero' + virtual bool ZeroReturnZero() {return false;} virtual ~OpBase() {} }; commit 8e19f8ebd8febccf7a706f1e0179a4d72f30d6d8 Author: weigao <[email protected]> Date: Mon Jun 16 23:40:36 2014 -0700 modify the mouse drag function Change-Id: I9639b2a29522ba0765f4442c2f78de56388fe754 diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 7c3b881..0fc12b1 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -416,19 +416,19 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons) pScreenText->render(); } -void GL3DBarChart::mouseDragMove(const Point& , const Point& , sal_uInt16 nButtons) +void GL3DBarChart::mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 ) { if(mbBlockUserInput) return; mbBlockUserInput = true; - - if(nButtons == MOUSE_RIGHT) + long direction = rEndPos.X() - rStartPos.X(); + if(direction < 0) { mnCornerId = (mnCornerId + 1) % 4; moveToCorner(); } - else if(nButtons == MOUSE_LEFT) + else if(direction > 0) { mnCornerId = mnCornerId - 1; if(mnCornerId < 0) @@ -439,33 +439,33 @@ void GL3DBarChart::mouseDragMove(const Point& , const Point& , sal_uInt16 nButto glm::vec3 GL3DBarChart::getCornerPosition(sal_Int8 nId) { + float pi = 3.1415926; switch(nId) { case 0: { - return glm::vec3(-30, -30, DEFAULT_CAMERA_HEIGHT); + return glm::vec3(mnMaxX / 2 - mnDistance * sin(pi / 4), mnMaxY / 2 - mnDistance * cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2); } break; case 1: { - return glm::vec3(mnMaxX, -30, DEFAULT_CAMERA_HEIGHT); + return glm::vec3(mnMaxX / 2 + mnDistance * sin(pi / 4), mnMaxY / 2 - mnDistance * cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2); } break; case 2: { - return glm::vec3(mnMaxX, mnMaxY, DEFAULT_CAMERA_HEIGHT); + return glm::vec3(mnMaxX / 2 + mnDistance * sin(pi / 4), mnMaxY / 2 + mnDistance * cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2); } break; case 3: { - return glm::vec3(-30, mnMaxY, DEFAULT_CAMERA_HEIGHT); + return glm::vec3(mnMaxX / 2 - mnDistance * sin(pi / 4), mnMaxY / 2 + mnDistance * cos(pi / 4), DEFAULT_CAMERA_HEIGHT * 2); } break; default: assert(false); } - - return glm::vec3(-30, -30, DEFAULT_CAMERA_HEIGHT); + return maDefaultCameraPosition; } void GL3DBarChart::moveToCorner() commit af5dfd8af2e92cbd511ae6ff840d4ea7f3f83ad5 Author: weigao <[email protected]> Date: Mon Jun 16 23:33:03 2014 -0700 add move to default process Change-Id: I8d562b3e2d1bb83a6e07ed089a3006a109beeece diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index c889809..7c3b881 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -357,24 +357,19 @@ void GL3DBarChart::moveToDefault() glm::vec3 maTargetDirection = maDefaultCameraDirection; maStepDirection = (maTargetDirection - maCameraDirection)/((float)mnStepsTotal); - while((mnStep < mnStepsTotal) && mbBlockUserInput) - { - ++mnStep; - maCameraPosition += maStep; - mpCamera->setPosition(maCameraPosition); - maCameraDirection += maStepDirection; - mpCamera->setDirection(maCameraDirection); - render(); - } - maShapes.pop_back(); - mbBlockUserInput = false; - mnStep = 0; + maTimer.SetTimeout(TIMEOUT); + maTimer.SetTimeoutHdl(LINK(this, GL3DBarChart, MoveToBar)); + maTimer.Start(); } void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons) { if(mbBlockUserInput) return; + if (nButtons == MOUSE_RIGHT) + { + moveToDefault(); + } if(nButtons != MOUSE_LEFT) return; commit a96c575764a36399e459813d6204db3bfc0a08f3 Author: weigao <[email protected]> Date: Mon Jun 16 23:21:04 2014 -0700 modify the click view angle Change-Id: I8717745d2f503f8ad3c21673a07aed867b5681f9 diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 88f49dd..c889809 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -400,14 +400,15 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons) render(); glm::vec3 maTargetPosition = rBarInfo.maPos; - maTargetPosition.z += 45; - maStep = (maTargetPosition - maCameraPosition)/100.0f; + maTargetPosition.z += 240; + maTargetPosition.y += BAR_SIZE_Y / 2.0f; + maStep = (maTargetPosition - maCameraPosition)/((float)mnStepsTotal); glm::vec3 maTargetDirection = rBarInfo.maPos; maTargetDirection.x += BAR_SIZE_X / 2.0f; maTargetDirection.y += BAR_SIZE_Y / 2.0f; - maStepDirection = (maTargetDirection - maCameraDirection)/100.f; + maStepDirection = (maTargetDirection - maCameraDirection)/((float)mnStepsTotal); maTimer.SetTimeout(TIMEOUT); maTimer.SetTimeoutHdl(LINK(this, GL3DBarChart, MoveToBar)); commit 6c4ce5f351f7acf2086f5bf2b67ef15ffcda0c51 Author: weigao <[email protected]> Date: Mon Jun 16 23:08:00 2014 -0700 modify the default view angle Change-Id: Ic7c901108a290a9d9c5a8564b6eefa7ed32a9e1f diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 334b740..88f49dd 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -38,7 +38,8 @@ GL3DBarChart::GL3DBarChart( mnMaxY(0), mnCornerId(0), mbBlockUserInput(false), - mbNeedsNewRender(true) + mbNeedsNewRender(true), + mbCameraInit(false) { Size aSize = mrWindow.GetSizePixel(); mpRenderer->SetSize(aSize); @@ -63,9 +64,9 @@ GL3DBarChart::~GL3DBarChart() namespace { -const float TEXT_HEIGHT = 15.0f; -const float DEFAULT_CAMERA_HEIGHT = 500.0f; -const size_t STEPS = 100; +const float TEXT_HEIGHT = 10.0f; +float DEFAULT_CAMERA_HEIGHT = 500.0f; +const size_t STEPS = 200; const sal_uLong TIMEOUT = 5; const sal_uInt32 ID_STEP = 10; @@ -268,12 +269,28 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer mnMaxX = nMaxPointCount * (BAR_SIZE_X + BAR_DISTANCE_X) + 40; mnMaxY = nSeriesIndex * (BAR_SIZE_Y + BAR_DISTANCE_Y) + 40; - - maCameraPosition = glm::vec3(-30, -30, DEFAULT_CAMERA_HEIGHT); - mpCamera->setPosition(maCameraPosition); - maCameraDirection = glm::vec3(mnMaxX/2, mnMaxY/2, 0); - mpCamera->setDirection(maCameraDirection); - + if (!mbCameraInit) + { + mnDistance = sqrt(mnMaxX * mnMaxX + mnMaxY * mnMaxY + DEFAULT_CAMERA_HEIGHT * DEFAULT_CAMERA_HEIGHT); + maDefaultCameraDirection = glm::vec3(mnMaxX * 0.4, mnMaxY * 0.35, 0); + maDefaultCameraPosition = glm::vec3(maDefaultCameraDirection.x, maDefaultCameraDirection.y - mnDistance, DEFAULT_CAMERA_HEIGHT * 2); + mnCornerId = 0; + mbCameraInit = true; + float pi = 3.1415926f; + float angleX = -pi / 6.5f; + float angleZ = -pi / 8.0f; + glm::mat4 maDefaultRotateMatrix = glm::eulerAngleYXZ(0.0f, angleX, angleZ); + maDefaultCameraPosition = glm::vec3(maDefaultRotateMatrix * glm::vec4(maDefaultCameraPosition, 1.0f)); + maCameraPosition = maDefaultCameraPosition; + maCameraDirection = maDefaultCameraDirection; + mpCamera->setPosition(maCameraPosition); + mpCamera->setDirection(maCameraDirection); + } + else + { + mpCamera->setPosition(maCameraPosition); + mpCamera->setDirection(maCameraDirection); + } mbNeedsNewRender = true; } @@ -330,6 +347,30 @@ public: } +void GL3DBarChart::moveToDefault() +{ + mnStepsTotal = STEPS; + mnStep = 0; + mbBlockUserInput = true; + glm::vec3 maTargetPosition = maDefaultCameraPosition; + maStep = (maTargetPosition - maCameraPosition)/((float)mnStepsTotal); + + glm::vec3 maTargetDirection = maDefaultCameraDirection; + maStepDirection = (maTargetDirection - maCameraDirection)/((float)mnStepsTotal); + while((mnStep < mnStepsTotal) && mbBlockUserInput) + { + ++mnStep; + maCameraPosition += maStep; + mpCamera->setPosition(maCameraPosition); + maCameraDirection += maStepDirection; + mpCamera->setDirection(maCameraDirection); + render(); + } + maShapes.pop_back(); + mbBlockUserInput = false; + mnStep = 0; +} + void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons) { if(mbBlockUserInput) diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx index 0566904..d3426a3 100644 --- a/chart2/source/view/inc/GL3DBarChart.hxx +++ b/chart2/source/view/inc/GL3DBarChart.hxx @@ -58,6 +58,7 @@ public: private: void moveToCorner(); + void moveToDefault(); glm::vec3 getCornerPosition(sal_Int8 nCornerId); DECL_LINK(MoveCamera, void*); @@ -77,6 +78,9 @@ private: glm::vec3 maCameraPosition; glm::vec3 maCameraDirection; + glm::vec3 maDefaultCameraPosition; + glm::vec3 maDefaultCameraDirection; + Timer maTimer; glm::vec3 maStep; glm::vec3 maStepDirection; @@ -84,6 +88,7 @@ private: size_t mnStepsTotal; float mnMaxX; float mnMaxY; + float mnDistance; /** * 0 = corner at (0,0,0); * numbering counter clockwise @@ -107,6 +112,7 @@ private: std::map<sal_uInt32, const BarInformation> maBarMap; bool mbBlockUserInput; bool mbNeedsNewRender; + bool mbCameraInit; }; } commit c52e440377750ef83cfd65ffdd7f24165123fd2d Author: weigao <[email protected]> Date: Mon Jun 16 22:58:26 2014 -0700 modify the perspective view angle to 30 Change-Id: I07b39f8b372368f82137feec3a6d12921fc1ec9f diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index a7d1496..52199c5 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -278,7 +278,7 @@ void OpenGL3DRenderer::init() glBufferData(GL_ARRAY_BUFFER, sizeof(boundBoxNormal), boundBoxNormal, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); - m_fViewAngle = 60.0f; + m_fViewAngle = 30.0f; m_3DProjection = glm::perspective(m_fViewAngle, (float)m_iWidth / (float)m_iHeight, 0.01f, 6000.0f); maResources.LoadShaders(); commit 1c8babfdb0808318bbaa94e911c819456a65337e Author: Markus Mohrhard <[email protected]> Date: Tue Jun 10 18:13:46 2014 +0200 document must be set modified when range name is defined, fdo#79451 Change-Id: I382bef9b95d40a1abac993795e8da540b5aa5d18 diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index 3ab5d2f..b05d69b 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -245,6 +245,7 @@ void ScNameDefDlg::AddPushed() if (nTab != -1) mpDoc->SetStreamValid(nTab, false); SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) ); + mpDocShell->SetDocumentModified(); Close(); } else _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
