From dc367b7f43b9b3f4b783d8ad770279a8ff5c1adb Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sun, 8 May 2011 01:10:12 +0300 Subject: [PATCH] Changed: Added particle system animation. --- .../src/object_viewer_widget.cpp | 15 ++++++++++++++- .../src/object_viewer_widget.h | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp index cbee70185..67abffbcb 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp +++ b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp @@ -262,7 +262,7 @@ namespace NLQT //updateAnimation(_AnimationDialog->getTime()); - + updateAnimatePS(); // 10. Update Camera (depends on entities) // ... @@ -719,6 +719,19 @@ namespace NLQT //CFile::deleteFile(filename); return icon; } + + void CObjectViewerWidget::updateAnimatePS(uint64 deltaTime) + { + static sint64 firstTime = NLMISC::CTime::getLocalTime(); + static sint64 lastTime = NLMISC::CTime::getLocalTime(); + if (deltaTime == 0) + { + deltaTime = NLMISC::CTime::getLocalTime() - lastTime; + } + lastTime += deltaTime; + float fdelta = 0.001f * (float) (lastTime - firstTime); + _Scene->animate ( fdelta); + } #if defined(NL_OS_WINDOWS) diff --git a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h index 82bf26f92..15c9b0fa9 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h +++ b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h @@ -178,6 +178,10 @@ namespace NLQT void updateRender(); private: + + /// Update the animation time for Particle System animation. + /// @param deltaTime - set the manual animation time. + void updateAnimatePS(uint64 deltaTime = 0); static CObjectViewerWidget *_objectViewerWidget;