PageRenderTime 67ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llwldaycycle.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 128 lines | 40 code | 30 blank | 58 comment | 0 complexity | 124341931f2fe0012154dc5200c13eca MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llwlparammanager.h
  3. * @brief Implementation for the LLWLParamManager class.
  4. *
  5. * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_WL_DAY_CYCLE_H
  27. #define LL_WL_DAY_CYCLE_H
  28. class LLWLDayCycle;
  29. #include <vector>
  30. #include <map>
  31. #include <string>
  32. #include "llwlparamset.h"
  33. #include "llwlanimator.h"
  34. struct LLWLParamKey;
  35. #include "llenvmanager.h" // for LLEnvKey::EScope
  36. class LLWLDayCycle
  37. {
  38. LOG_CLASS(LLWLDayCycle);
  39. public:
  40. // lists what param sets are used when during the day
  41. std::map<F32, LLWLParamKey> mTimeMap;
  42. // how long is my day
  43. F32 mDayRate;
  44. public:
  45. /// simple constructor
  46. LLWLDayCycle();
  47. /// simple destructor
  48. ~LLWLDayCycle();
  49. /// load a day cycle
  50. void loadDayCycle(const LLSD& llsd, LLEnvKey::EScope scope);
  51. /// load a day cycle
  52. void loadDayCycleFromFile(const std::string & fileName);
  53. /// save a day cycle
  54. void saveDayCycle(const std::string & fileName);
  55. /// save a day cycle
  56. void save(const std::string& file_path);
  57. /// load the LLSD data from a file (returns the undefined LLSD if not found)
  58. static LLSD loadCycleDataFromFile(const std::string & fileName);
  59. /// load the LLSD data from a file specified by full path
  60. static LLSD loadDayCycleFromPath(const std::string& file_path);
  61. /// get the LLSD data for this day cycle
  62. LLSD asLLSD();
  63. // get skies referenced by this day cycle
  64. bool getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs) const;
  65. // get referenced skies as LLSD
  66. bool getSkyMap(LLSD& sky_map) const;
  67. /// clear keyframes
  68. void clearKeyframes();
  69. /// Getters and Setters
  70. /// add a new key frame to the day cycle
  71. /// returns true if successful
  72. /// no negative time
  73. bool addKeyframe(F32 newTime, LLWLParamKey key);
  74. /// adjust a keyframe's placement in the day cycle
  75. /// returns true if successful
  76. bool changeKeyframeTime(F32 oldTime, F32 newTime);
  77. /// adjust a keyframe's parameter used
  78. /// returns true if successful
  79. bool changeKeyframeParam(F32 time, LLWLParamKey key);
  80. /// remove a key frame from the day cycle
  81. /// returns true if successful
  82. bool removeKeyframe(F32 time);
  83. /// get the first key time for a parameter
  84. /// returns false if not there
  85. bool getKeytime(LLWLParamKey keyFrame, F32& keyTime) const;
  86. /// get the param set at a given time
  87. /// returns true if found one
  88. bool getKeyedParam(F32 time, LLWLParamSet& param);
  89. /// get the name
  90. /// returns true if it found one
  91. bool getKeyedParamName(F32 time, std::string & name);
  92. /// @return true if there are references to the given sky
  93. bool hasReferencesTo(const LLWLParamKey& keyframe) const;
  94. /// removes all references to the sky (paramkey)
  95. /// does nothing if the sky doesn't exist in the day
  96. void removeReferencesTo(const LLWLParamKey& keyframe);
  97. };
  98. #endif