PageRenderTime 28ms CodeModel.GetById 12ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llemote.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 122 lines | 35 code | 30 blank | 57 comment | 0 complexity | d7c7b690bbbf8eda2c34f551a53e6112 MD5 | raw file
  1/** 
  2 * @file llemote.h
  3 * @brief Definition of LLEmote class
  4 *
  5 * $LicenseInfo:firstyear=2002&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_LLEMOTE_H
 28#define LL_LLEMOTE_H
 29
 30//-----------------------------------------------------------------------------
 31// Header files
 32//-----------------------------------------------------------------------------
 33#include "llmotion.h"
 34#include "lltimer.h"
 35
 36#define MIN_REQUIRED_PIXEL_AREA_EMOTE 2000.f
 37
 38#define EMOTE_MORPH_FADEIN_TIME 0.3f
 39#define EMOTE_MORPH_IN_TIME 1.1f
 40#define EMOTE_MORPH_FADEOUT_TIME 1.4f
 41
 42class LLVisualParam;
 43
 44//-----------------------------------------------------------------------------
 45// class LLEmote
 46//-----------------------------------------------------------------------------
 47class LLEmote :
 48	public LLMotion
 49{
 50public:
 51	// Constructor
 52	LLEmote(const LLUUID &id);
 53
 54	// Destructor
 55	virtual ~LLEmote();
 56
 57public:
 58	//-------------------------------------------------------------------------
 59	// functions to support MotionController and MotionRegistry
 60	//-------------------------------------------------------------------------
 61
 62	// static constructor
 63	// all subclasses must implement such a function and register it
 64	static LLMotion *create(const LLUUID &id) { return new LLEmote(id); }
 65
 66public:
 67	//-------------------------------------------------------------------------
 68	// animation callbacks to be implemented by subclasses
 69	//-------------------------------------------------------------------------
 70
 71	// motions must specify whether or not they loop
 72	virtual BOOL getLoop() { return FALSE; }
 73
 74	// motions must report their total duration
 75	virtual F32 getDuration() { return EMOTE_MORPH_FADEIN_TIME + EMOTE_MORPH_IN_TIME + EMOTE_MORPH_FADEOUT_TIME; }
 76
 77	// motions must report their "ease in" duration
 78	virtual F32 getEaseInDuration() { return EMOTE_MORPH_FADEIN_TIME; }
 79
 80	// motions must report their "ease out" duration.
 81	virtual F32 getEaseOutDuration() { return EMOTE_MORPH_FADEOUT_TIME; }
 82
 83	// called to determine when a motion should be activated/deactivated based on avatar pixel coverage
 84	virtual F32 getMinPixelArea() { return MIN_REQUIRED_PIXEL_AREA_EMOTE; }
 85
 86	// motions must report their priority
 87	virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
 88
 89	virtual LLMotionBlendType getBlendType() { return NORMAL_BLEND; }
 90
 91	// run-time (post constructor) initialization,
 92	// called after parameters have been set
 93	// must return true to indicate success and be available for activation
 94	virtual LLMotionInitStatus onInitialize(LLCharacter *character);
 95
 96	// called when a motion is activated
 97	// must return TRUE to indicate success, or else
 98	// it will be deactivated 
 99	virtual BOOL onActivate();
100
101	// called per time step
102	// must return TRUE while it is active, and
103	// must return FALSE when the motion is completed.
104	virtual BOOL onUpdate(F32 time, U8* joint_mask);
105
106	// called when a motion is deactivated
107	virtual void onDeactivate();
108
109	virtual BOOL canDeprecate() { return FALSE; }
110
111protected:
112
113	LLCharacter*		mCharacter;
114
115	LLVisualParam*		mParam;
116};
117
118
119
120#endif // LL_LLEMOTE_H
121
122