PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms 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
  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
 27#ifndef LL_WL_DAY_CYCLE_H
 28#define LL_WL_DAY_CYCLE_H
 29
 30class LLWLDayCycle;
 31
 32#include <vector>
 33#include <map>
 34#include <string>
 35#include "llwlparamset.h"
 36#include "llwlanimator.h"
 37struct LLWLParamKey;
 38#include "llenvmanager.h" // for LLEnvKey::EScope
 39
 40class LLWLDayCycle
 41{
 42	LOG_CLASS(LLWLDayCycle);
 43public:
 44
 45	// lists what param sets are used when during the day
 46	std::map<F32, LLWLParamKey> mTimeMap;
 47
 48	// how long is my day
 49	F32 mDayRate;
 50
 51public:
 52
 53	/// simple constructor
 54	LLWLDayCycle();
 55
 56	/// simple destructor
 57	~LLWLDayCycle();
 58
 59	/// load a day cycle
 60	void loadDayCycle(const LLSD& llsd, LLEnvKey::EScope scope);
 61
 62	/// load a day cycle
 63	void loadDayCycleFromFile(const std::string & fileName);
 64
 65	/// save a day cycle
 66	void saveDayCycle(const std::string & fileName);
 67
 68	/// save a day cycle
 69	void save(const std::string& file_path);
 70
 71	/// load the LLSD data from a file (returns the undefined LLSD if not found)
 72	static LLSD loadCycleDataFromFile(const std::string & fileName);
 73
 74	/// load the LLSD data from a file specified by full path
 75	static LLSD loadDayCycleFromPath(const std::string& file_path);
 76
 77	/// get the LLSD data for this day cycle
 78	LLSD asLLSD();
 79
 80	// get skies referenced by this day cycle
 81	bool getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs) const;
 82
 83	// get referenced skies as LLSD
 84	bool getSkyMap(LLSD& sky_map) const;
 85
 86	/// clear keyframes
 87	void clearKeyframes();
 88
 89	/// Getters and Setters
 90	/// add a new key frame to the day cycle
 91	/// returns true if successful
 92	/// no negative time
 93	bool addKeyframe(F32 newTime, LLWLParamKey key);
 94
 95	/// adjust a keyframe's placement in the day cycle
 96	/// returns true if successful
 97	bool changeKeyframeTime(F32 oldTime, F32 newTime);
 98
 99	/// adjust a keyframe's parameter used
100	/// returns true if successful
101	bool changeKeyframeParam(F32 time, LLWLParamKey key);
102
103	/// remove a key frame from the day cycle
104	/// returns true if successful
105	bool removeKeyframe(F32 time);
106
107	/// get the first key time for a parameter
108	/// returns false if not there
109	bool getKeytime(LLWLParamKey keyFrame, F32& keyTime) const;
110
111	/// get the param set at a given time
112	/// returns true if found one
113	bool getKeyedParam(F32 time, LLWLParamSet& param);
114
115	/// get the name
116	/// returns true if it found one
117	bool getKeyedParamName(F32 time, std::string & name);
118
119	/// @return true if there are references to the given sky
120	bool hasReferencesTo(const LLWLParamKey& keyframe) const;
121
122	/// removes all references to the sky (paramkey)
123	/// does nothing if the sky doesn't exist in the day
124	void removeReferencesTo(const LLWLParamKey& keyframe);
125};
126
127
128#endif